status and future of cint
DESCRIPTION
Status and Future of CINT. Reflex as Reflection Database Object-Oriented CINT Multi-Threading Masaharu Goto, Agilent • Philippe Canal, Fermilab • Stefan Roiser, CERN Paul Russo, Fermilab • Axel Naumann*, CERN (*) 100% CINT. Status and Future of CINT. What is it? How does ROOT rely on it? - PowerPoint PPT PresentationTRANSCRIPT
Status and Future of CINT
Reflex as Reflection DatabaseObject-Oriented CINT
Multi-Threading
Masaharu Goto, Agilent • Philippe Canal, Fermilab • Stefan Roiser, CERN
Paul Russo, Fermilab • Axel Naumann*, CERN(*) 100% CINT
2007-03-26 Axel Naumann • ROOT 2007 2
Status and Future of CINTWhat is it? How does ROOT rely on it?CINT's current statusCINT and Reflex: the new CINT7CINT's future:
– Dictionary developments– Object oriented design– Multi-threading support
2007-03-26 Axel Naumann • ROOT 2007 3
What is CINT?• Reflection data manager• Dictionary generator• C++ Parser• Code and library manager• Interpreter• Byte-code compilerStarted in 1991 by Masaharu Goto, originally
in C>300k real LOC (excluding comments / empty
lines)ROOT is major "customer" of CINT
2007-03-26 Axel Naumann • ROOT 2007 4
What is CINT? ReflectionCINT manages reflection data (type
information):1. Which types are defined?
Use case: THtml generates doc for all known classes
root [0] THtml hroot [1] h.MakeAll(kTRUE)... 346 htmldoc/TAxis.html 345 htmldoc/TBaseClass.html 344 htmldoc/TBenchmark.html 343 htmldoc/TBits.html 342 htmldoc/TBox.html 341 htmldoc/TBrowser.html 340 htmldoc/TBtree.html 339 htmldoc/TBuffer.html...
2007-03-26 Axel Naumann • ROOT 2007 5
What is CINT? ReflectionCINT manages reflection data (type
information):2. Which members do they have?3. Where are they? (Member offset from
object address)
Use case: I/O writes all members to fileroot [0] TH1::Class()->GetStreamerInfo()->ls()StreamerInfo for class: TH1, version=5... Short_t fBarOffset offset=656 Short_t fBarWidth offset=658 Double_t fEntries offset=664 Double_t fTsumw offset=672 Double_t fTsumw2 offset=680
2007-03-26 Axel Naumann • ROOT 2007 6
What is CINT? ReflectionCINT manages reflection data (type
information):4. Which functions does TNeuron have?
Use case: function lookup in interpreter
root [0] TNeuron neuronroot [1] neuron.MoreCoffee()Error: Can't call TNeuron::MoreCoffee()
2007-03-26 Axel Naumann • ROOT 2007 7
What is CINT? ReflectionCINT manages reflection data (type
information):5. Call a function
Use case: Signal / Slot mechanism in GUI,e.g. sort TBrowser entries by name if name column header is clicked
Connect("Clicked()", "TRootBrowser", fBrowser, Form("SetSortMode(=%d)", kViewArrangeByName));
2007-03-26 Axel Naumann • ROOT 2007 8
What is CINT? ReflectionCINT manages reflection data (type
information):1. Which types are defined? 2. Which members do they have?3. Where are they?4. Which functions does TNeuron have?5. Call a function
2007-03-26 Axel Naumann • ROOT 2007 9
What Is CINT?• Reflection data manager• Dictionary generator• C++ Parser• Code and library manager• Interpreter
ROOT's dictionary generator rootcint is based on CINT(genreflex+GCCXML is an alternative)
2007-03-26 Axel Naumann • ROOT 2007 10
What Is CINT?• Reflection data manager• Dictionary generator• C++ Parser• Code and library manager• Interpreter
CINT remembers which macros, libraries were loaded; can re-parse for template instantiations
2007-03-26 Axel Naumann • ROOT 2007 11
What Is CINT?• Reflection data manager• Dictionary generator• C++ Parser• Code and library manager• Interpreter
ROOT prompt.x Macro.CgROOT->ProcessLine(...)
2007-03-26 Axel Naumann • ROOT 2007 12
Current StatusMajor developments since last workshop:• Many limitations removed, e.g. concerning
array vs. scalar, auto-loading• Many new features, e.g. AMD64, MS
VisualC++ 2005 support• Reduced memory footprint (-10MB when
running ROOT’s benchmarks.C)• New build system both for CINT itself
(configure) and ROOT’s CINT (cintdlls-Makefile)
• Bug fixes
CINT, ReflexReflex: package to store reflection (=type info)
dataClean C++ API: Type, Scope, Member, e.g. Type::GetDeclaringScope()Scope::SubTypes_Begin()Member::GetType()
To replace CINT’s C structs:• Easier to maintain due to grouping of
functionality (object oriented database), access control, etc
• Fully dynamic, thus smaller memory footprint2007-03-26 Axel Naumann • ROOT 2007 13
CINT + Reflex = CINT7Needs (more than expected) changes:• in CINT, e.g. due to non-modular code• in Reflex, because CINT is a
challenging user (unloading of macros, delayed dictionary initialization, etc)
Preview (30% done) in $ROOTSYS/cint7Work in progress, parallel to
maintenance of CINT5/6Will become default once stable
2007-03-26 Axel Naumann • ROOT 2007 14
CINT’s FutureDetailed plan of work:
2007-03-26 Axel Naumann • ROOT 2007 15
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
Dictionary SizeDictionary mainly consists of• call wrappers: translate string "TObject::GetName()" to function call
• Function calls to setup dictionary: add "TObject", add its function "GetName()" etc
• Public re-definition of classes to inspect their (otherwise private) members
2007-03-26 Axel Naumann • ROOT 2007 16
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
Dictionary SizeDictionary mainly consists of• call wrappers: translate string "TObject::GetName()" to function call
• Function calls to setup dictionary: add "TObject", add its function "GetName()" etc
• Public re-definition of classes to inspect their (otherwise private) members
2007-03-26 Axel Naumann • ROOT 2007 17
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
Extract address of "TObject::GetName()" fromlibrary, forward calls directly to that address
Dictionary SizeDictionary mainly consists of• call wrappers: translate string "TObject::GetName()" to function call
• Function calls to setup dictionary: add "TObject", add its function "GetName()" etc
• Public re-definition of classes to inspect their (otherwise private) members
2007-03-26 Axel Naumann • ROOT 2007 18
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems
Extract address of "TObject::GetName()" fromlibrary, forward calls directly to that addressStore dictionary data (Reflex objects) in ROOT file, ROOT I/O instead of compiled dictionary
Dictionary SizeDictionary mainly consists of• call wrappers: translate string "TObject::GetName()" to function call
• Function calls to setup dictionary: add "TObject", add its function "GetName()" etc
• Public re-definition of classes to inspect their (otherwise private) members
2007-03-26 Axel Naumann • ROOT 2007 19
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems
Extract address of "TObject::GetName()" fromlibrary, forward calls directly to that addressStore dictionary data (Reflex objects) in ROOT file, ROOT I/O instead of compiled dictionary
Calculate member inspection data on the fly orexamine (compiler dependent) memory layout
On-Demand DictionaryCurrently: dictionaries for all typesOn-demand: automatically generate and
cache only needed dictionariesOn-demand dictionary example:1.access MyClass<int> but no dictionary yet2.automatically parse MyClass's header3.create dictionary for MyClass<int>4.compile (ACLiC) / load dictionaryGreat for templates: no 100 dicts for 100
template specializations "just in case"2007-03-26 Axel Naumann • ROOT 2007 20
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems
Object-Oriented CINTFor ease of maintenance:Refactor code to convert current C-based
to object oriented designStarted planning of new layout:• interpreter• parser• code manager• dictionary database: Reflex
• dictionary generator• byte-code compiler
2007-03-26 Axel Naumann • ROOT 2007 21
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
Multi-Threading SupportFor ease of maintenance and thread safety:Refactor code to convert current C-based
to object oriented designStarted planning of new layout:• interpreter: can have multiple per thread• parser: one for each interpreter• code manager: libraries / macros• dictionary database: Reflex (+ thread
safety); libraries / macros• dictionary generator: "static"• byte-code compiler: "static"
2007-03-26 Axel Naumann • ROOT 2007 22
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
1/process: shared libs,1/interpreter: macros
Byte-Code CompilerByte-code:
custom format for efficient execution of macros
Byte-code compiler: converts macros into byte-code, optimizes it
Problems with scope resolution, loops; difficult to maintain
Status: re-implementation by Masa (CINT6)
2007-03-26 Axel Naumann • ROOT 2007 23
1. finish CINT7 (Reflex)2. minimize dictionaries (direct lib calls,
dict.root)3. on-the-fly dictionaries (template dicts)4. object-oriented CINT (class
G__Interpreter)5. multi-threading support6. byte-code compiler (loop, scoping
problems)
Summary• CINT amazingly stable: very few
changes needed, virtually no API changes
• Well maintained• Shortcomings known, remedy: long list
of planned improvements
Development plans are long scale,with continuous flow of improvements
Benefits arrive on a regular bases!2007-03-26 Axel Naumann • ROOT 2007 24