the role of interpreters in high energy physics · compiled vs. interpreter compiled: usually many...
TRANSCRIPT
![Page 1: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/1.jpg)
The Role of Interpreters in High Energy Physics
VEESC 2010 Philippe Canal (Fermilab, Chicago, IL)
![Page 2: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/2.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 2
High Energy Physics Large datasets
• 15 petabytes a year
Often analyzed (directly or indirectly) • more than half a petabytes is reprocessed per day
in just the Open Science Grid!
Using up a lot of cpu • More than 16 millions cpu hours
a month on OSG.
Every little bit can make a big difference.
![Page 3: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/3.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 3
High Energy Physics Thousands of collaborators. Each physicist is a developer.
Participation and CS skill varies.
• Framework • Reconstruction, Simulation • Modules (some common,
some not) • Run on large scale data set
• Analysis (private or shared). • Run on smaller scale data set • Shared by small(er) groups. • Often but not always relies on
the framework.
Common threads: data formats, core tools (ROOT/Cint/PyRoot).
![Page 4: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/4.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 4
Interpreter Applications Wide Range: • Job Management, submission, error control • Gluing programs and configurations • “Volatile” algorithms subject to change or part of
configuration In use in various forms for decades:
• Kumacs (adhoc), Comis (Fortran interpreter), 1980s • CINT (C++ interpreter), 1990s • perl, bash, tcsh, Tcl/Tk, Python, etc.
![Page 5: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/5.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 5
CINT Started in 1991 by Masaharu Goto, originally in C.
>300k real LOC (excluding comments / empty lines) Default interface to ROOT (data analysis framework used
by 20k users worldwide) • C++ Parser • Dictionary generator • Reflection data manager • Code and library manager • C++ Interpreter
Non Intrusive Input/Output Framework
with automatic schema evolution
![Page 6: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/6.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 6
From Text
Analyses subject to change • Different cuts, parameters • Different input / output
Configure with ease using text files:
JetETMin: 12 NJetsMin: 2
<JetETMin value="12"/> <NJetsMin value="2"/>
![Page 7: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/7.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 7
To Code Volatile Algorithms: Changes to algorithms themselves, especially during
development: » two jets and one muon each » three jets and two muons anywhere » no isolated muon
Configuration not trivial!
TriggerFlags.doMuon=False EFMissingET_Met.Tools = \ [EFMissingETFromFEBHeader()]
![Page 8: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/8.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 8
Algorithms as Configuration Acknowledge physicists’ reality: • Refining analyses is asymptotic process • Programs and algorithms change • Often tens or hundreds of optimization steps before
target algorithm is found
• Almost the same: » background analysis vs. signal analysis » trigger A vs. trigger B
![Page 9: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/9.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 9
Interpreter Advantage: Data Access • Make it easier to use higher level constructs • Hide data details irrelevant for analysis
vector – hash_map – list? Who cares!
• Framework provides job setup transparently
• Remove (hide) compilation step • (Often) Simplify memory management
foreach electron {...
MyAnalysis(const Event& event)
![Page 10: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/10.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 10
Interpreter Advantage: Localized Compiled: distributed changes
usually many packages need changes by regular physicists as opposed to release managers
Interpreter: localized changes • Easier to track (CVS / SVN) • Less side effects • Feeling of control over software • Eases communication / validation of algorithms
![Page 11: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/11.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 11
Interpreter Advantage: Agility Interpreter boosts users' agility compared to
configuration file: • more expressiveness • thus higher threshold for recompilation of the
framework Distribution is simplified
• One package for all platforms • But: when more advanced features and packages are used
the deployment becomes more difficult.
![Page 12: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/12.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 12
Compiled vs. Interpreter Compiled:
usually many packages need changes by regular physicists as opposed to release managers
Interpreter: helps localize changes, modular algorithmic test bed
![Page 13: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/13.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 13
Why Not To Use Interpreters? Slower than compiled code Difficult to quantify:
• nested loops
• calls into libraries
• virtual functions, etc. In our experience usually O(1)-O(10) slower than
compiled code Interpreters can not replace compiled code for the core
components and cpu intensive algorithm
hist.Draw()
foreach event { foreach muon {...
![Page 14: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/14.jpg)
Why Not To Use Interpreters? • Slower than compiled code • Not integrated well with reconstruction software • Seen as unreliable • Not part of the build system • Difficult to debug • Lack of static type checks
2010-09-03 14 VEESC 2010 • Philippe Canal, Fermilab
![Page 15: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/15.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 15
Where Not To Use Interpreters? Interpreters can not replace compiled code for the core
components and cpu intensive algorithms: • Input/Output, Minimization • Trackings, Simulations, Jet clustering algorithms, etc.
Dynamically typed languages are inherently slower that statically typed language: • at the very least due to the need to check the type.
Consequently: • Any interpreter needs to interface with compiled code.
![Page 16: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/16.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 16
Ideal Interpreter 1. Fast, e.g. compile just-in-time
2. No errors introduced: quality of all ingredients
3. Good support for using and accessing user provided compiled code libraries.
Code
Output
Interpreter Parser
Execution
Bytecode
![Page 17: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/17.jpg)
Ideal Interpreter 4. Smooth transition to compiled code,
with compiler or conversion to compiled language 5. Straight-forward use: known / easy language. 6. Possible extensions with conversion to e.g. C++
foreach electron in tree.Electrons
vector<Electron>* ve = 0; tree-‐>SetBranchAddress("Electrons", ve); for (int i=0; i<ve.size(); ++i) { Electron* electron = ve[i];
2010-09-03 17 VEESC 2010 • Philippe Canal, Fermilab
![Page 18: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/18.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 18
Interpreter Options: Custom Even though not interpreted as interpreter:
postzerojets.nJetsMin: 0 postzerojets.nJetsMax: 0
+postZeroJets.Run: NJetsCut(postzerojets) \ VJetsPlots(postZeroJetPlots)
postzerojets.JetBranch: %{VJets.GoodJet_Branch}
Parameters
Algorithm
![Page 19: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/19.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 19
Interpreter Options: Python • Distinct interpreter language • Interface to ROOT • Rigid style • Easy to learn, read, communicate
h1f = TH1F('h1f','Test',200,0,10) h1f.SetFillColor(45) h1f.FillRandom('sqroot', 10000) h1f.Draw()
![Page 20: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/20.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 20
Python: Abstraction Real power is abstraction: • can do without types: • can loop without knowing collection:
Major weakness: compile time errors become runtime errors
for event in events: muons = event.Muons for muon in muons: print muon.pt()
h1f = TH1F(...)
![Page 21: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/21.jpg)
Interfacing Challenges Non-overlapping concepts • Lifetime
• Garbage collection vs. directed management. • Return values.
• Containers • Template instantiation
2010-09-03 21 VEESC 2010 • Philippe Canal, Fermilab
Owned* getOwned() { // Owner self-‐registers // in a list Owner* o = new Owner(); return o-‐>GetOwned(); }
def getOwned(): o = Owner(); return o.GetOwned() o2 = getOwned() # ouch, ~Owner() called # destructing owner an owned
![Page 22: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/22.jpg)
Interfacing Challenges
• Creation of the interfacing wrappers • Can be automated at runtime if compiled language
supports reflection and introspection. • Provided for C++ by CINT (see slide “CINT and
Dictionaries)
2010-09-03 22 VEESC 2010 • Philippe Canal, Fermilab
![Page 23: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/23.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 23
PyROOT: The Maze ROOT's python interface:
CINT
Experiment code
PyROOT
ROOT
Dictionary
![Page 24: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/24.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 24
Common Interpreter Options: CINT • C++ is prerequisite to data analysis anyway –
interpreter often used for first steps • Can migrate code to framework! • Seamless integration with C++ software, e.g. ROOT
itself • Rapid edit/run cycles compared to framework
void draw() { TH1F* h1 = new TH1F(...); h1-‐>Draw(); }
![Page 25: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/25.jpg)
Common Interpreter Options: CINT Forgiving
• automatic #includes, automatic library loading, can do without types
// load libHist.so // #include "TH1.h"
void draw() { h1 = new TH1F(...); h1-‐>Draw(); }
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 25
![Page 26: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/26.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 26
Common Interpreter Options: CINT Covers large parts of ISO C++:
templates, virtual functions, etc. >15 years of development!
Can be invoked from compiled code:
Or from prompt, e.g. on a whole C++ file:
gROOT-‐>ProcessLine("new Klass(12)");
root [0] .L MyCode.cxx
![Page 27: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/27.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 27
CINT And Libraries Call into library:
Even custom library:
Knows what "Klass" is! Translates "Klass::Gimme()" into a call!
root [0] gSystem-‐>Load("Klass.so") root [1] Klass* k = Klass::Gimme() root [2] k-‐>Say()
TH1F* h1 = new TH1F(...); h1-‐>Draw();
![Page 28: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/28.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 28
CINT And Dictionaries CINT must know available types, functions • C++ does not provide this information at run-time.
Extracted by special CINT run from library's headers • an alternative (Reflex) exists
Also prerequisite for data storage, see "Data and C++" in backup slides.
![Page 29: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/29.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 29
Reflection and Dictionaries Reflection is database, dictionary is data.
Refection data can be generated from
• user: Reflect::AddClass("MyClass") • headers using modified compiler: GCCXML • headers using custom parser: CINT • debug information
![Page 30: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/30.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 30
Interpreter Access Reflection allows interactive use of classes
Interpreter knows type A, function f(), e.g.:
And how to pass arguments – using stubs:
gROOT-‐>ProcessLine("A::f(1)")
ClassBuilder("A"). AddFunction("f", Type("int"))
void stub_A_f(void* args[]){ A::f((int)args[0]); }
![Page 31: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/31.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 31
Overview Of Reflection Data
Dictionary
Parser
Headers
I/O
Structure
MyDict.cxx
rootcint
MyClass.h
ROOT I/O
Example
Interpreter Interpreter
![Page 32: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/32.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 32
CINT And ACLiC The plus in
Invokes: • dictionary generator • compiler • linker Any platform, any compiler, with any libraries! Trivial transition from interpreted to compiled!
root [0] .L MyCode.cxx+
![Page 33: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/33.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 33
Traditional Decomposition
Performance
Inte
ract
ivity
Compiled Code
Interpreted Code
![Page 34: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/34.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 34
Less Walls With ACLiC
Performance
Inte
ract
ivity
Compiled Code
Interpreted Code
![Page 35: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/35.jpg)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 35
LLVM Alternative to CINT based on LLVM Compiler
Infrastructure Project. See llvm.org
LLVM is "much more than a compiler" Modular design, allows us to hook e.g. into • output of parser, • language-independent code representation (IR) Offers JIT, bytecode interpreter…
![Page 36: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/36.jpg)
Summary: Interpreters Wide spectrum of applications and solutions
Python and CINT are widespread and reasonable options with different use cases Can make it easier to use higher level constructs.
Easier to share Can not replace compiled code: • Performance • Difficulty in debugging and maintaining large code base • Lack of static type checks
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 36
![Page 37: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/37.jpg)
Summary: C++ Interpreter Interface between interpreter and compiled code is
essential but delicate.
CINT’s transparent transition between interpreted and compiled world is a huge benefit
Continually enhancing our C++ interpreter based on many years of practical experience.
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 37
![Page 38: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/38.jpg)
Backups Slides
C++ and Data (slide 39+) What is CINT (slide 62+)
2010-09-03 VEESC 2010 • Philippe Canal, Fermilab 38
![Page 39: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/39.jpg)
ACAT 2008
Axel Naumann (CERN), Philippe Canal (Fermilab)
C++ and Data
An overview of serialization in C++
![Page 40: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/40.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 40
• Experiments' frameworks: C++
• Physicists' analyses: C++
• High performance, collaborative development,…
• Experiments' data: C++ objects on tape
→ Serialization with C++!
What Data? Why C++?
![Page 41: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/41.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 41
Ingredients Storing data means: • Reflection: types? members? • Introspection: what is its type? • Object instantiation from type / destruction • I/O: memory to disk and back (endianness)
• Pointer / References ([un]swizzling) • Schema Evolution: enabling changes
![Page 42: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/42.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 42
Ingredients » Language support requested: • Reflection: types? members? • Introspection: what is its type? • Object instantiation from type / destruction • I/O: memory to disk and back (endianness)
» I/O framework's job (e.g. ROOT): • Pointer / References ([un]swizzling) • Schema Evolution: enabling changes
![Page 43: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/43.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 43
Ingredients » Language support requested: • Reflection: types? members? • Introspection: what is its type? • Object instantiation from type / destruction • I/O: memory to disk and back (endianness)
» I/O framework's job (e.g. ROOT): • Pointer / References ([un]swizzling) • Schema Evolution: enabling changes
not covered here!
![Page 44: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/44.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 44
Serialization Everywhere Other languages offer some of these ingredients,
usually excluding pointer / reference swizzling, schema evolution:
• Java
• Python
• .NET
class C implements Serializable
cPickle.dump(myObj, file, -‐1)
[Serializable] class C
![Page 45: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/45.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 45
Serialization In C++? C++ supports none of these ingredients: • Reflection: missing • Introspection: basic, fragile (typeid) • Object instantiation from type: missing • Raw I/O: yes, endianness: missing • Pointer Swizzling: missing • Schema Evolution: missing
![Page 46: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/46.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 46
Serialization Not In C++ None of the relevant ingredients supported Must rely on external packages, using e.g. • templates (type description level) • typeid (introspection) • CPP macros
Look at consequence of matching external packages to custom code
![Page 47: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/47.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 47
Intrusiveness Changes types to add serialization support Often base, friend, etc. » Do I need to change the header?
Example: Microsoft's MFC: inheritance from CObject;
Reflex: no requirements
class C: public CObject
![Page 48: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/48.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 48
Dictionary: What's In A Type
Explicit enumeration of members / bases?
Example: boost::serialization (paraphrased)
Reflex: dictionaries from headers; part of build
class C { void serialize(Archive& ar) { ar & m; } std::string m; };
![Page 49: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/49.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 49
Object Construction Serialization: 1. create object in memory given its type name, 2. fill object with stored data
Object construction needs access to constructor
Why not add access to all public functions?
![Page 50: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/50.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 50
Interpreter Access Reflection allows interactive use of classes
Interpreter knows type A, function f(), e.g.:
And how to pass arguments – using stubs:
gROOT-‐>ProcessLine("A::f(1)")
ClassBuilder("A"). AddFunction("f", Type("int"))
void stub_A_f(void* args[]){ A::f((int)args[0]); }
![Page 51: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/51.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 51
Reflection – Market Overview Database of available types and their structure Main available C++ reflection libraries (unordered) : • XCppRefl • CppReflection
• ROOT’s Reflex: Google's #1 product for "C++ reflection" – no wonder industry cares about it…
Wikipedia
![Page 52: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/52.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 52
Reflection and Dictionaries Reflection is database, dictionary is data.
Refection data generated from
• user: Reflect::AddClass("MyClass") • headers using modified compiler: GCCXML • headers using custom parser: CINT • debug information
![Page 53: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/53.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 53
Overview Of Reflection Data
Dictionary
Parser
Headers
I/O
Structure
G__My.cxx
rootcint
MyClass.h
ROOT I/O
Example
![Page 54: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/54.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 54
Overview Of Reflection Data
Dictionary
Parser
Headers
I/O
Structure
My_rflx.cxx
genreflex [GCCXML]
MyClass.h
ROOT I/O
Example
![Page 55: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/55.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 55
Reflection Data Dictionary creation: time consuming Currently persistent as generated C++, excerpt:
static void G__setup_memfuncTObjArray(void) { G__tag_memfunc_setup(G__get_linked_tagnum(&G__G__ContLN_TObjArray)); G__memfunc_setup("BoundsOk",805,(G__InterfaceMethod) NULL, 103, -‐1, G__defined_typename("Bool_t"), 0, 2, 1, 2, 8, "C -‐ -‐ 10 -‐ where i -‐ 'Int_t' 0 -‐ at", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Init",404,(G__InterfaceMethod) NULL, 121, -‐1, -‐1, 0, 2, 1, 2, 0, "i -‐ 'Int_t' 0 -‐ s i -‐ 'Int_t' 0 -‐ lowerBound", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("TObjArray",878,G__G__Cont_81_0_5, 105, G__get_linked_tagnum(&G__G__ContLN_TObjArray), -‐1, 0, 2, 1, 1, 0, "i -‐ 'Int_t' 0 'TCollection::kInitCapacity' s i -‐ 'Int_t' 0 '0' lowerBound", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("TObjArray",878,G__G__Cont_81_0_6, 105, G__get_linked_tagnum(&G__G__ContLN_TObjArray), -‐1, 0, 1, 1, 1, 0, "u 'TObjArray' -‐ 11 -‐ a", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("operator=",937,G__G__Cont_81_0_7, 117, G__get_linked_tagnum(&G__G__ContLN_TObjArray), -‐1, 1, 1, 1, 1, 0, "u 'TObjArray' -‐ 11 -‐ -‐ ", (char*)NULL, (void*) NULL, 0); G__memfunc_setup("Clear",487,(G__InterfaceMethod) NULL,121, -‐1,-‐1, 0, 1, 1, 1, 0, "C -‐ 'Option_t' 10 '\"\"' option", (char*)NULL, (void*) NULL, 1);
![Page 56: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/56.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 56
Reflection Data Dictionary sources compiled, linked into library
Become part of enhanced library:
Alternative: keep separate dictionary library
![Page 57: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/57.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 57
Reflection Data Dictionaries contain large amount of data About 1/3 of library size: depends on amount of • templates, • functions,…
![Page 58: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/58.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 58
• Dictionary stub for each function • Entry for each type • Entry for each member (data, function) • Names, types, parameters…
Dictionary Size
![Page 59: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/59.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 59
Reflection Data Optimization Reflection data, function access optimization • Load on demand • Less / no copies of strings • No stubs (use library symbols instead)
_ZN1AC1Ev _ZN1A3HiAEv
…
Library Symbols
A::A() A::HiA()
…
Reflection Data
![Page 60: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/60.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 60
Reflection Data Optimization ROOT will soon serialize reflection objects Proof of concept already implemented • Reduce disk space • Improve build (no libraries) • Unload when done
![Page 61: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/61.jpg)
2008-11-04 ACAT 2008 • Axel Naumann (CERN), Philippe Canal (Fermilab) 61
Summary: C++ And Data An incredibly complex relationship Understood, mastered, optimized in HEP Visible outside HEP, sought-after by industry
And we did not even talk about I/O…
![Page 62: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/62.jpg)
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
![Page 63: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/63.jpg)
2007-03-26 ROOT 2007 63
Status and Future of CINT What is it? Why does ROOT need it? CINT's current status CINT's future:
– Dictionary developments – Object oriented design – Multithreading support
![Page 64: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/64.jpg)
2007-03-26 ROOT 2007 64
What is CINT? Reflection data manager Dictionary generator C++ Parser Code and library manager Interpreter
Started in 1991 by Masaharu Goto, originally in C >300k real LOC (excluding comments / empty lines) ROOT is major "customer" of CINT
![Page 65: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/65.jpg)
2007-03-26 ROOT 2007 65
What is CINT? Reflection CINT manages reflection data (type information):
1. Which types are defined?
Use case: THtml generates doc for all known classes root [0] THtml h
root [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
...
![Page 66: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/66.jpg)
2007-03-26 ROOT 2007 66
What is CINT? Reflection CINT 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 file
root [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
![Page 67: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/67.jpg)
2007-03-26 ROOT 2007 67
What is CINT? Reflection CINT manages reflection data (type information):
4. Which functions does TNeuron have?
Use case: function lookup in interpreter
root [0] TNeuron neuron root [1] neuron.MoreCoffee()
Error: Can't call TNeuron::MoreCoffee()
![Page 68: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/68.jpg)
2007-03-26 ROOT 2007 68
What is CINT? Reflection CINT 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));
![Page 69: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/69.jpg)
2007-03-26 ROOT 2007 69
What is CINT? Reflection CINT 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
![Page 70: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/70.jpg)
2007-03-26 ROOT 2007 70
What Is CINT? Reflection data manager Dictionary generator C++ Parser Code and library manager Interpreter
ROOT's dictionary generator rootcint is based on CINT
![Page 71: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/71.jpg)
2007-03-26 ROOT 2007 71
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
![Page 72: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/72.jpg)
2007-03-26 ROOT 2007 72
What Is CINT? Reflection data manager Dictionary generator C++ Parser Code and library manager Interpreter
ROOT prompt .x Macro.C
gROOT->ProcessLine(...)
![Page 73: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/73.jpg)
2007-03-26 ROOT 2007 73
Current Status Major 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
![Page 74: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/74.jpg)
Dictionary Size Dictionary 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 ROOT 2007 74
![Page 75: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/75.jpg)
Dictionary Size Dictionary 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 ROOT 2007 75
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 support 6. byte-code compiler (loop, scoping problems)
Extract address of "TObject::GetName()" from library, forward calls directly too that address
![Page 76: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/76.jpg)
Dictionary Size Dictionary 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 ROOT 2007 76
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 support 6. byte-code compiler (loop, scoping problems
Extract address of "TObject::GetName()" from library, forward calls directly too that address
Store dictionary data in precompiled header file, instead of compiled dictionary
![Page 77: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/77.jpg)
Dictionary Size Dictionary 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 ROOT 2007 77
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 support 6. byte-code compiler (loop, scoping problems
Extract address of "TObject::GetName()" from library, forward calls directly too that address
Store dictionary data in precompiled header file, instead of compiled dictionary
Calculate member inspection data on the fly or examine (compiler dependent) memory layout
![Page 78: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/78.jpg)
On-Demand Dictionary Currently: dictionaries for all types On-demand: generate and cache needed dictionaries
Need class "MyClass<int>", but no dictionary 1. parse MyClass's header 2. create dictionary for "MyClass<int>" 3. compile (ACLiC) / load dictionary Great for templates: no 100 dicts for 100 template
specializations "just in case"
2007-03-26 ROOT 2007 78
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 support 6. byte-code compiler (loop, scoping problems
![Page 79: The Role of Interpreters in High Energy Physics · Compiled vs. Interpreter Compiled: usually many packages need changes by regular physicists as opposed to release managers Interpreter:](https://reader036.vdocuments.mx/reader036/viewer/2022063010/5fc425fba53e8317a723917b/html5/thumbnails/79.jpg)
Summary CINT amazingly stable: very few lines changed,
virtually no API changes; well maintained Shortcomings known Remedy: alternative to CINT based on LLVM
Compiler Infrastructure Project.
2007-03-26 ROOT 2007 79