Upload
bing
View
35
Download
0
Tags:
Embed Size (px)
DESCRIPTION
CINT & Reflex: New Reflection Data Structures. Masa(haru) Goto • Agilent Philippe Canal • Fermilab/CD Stefan Roiser, Axel Naumann • PH/SFT. CINT Is The Prompt, Right?. CINT is Backend for all dictionary based interpreters Execution engine (compiled and interpreted code) - PowerPoint PPT Presentation
Citation preview
CINT & Reflex:New Reflection Data Structures
Masa(haru) Goto • AgilentPhilippe Canal • Fermilab/CD
Stefan Roiser, Axel Naumann • PH/SFT
2006-09-18 AA Review 2006 2
CINT Is The Prompt, Right?CINT is• Backend for all dictionary based interpreters• Execution engine (compiled and interpreted
code)• Prerequisite for signal/slot• Prerequisite for I/OReflection is• Part of CINT’s knowledge, used for all of
above• Info on types and their members: name,
type, access to values or call
2006-09-18 AA Review 2006 3
Data flow
CINT And Reflection
C++ Parser
Reflection Data
Generate Dictionary
Load Dictionary
Interpreter
Reflection C++ API
Compiled Function
Call
ROOT
Uses
Auto-Loadgccxmlgccxmlrootcintrootcint
Dict Gen
2006-09-18 AA Review 2006 4
Common Linkdef.h interfacerootcint -cint, -reflex, -gccxml
Unified Python interface: PyROOT
Comments From Last Review Common Dictionary - unify dictionary clients for
experiments using lcgdict/reflex, unify automatic generation of glue code (e.g. python bindings) [JJ Blaising, feedback talk 1.4.2005]
“
2006-09-18 AA Review 2006 5
Dictionary Options – You Choose!
CINT dictionaryCINT dictionary
Reflex Reflex dictionarydictionary
selection.xml
Linkdef.h
genreflex.py
rootcint ROOT
Cintex
CINT parser
gccxml parser
2006-09-18 AA Review 2006 6
Dictionary Options – The Goal
Reflex Reflex dictionarydictionary
selection.xml
Linkdef.h
genreflex.py
rootcint ROOT
CINT parser
gccxml parser
2006-09-18 AA Review 2006 7
Comments From Last Review (cont’ed)
First version of Cint with Reflex reflection data base expected for end of year – not yet production grade!
Production-grade version available mid 2007Reasons for delay:• Moving functionality from CINT to Reflex• Keeping CINT API backward compatible• Merge process more involved than
expected
Ordering, scheduling, priorities [Final Report 2005]“
2006-09-18 AA Review 2006 8
That’s It? Already?No. This talk’s menu offers following
courses:• Motivation: why we (still) need the
merge• Merge implementation details• Steps of the merge• Merge related development in Cint and
Reflex• Status• Outlook
2006-09-18 AA Review 2006 9
Motivation For Cint-Reflex Merge
C++ code replacing C structs• Smaller heap footprint: factor 3 in
current CVS for CLHEP based example – expected to deteriorate
• Dynamic data structures, no hard-wired limits
• Easier to maintain• Refactoring, separation of functionality• Preparation for thread-safety
2006-09-18 AA Review 2006 10
C++ Code Vs. C structs Example
Current Cint has global C structs struct G__tagtable {
char* name[G__MAXSTRUCT];… } G__struct;
Reflex allows OO access to reflection data Reflex::Scope::GlobalScope();
Covers types, data members, function members, templates,…
2006-09-18 AA Review 2006 11
Merge Implementation - Context
Why you care: reason for merge schedule• CINT mixes reflection and execution
data, need to split carefully• CINT extremely complex: extensive use
of globals, spread of functionality, side effects
• CINT grown and debugged, don’t want to risk breaking parts that work
• Changes need to be “invisible” to users
2006-09-18 AA Review 2006 12
Merge Implementation - Consequence
• Small step changes• Always compare to working version
with extensive test suite• Replace data structures firstMajor benefit will come only later: • replace functionality• remove code duplication• take advantage of OO data structures
2006-09-18 AA Review 2006 13
Steps Of Merge• Need duplication of scope info for both
CINT and Reflex while merging (for contained types)
• Scaffolding, wrappers, convenience functions for Reflex and CINT
• Typedef database: G__newtype Reflex::Type• Globals: G__*tagnum Reflex::Scope• Structs: G__struct Reflex::Scope• Functions: G__ifunc Reflex::FunctionMember• Data members: G__vararry Reflex::DataMember
2006-09-18 AA Review 2006 14
Merge Tactics• New configure; make CINT build system to allow
sensible multi-platform tests• CVS branch for merge, apply bug fixes from
HEAD• All other major development for CINT stalled
until merge is done• Update definition of CINT’s API. Will keep API
backward compatible, use export statements to ensure no internal function is used by e.g. ROOT
• Once done, make libCint.so and libCintNew.so binary compatible, to allow switch without rebuild:mv lib/libCintNew.so lib/libCint.so; root
2006-09-18 AA Review 2006 15
Development In CINT For Merge
• New build system for standalone CINT/Reflex
• API redefinition• Scaffolding to allow transition of data
structures without large re-write of code
• extern “C” wrappers for some functions and classes
+ the actual merge…
2006-09-18 AA Review 2006 16
Development In Reflex For Merge
• Unloading of dictionary• Changes to Reflex::Builder interface • Late (on-demand) initialization of
reflection data• Extended C++ support: using
directives, hiding typedef struct A A, using declarations, friend
• Name Lookup: major boost in Reflex functionality, and damn complex
2006-09-18 AA Review 2006 17
Development In Reflex (cont’ed)
• Fast access of reflex objects’ properties, needed for CINT execution data
• Reflex objects can create dictionary representation of themselves
• Several convenience functions, e.g. discover the raw type (const char* char), the kind of fundamental type etc.
2006-09-18 AA Review 2006 18
Name LookupReflex dictionary generator APIOn the way
Duplication of scopes for CINT and ReflexScaffolding, wrappers, convenience functionalityconfigure && make build systemUpdate of definition of CINT APITypedef, globals reflection databaseUnloading of dictionaryReflex::Builder interface changesReflex support for using directives, hiding typedef struct A AFast access to Reflex objects’ properties
Done!
struct/class/…, function, data member reflection databaseOn demand initialization of Reflex dataReflex support for using declarations, friend
To Do
Status - Where Are We Now?!
!
!!
!
! :
a l
ot
of
work
2006-09-18 AA Review 2006 19
Outlook - MergeMerge related:• First version of CINT using Reflex by
end of year• ROOT’s TClass, TMethod,… classes to
be updated after Cint/Reflex merge, i.e. 2007
• Adaptation of PyROOT to use Reflex API
• Other ROOT occurrences of CINT API calls to be replaced by Reflex API calls
2006-09-18 AA Review 2006 20
Outlook - CINT2007:• Function stubs / call wrappers will be
removed on selected platforms (GCC3,4; MSVC)
• Just-in-time dictionary generator builds dictionary for all template instances needed, when needed
2008:• Reflex persistency - .root instead of .so
???
2006-09-18 AA Review 2006 21
Outlook – Dictionary
Reflex Reflex dictionarydictionary
Linkdef.h /
selection.xml
genreflex.py
rootcint ROOT
CINT parser
gccxml parser
2006-09-18 AA Review 2006 22
Outlook – Dictionary• Current Reflex dictionaries:
• 2007: Remove function stubs on selected platforms
• 2007: Generate template dictionaries on demand• 2008: Don’t “store” Reflex database as .cxx/.o
(part of lib) but as .root file, generate member offset info on-the-fly:
ROOT itself would shrink by ~25%!Improvement independent of selection.xml /
Linkdef.h and gendict.py / rootcint
100%
33%
~1%
2006-09-18 AA Review 2006 23
Outlook2008+:• Future: reconsider gccxml to Reflex
path: gendict.py? C++? PyROOT based?
• CINT thread safety
More details in the coming months – early comments welcome!
2006-09-18 AA Review 2006 24
FIN
2006-09-18 AA Review 2006 25
Dictionaries – The Full Picture 200x
CINTparser
genreflex2
gccxml
genreflex.py
Builder API
User API
cint>>>>
CINTinterpreter
PyReflex
libMy.so
DictionaryGenerator
My.h
My_rflx.cpp
My_rflx.root
PyROOT
Linkdef.h / selection.xml
ReflexDS
libMyRflx.so
make
SymbolLookup
Stub comp. /Offset calc.
ROOT
metahist
math…
Python
ROOT
XML
C/C++
?
XML parser(e.g. Xerces)
genreflex.cpp
XML parser(e.g. expat)
genreflex2.py
PyReflex
either / or
Just in timecompiler
My.xml
dlopenFile
Process
Data
Library
Flow
2006-09-18 AA Review 2006 26
Dictionary Heap UsageCINT, CLHEP example
2500k
2006-09-18 AA Review 2006 27
Dictionary Heap UsageReflex, CLHEP example
700k