2006-05-12 ROOT Team Meeting Axel Naumann CERN PH/SFT Crienftlex Extended Version. And also Director’s Cut. Crienftlex.

Slides:



Advertisements
Similar presentations
Optional Static Typing Guido van Rossum (with Paul Prescod, Greg Stein, and the types-SIG)
Advertisements

PRESENTED BY MATTHEW GRAF AND LEE MIROWITZ Linked Lists.
Status and Future of CINT Reflex as Reflection Database Object-Oriented CINT Multi-Threading Masaharu Goto, Agilent Philippe Canal, Fermilab Stefan Roiser,
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
LLVM-based C++ Interpreter For ROOT Axel Naumann, CERN Lukasz Janyst, CERN Philippe Canal, Fermilab.
Structure of a C program
C Module System C and Data Structures Baojian Hua
Outline Java program structure Basic program elements
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
IT PUTS THE ++ IN C++ Object Oriented Programming.
Bertrand Bellenot root.cern.ch ROOT I/O in JavaScript Reading ROOT files from any web browser ROOT Users Workshop
Chapter 7 Designing Classes. Class Design When we are developing a piece of software, we want to design the software We don’t want to just sit down and.
ZFApp Preview Walkthrough. What is ZFApp? ZFApp is an application framework built on top of Zend Framework Fully compatible with the latest ZF Versions.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
M.Frank CERN/LHCb - Persistency Workshop, Dec.2004 Agenda: 2 separate talks! Don’t mangle together what does not belong together 1.Schema Evolution Tests.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Copyright 2001 Oxford Consulting, Ltd1 January Storage Classes, Scope and Linkage Overview Focus is on the structure of a C++ program with –Multiple.
COMPILERS Semantic Analysis hussein suleman uct csc3005h 2006.
CINT & Reflex: New Reflection Data Structures Masa(haru) Goto Agilent Philippe Canal Fermilab/CD Stefan Roiser, Axel Naumann PH/SFT.
Effective Java: Generics Last Updated: Spring 2009.
CSC204 – Programming I Lecture 4 August 28, 2002.
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
1 ENERGY 211 / CME 211 Lecture 26 November 19, 2008.
Axel Naumann University of Nijmegen / NIKHEF, NL ROOT 2004 Users Workshop The Future of THtml Plans and Status of ROOT’s documentation facility.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 15: More-Advanced Concepts.
23-Oct-15 Abstract Data Types. 2 Data types A data type is characterized by: a set of values a data representation, which is common to all these values,
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Axel Naumann. Outline  Static Code Analysis  Coverity  Reporting Tools, Report Quality  "Demo": Examples Axel Naumann Application Area Meeting2.
Topic 2d High-Level languages and Systems Software
Chapter 4 Memory Management Virtual Memory.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
C Functions Three major differences between C and Java functions: –Functions are stand-alone entities, not part of objects they can be defined in a file.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
THtml  THtml will generate >=1 doc.root file .html pages generated from doc.root files by April (Feb doesn't exist)  Bertrand: extract doc for online.
CSE 332: C++ template examples Concepts and Models Templates impose requirements on type parameters –Types that are plugged in must meet those requirements.
Getting rid of the “G__” thingies ROOT Team Meeting CERN Diego Marcos && Leandro Franco.
Lecture 10: Modular Programming (functions) B Burlingame 13 April 2015.
Slides created by: Professor Ian G. Harris Hello World #include main() { printf(“Hello, world.\n”); }  #include is a compiler directive to include (concatenate)
CSE 332: Design Patterns Review: Design Pattern Structure A design pattern has a name –So when someone says “Adapter” you know what they mean –So you can.
Design Patterns SE464 Derek Rayside images from NetObjectives.com & Wikipedia.
9/12/99R. Moore1 Level 2 Trigger Software Interface R. Moore, Michigan State University.
Functions Illustration of: Pass by value, reference Scope Allocation Reference: See your CS115/215 textbook.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
THtml rev 2.0 Status and Plans of ROOT’s documentation facility Axel Naumann / Fermilab.
EEL 3801 C++ as an Enhancement of C. EEL 3801 – Lotzi Bölöni Comments  Can be done with // at the start of the commented line.  The end-of-line terminates.
D. Duellmann - IT/DB LCG - POOL Project1 The LCG Dictionary and POOL Dirk Duellmann.
CINT & Reflex – The Future CINT’s Future Layout Reflex API Work In Progress: Use Reflex to store dictionary data Smaller memory footprint First step to.
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Axel Naumann. Nada FTE  LLVM + cling would take 4 years  when done, move to next hot-spot in ROOT Axel Naumann ROOT Team Meeting2.
CINT/Reflex workshop 1 Rene Brun 4 May 2005 Summary of the CINT/Reflex workshop 2-6 May 2005
2001 ROOT Workshop The Summary. Content Most Requested Request already satisfied Build and Distribution Web Page Information and Documentation.
Pyragen A PYTHON WRAPPER GENERATOR TO APPLICATION CORE LIBRARIES Fernando PEREIRA, Christian THEIS - HSE/RP EDMS tech note:
Lecture 1 Page 1 CS 111 Summer 2013 Important OS Properties For real operating systems built and used by real people Differs depending on who you are talking.
ACAT 2008 Axel Naumann (CERN), Philippe Canal (Fermilab) The Role of Interpreters in High Performance Computing.
POOL Based CMS Framework Bill Tanenbaum US-CMS/Fermilab 04/June/2003.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Embedded Real-Time Systems
ROOT / Reflex ‘07+ Stefan Roiser Missed last team meeting b/c.
Stefan Roiser CERN / PH / SFT
Dictionary generation for the Experiments
Operating Systems (CS 340 D)
Review: Two Programming Paradigms
Geant4 Geometry Objects Persistency using ROOT
Operator overloading Conversions friend inline
Introduction to C Programming Language
The HP OpenVMS Itanium® Calling Standard
Lecture Topics: 11/1 General Operating System Concepts Processes
SPL – PS1 Introduction to C++.
Presentation transcript:

ROOT Team Meeting Axel Naumann CERN PH/SFT Crienftlex Extended Version. And also Director’s Cut. Crienftlex

ROOT 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!

ROOT 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

ROOT 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

ROOT 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?

ROOT 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];

ROOT 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];

ROOT 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];

ROOT 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?

ROOT 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

ROOT 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);

ROOT 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

ROOT 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.

ROOT 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

ROOT 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.

ROOT 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++

ROOT 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…

ROOT 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

ROOT 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

ROOT 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;};

ROOT 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

ROOT 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)

ROOT 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.

ROOT 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!

ROOT 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!

ROOT 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”)

ROOT 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

ROOT 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

ROOT 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

ROOT 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