CINT Reflex The Future CINTs Future Layout Parser

  • Slides: 1
Download presentation
CINT & Reflex – The Future CINT’s Future Layout Parser Read analyze sources, send

CINT & Reflex – The Future CINT’s Future Layout Parser Read analyze sources, send input to dictionary and code repository s, e l i f s d a s e a r r r e e Pars them eith ally, b s r e e r v o t r s o er e r d o o c d e e t t e y r b rp e t te n i a l e p b m e to t r o f d e s n par o i t a i t n a t s in 1 per process Dictionary Representation of C++ types / members of libraries and macros, includes Reflex 1 per interpreter: loaded macros 1 per process: loaded libraries Code Repository Store sources: macros, byte-code (pre-compiled macros), template definitions, loaded libraries 1 per interpreter: loaded macros Interpreter accesses code repository when calling functions, #including code, etc. Restructure CINT to be object-oriented, with focus on thread-safety, ease of maintenance, speed; consider requirements of dependent projects (ROOT I/O, GUI, Py. ROOT, CINT users) y r a e n t o i a t er or c i n. f d e d : g e. g n a pe y ( ) r l ns e y f t t e a he tio r p w t ia r e o n t t n o n n k ry i a t t f ’ I n s a n n i do ctio ate di mpl te Dictionary Generator Generate persistent dictionary for parsed headers Reflex: : Scope Generic scope description: enclosing scope; can convert to a Reflex: : Type if it’s a class, struct, or union; allows access to enclosed scopes, types, members Reflex: : Member Describe data and function members; iterate through them, get their types, for functions: access list of parameters, get the return type Sto rep re b os yte ito -co ry d ei n Interpreter d ecides what to gene rate byte-code fo r, runs byte-code Byte-Code Compiler Analyze and optimize expressions, store them in a compact format for fast execution 1 per process, Byte-code stored by repository Work In Progress: Simple interface: everything is types, scopes, and/or member Consistent navigation: by name, iteration, direct access Very small API objects: just a pointer (scope: +int), no virtual funcs Hide complex back-end implementation that will allow unloading, persistency, dynamic updates, forward declarations, etc. Generic type description: enclosing scope; can be built as sequence of pointer, const, reference, …; can have bases if it’s a class, can convert to a Reflex: : Scope if it’s a class, struct, or union; functions also have a type, e. g. parameters, return type, constness ≥ 1 per thread 1 per process Reflex API Reflex: : Type Evaluate expressions given a piece of code 1 per process: loaded libraries s n o i s s e r : xp n e o s i t e t a a m u r l o a f v n e i r y r te a e n r o p i " ) ( Inter on dict g e m a N d n t base ates stri o)->Ge l ) s * n t a c tr e j. b l l O a T c n "(( o i t c un f a to Gen erat or fi data lls d i n t o Re ictio stor flex nary es t hem obje cts, as. r oot file Interpreter Get Reflex: : Type representing a char, build const char*. To. Type() returns the underlying type, Type() the kind of type – char is a fundamental type. Type t. C("char"); Type t. CC = Const. Builder(t. C); Type t. PCC = Pointer. Builder(t. CC); t. CC == t. PCC. To. Type(); // true t. C. Type(); // FUNDAMENTAL A class is a type, too: look it up by name, get its enclosing scope "ROOT: : Math", test its properties, get its name including scopes. Type t. I("ROOT: : Math: : Integrator"); Scope s. RM = t. I. Declaring. Scope(); t. I. Is. Class(); t. I. Is. Pointer(); t. I. Is. Const(); // true, false t. I. Name(SCOPED); // "ROOT: : Math: : Integrator" Find a scope by name, as it's a class we can convert it to a type. Access types defined within a scope by iterator or name. Compare two representations of the same type, access a type from the global scope. Scope s. RMI("ROOT: : Math: : Integrator"); Type t. RMI = s. RMI; Type_Iterator i. Sub. Type = s. RMI. Declaring. Scope(). Sub. Type_Begin(); Type t. Sub. Type = s. RMI. Sub. Type. By. Name("Integrator"); t. Sub. Type == t. RMI; // true Scope s. R = Scope: : By. Name("ROOT"); Scope: : Global. Scope(). By. Name("ROOT") == s. R // true • Use Reflex to store dictionary data Smaller memory footprint First step to modularized code • Remove function wrappers in CINT dictionaries for inherited virtual functions Saves 30% of e. g. G__Cont. o Can be implemented on all platforms Call through base class's wrapper • Replace function wrappers by direct library calls on selected systems Saves 55% of e. g. G__Cont. o Highly platform dependent, will only work for selected architectures (GCC, ICC, MSVC) • Shuffle CINT's functionality into an object-oriented layout See above Prerequisite for thread-safety Retrieve a scope's data member by name and iterator, get a member's type. Scope s. Named("TNamed"); Member m. Name = s. Named. Data. Member. By. Name("f. Name"); Member_Iterator i. Member = s. Named. Member_Begin(); Type t. Name = s. Named. Get. Type(); t. Name == Type: : By. Name("TString"); // true Get member function Set. Title(const char* t="") by name, get a function member by direct access. Member functions have a type, too. Query parameters and their default values. Member m. Set. Title = s. Named. Function. Member. By. Name("Set. Title"); Member i. Member = s. Named. Function. Member. At(0); Type t = m. Set. Title. Get. Type(); // (void TNamed: : *)(const char*) int numparams = m. Set. Title. Function. Parameter. Size(); // 1 m. Set. Title. Function. Parameter. Default. At(0); // "" • Make CINT thread-safe • On-the-fly dictionary generation Useful for e. g. templated classes Powerful once direct library calls work • New implementation of the byte-code compiler Major source of ISO C++ incompatibilities