Download presentation
Presentation is loading. Please wait.
Published byElisabeth Melton Modified over 9 years ago
1
2006-05-12 ROOT Team Meeting Axel Naumann CERN PH/SFT Crienftlex Extended Version. And also Director’s Cut. Crienftlex
2
2006-05-12ROOT Team Meeting2 Outline CINT’s parts, content-wise CINT’s layout, code-wise Reflex, where it fits in The CINT-Reflex interface Reflection Data vs. CINT Utility Info CINT Parts not in Reflex AOB: The ROOT Reflection interface CINT Outlook WARNING: Summaries in between! Not the end of talk yet!
3
2006-05-12ROOT Team Meeting3 CINT Parts Parsing 21k lines Reflection 23k lines Execution 63k lines Other 70k lines bytecode expression-eval variables vtbl interpreter tokenizer preproc pragma file i/o
4
2006-05-12ROOT Team Meeting4 Data flow CINT And Reflection C++ Parser Reflection Data Generate Dictionary Load Dictionary Interpreter Reflection C++ API Compiled Function Call ROOT Uses Auto-Load gccxml rootcint Dict Gen
5
2006-05-12ROOT Team Meeting5 CINT Code Layout Data struct types: G__tagtable, G__typedef, G__ifunc_table, G__var_array, G__param, G__friendtag, G__inheritance, G__commentinfo, G__RootSpecial Utility struct types: G__input_file, G__value, G__tempobject_list, G__linked_taginfo, G__bytecodefunc, G__funcentry That was the structured part. Structured?
6
2006-05-12ROOT Team Meeting6 CINT Code Layout - G__ifunc_table G__SIGNEDCHAR_T type[G__MAXIFUNC]; /* type of return value */ short p_tagtable[G__MAXIFUNC]; short p_typetable[G__MAXIFUNC]; G__SIGNEDCHAR_T reftype[G__MAXIFUNC]; short para_nu[G__MAXIFUNC]; G__SIGNEDCHAR_T isconst[G__MAXIFUNC]; G__SIGNEDCHAR_T isexplicit[G__MAXIFUNC]; char para_reftype[G__MAXIFUNC][G__MAXFUNCPARA]; char para_type[G__MAXIFUNC][G__MAXFUNCPARA]; char para_isconst[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_tagtable[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_typetable[G__MAXIFUNC][G__MAXFUNCPARA]; G__value *para_default[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_name[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_def[G__MAXIFUNC][G__MAXFUNCPARA]; char iscpp[G__MAXIFUNC]; char ansi[G__MAXIFUNC]; /* ANSI or standard header format */ struct G__ifunc_table *next; short page; G__SIGNEDCHAR_T access[G__MAXIFUNC]; /*private, protected, public*/ char staticalloc[G__MAXIFUNC]; int tagnum; G__SIGNEDCHAR_T globalcomp[G__MAXIFUNC]; void* userparam[G__MAXIFUNC]; /* user parameter array */ short vtblindex[G__MAXIFUNC]; short vtblbasetagnum[G__MAXIFUNC];
7
2006-05-12ROOT Team Meeting7 CINT Code – C Arrays G__SIGNEDCHAR_T type[G__MAXIFUNC]; /* type of return value */ short p_tagtable[G__MAXIFUNC]; short p_typetable[G__MAXIFUNC]; G__SIGNEDCHAR_T reftype[G__MAXIFUNC]; short para_nu[G__MAXIFUNC]; G__SIGNEDCHAR_T isconst[G__MAXIFUNC]; G__SIGNEDCHAR_T isexplicit[G__MAXIFUNC]; char para_reftype[G__MAXIFUNC][G__MAXFUNCPARA]; char para_type[G__MAXIFUNC][G__MAXFUNCPARA]; char para_isconst[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_tagtable[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_typetable[G__MAXIFUNC][G__MAXFUNCPARA]; G__value *para_default[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_name[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_def[G__MAXIFUNC][G__MAXFUNCPARA]; char iscpp[G__MAXIFUNC]; char ansi[G__MAXIFUNC]; /* ANSI or standard header format */ struct G__ifunc_table *next; short page; G__SIGNEDCHAR_T access[G__MAXIFUNC]; /*private, protected, public*/ char staticalloc[G__MAXIFUNC]; int tagnum; G__SIGNEDCHAR_T globalcomp[G__MAXIFUNC]; void* userparam[G__MAXIFUNC]; /* user parameter array */ short vtblindex[G__MAXIFUNC]; short vtblbasetagnum[G__MAXIFUNC];
8
2006-05-12ROOT Team Meeting8 CINT Code – Reflection, Utility G__SIGNEDCHAR_T type[G__MAXIFUNC]; /* type of return value */ short p_tagtable[G__MAXIFUNC]; short p_typetable[G__MAXIFUNC]; G__SIGNEDCHAR_T reftype[G__MAXIFUNC]; short para_nu[G__MAXIFUNC]; G__SIGNEDCHAR_T isconst[G__MAXIFUNC]; G__SIGNEDCHAR_T isexplicit[G__MAXIFUNC]; char para_reftype[G__MAXIFUNC][G__MAXFUNCPARA]; char para_type[G__MAXIFUNC][G__MAXFUNCPARA]; char para_isconst[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_tagtable[G__MAXIFUNC][G__MAXFUNCPARA]; short para_p_typetable[G__MAXIFUNC][G__MAXFUNCPARA]; G__value *para_default[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_name[G__MAXIFUNC][G__MAXFUNCPARA]; char *para_def[G__MAXIFUNC][G__MAXFUNCPARA]; char iscpp[G__MAXIFUNC]; char ansi[G__MAXIFUNC]; /* ANSI or standard header format */ struct G__ifunc_table *next; short page; G__SIGNEDCHAR_T access[G__MAXIFUNC]; /*private, protected, public*/ char staticalloc[G__MAXIFUNC]; int tagnum; G__SIGNEDCHAR_T globalcomp[G__MAXIFUNC]; void* userparam[G__MAXIFUNC]; /* user parameter array */ short vtblindex[G__MAXIFUNC]; short vtblbasetagnum[G__MAXIFUNC];
9
2006-05-12ROOT Team Meeting9 To be replaced by Reflex To be mashed with Reflex, using Reflex::PropertyList Reflection: describes. Persistent, part of dictionary. E.g. type, name, parameters, enclosing scope Utilities: used by CINT functions. Temporary, context dependent, volatile. E.g. address of compiled function, call parameters CINT Code – Reflection, Tools?
10
2006-05-12ROOT Team Meeting10 CINT Code - Unstructured Cint/inc/global.h alone contains >253 globals. struct G__tagtable G__struct; struct G__typedef G__newtype; struct G__ifunc_table G__ifunc ; struct G__ifunc_table *G__p_ifunc; char G__var_type; /*var decl type*/ char G__var_typeB;/*var decl type for func return */ int G__prerun; /* pre-run flag */ int G__funcheader; /*func header mode*/ Reflection Utility
11
2006-05-12ROOT Team Meeting11 CINT Code - Functions G__using_namespace(...) { var = G__searchvariable(buf,hash,G__p_local, &G__global,&struct_offset, &store_struct_offset,&ig15,0); store_globalvarpointer = G__globalvarpointer; G__globalvarpointer = var->p[ig15]; G__letvariable(varname,G__null,&G__global, G__p_local); G__globalvarpointer = store_globalvarpointer; avar = G__searchvariable(varname,ahash,G__p_local, &G__global,&astruct_offset, &astore_struct_offset,&aig15,0);
12
2006-05-12ROOT Team Meeting12 CINT Code - Functions G__using_namespace(...) { /* boring version */ var = Searchvar(); temp = G__globalvarpointer; G__globalvarpointer = var->p[ig15]; Letvariable(); G__globalvarpointer = temp; avar = Searchvar (); - Side effects, - Globals rule, - Data not visible, - No separation of Reflection & Utility data
13
2006-05-12ROOT Team Meeting13 CINT Code - Summary This job is damn difficult. We understand the internal structure of CINT. We know how to replace what (coming up). There is NO WAY we can do several things in one go.
14
2006-05-12ROOT Team Meeting14 Reflex – Where It Fits In 1:1 match between Cint reflection structs and Reflex classes: CINTReflex G__tagtableType G__typedefType G__ifunc_tableType::FunctionMember… G__var_arrayType::DataMember… G__paramFunction::FunctionParameter… G__friendtag? G__inheritanceType::Bases… G__commentinfo G__RootSpecial PropertyList
15
2006-05-12ROOT Team Meeting15 CINT & Reflex Reflection data structures are NOT the problem. But utility data need adaptation: interpreter’s values, stack, function call args,… And globals. And all of these types cannot stay C (use Reflex now) So functions become C++, too (already now compiled as C++, but C by spirit). So Cint API becomes C++, too.
16
2006-05-12ROOT Team Meeting16 CINT & Reflex, Example (Data) Old G__value New G__value union {...} obj; int type; union {...} obj; int type; int tagnum; int typenum; Reflex::Type tagnum; Reflex::Type typenum; long ref; char isconst; long ref; isconst; Core reflection data: “int”→ Reflex::Type C → C++
17
2006-05-12ROOT Team Meeting17 CINT & Reflex, Example (Info) Old G__value New G__value union {...} obj; int type;int type=damn complex int tagnum; int typenum; Reflex::Type tagnum; Reflex::Type typenum; long ref; char isconst; ~ tagnum.IsPointer(); ~ tagnum.IsConst; In Reflex, Properties part of Type object, not of reference! Some parts easier than others…
18
2006-05-12ROOT Team Meeting18 CINT & Reflex, Example (Info) Old G__value New G__value union {...} obj; int type;G__get_type(tagnum) int tagnum; int typenum; Reflex::Type tagnum; Reflex::Type typenum; long ref; char isconst; G__get_reftype(tagnum) G__get_isconst(tagnum) Transitional translation functions
19
2006-05-12ROOT Team Meeting19 CINT & Reflex Plugging - Summary Many translations are obvious, but even those have long tail of consequences Need changes in small steps → “buffer” changes by introducing wrappers No fundamental problems, “just” coding & debugging Major usage of wrappers: CINT’s lookup G__defined_tagname, G__defined_typename: int tagnum = G__defined_tagname(“TObject”) → Introduce central lookup function in Reflex
20
2006-05-12ROOT Team Meeting20 The Purity Of Reflex – CINT Helpers Reflex is about reflection – not about interpreting, documenting, serializing,… CINT’s little helpers have no place in Reflex: comments, file position, compiled/interpreted? etc Use Reflex “value dump” PropertyList to store class G__RflxProperties { int filenum, linenum; char globalcomp; char iscpplink; G__comment_info comment;};
21
2006-05-12ROOT Team Meeting21 CINT Helpers & Reflex PropertyList Good idea to store CINT Helpers in PropertyList? + Extensible + Easy ? But fast? ? Should e.g. doc, decl / impl location be part of Reflex API? For now: use PropertyList, wrap access from CINT
22
2006-05-12ROOT Team Meeting22 The Path – Leaving Home C to C++, Cint in namespace Migrate only CINT typedef info to Reflex::Type Don’t change any CINT function to use Reflex data (but use CINT info to Reflex wrappers) – only use Reflex object as replacement for “int typenum” Replace lookup, so we don’t suffer from CINT/Reflex incompatible string-ization of types: “int*const*” or “int * const *” or “int ** const”? TEST. (need enclosing scope in CINT & Reflex)
23
2006-05-12ROOT Team Meeting23 The Path – On The Road Same for G__tagtable, G__ifunc_table, G__var_array, G__param Test after each step Remove wrappers, use Reflex directly Test Curtain First Act.
24
2006-05-12ROOT Team Meeting24 Things Not Part Of The Game Make CINT thread safe Make CINT use parameters instead of globals They only make sense after Crienftlex – BUT they don’t benefit. They really are different projects. Don’t expect Crienftlex to give a new Cint!
25
2006-05-12ROOT Team Meeting25 ROOT And CINT Reflection ROOT wraps CINT C++ API CINT C++ API wraps CINT G__tagtable etc C++ API will be backward compatible! No need (code-wise) to change ROOT’s CINT reflection access BUT: huge gain from doing so! Again, independent, and for after Crienftlex!
26
2006-05-12ROOT Team Meeting26 CINT’s Future (1/2) Fallbacks + scaffolding (wrappers etc) removed – 1 st half 2007 Re-structure CINT functions: convert globals to function parameters; generate dictionaries from & into Reflex “Cint context” + “Cint back office” class for thread safety; context for dictionary (macros) & execution: new TCint()->Process(“new TObject”)
27
2006-05-12ROOT Team Meeting27 Call it CINT2 Celebrate New Year’s Eve of the next century CINT’s Future (2/2) Ability to generate dictionaries on the fly, no need to put them into your lib (key for templated classes) Function wrappers removed, call directly into lib Dictionaries persistent (not.o, but.root) Revisit parser
28
2006-05-12ROOT Team Meeting28 The Final Summary (1/2) CINT’s complexity, data layout, function style is major obstacle for the merge – after all, they were the reason for the merge. Do one small step after another, always test for consistency Separate as many tasks and steps as possible
29
2006-05-12ROOT Team Meeting29 The Final Summary (2/2) End of June: CINT API is C++ (no extern “C” anymore), wrappers + typedef tested We will try to have struct G__* replaced, still with wrappers, but faster, smaller memory footprint, tested, in September, right after the production release! Probably introducing cintold + cint[new] in ROOT, allowing dynamic switch as user fallback
30
2006-05-12ROOT Team Meeting30 What Now? Philippe, Stefan, and I believe we’ve determined all necessary ingredients to get the merge done, now we just need time. Work Food Life
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.