Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unloading AST optimization + change base class of TEnum from TNamed to TDictionary #57

Closed
Closed
8 changes: 6 additions & 2 deletions core/meta/inc/TDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ class TDictionary : public TNamed {

private:
TDictAttributeMap *fAttributeMap; //pointer to a class attribute map
ULong64_t fUpdatingTransactionCount; //the Cling ID of the transaction that last updated the object

protected:
Bool_t TransactionCountUpdate();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a more generic name. HasInterpreterUpdate or MightNeedUpdate or InterpreterStateHasChanged or .... something better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do :)


public:
TDictionary(): fAttributeMap(0) { }
TDictionary(const char* name): TNamed(name, ""), fAttributeMap(0) { }
TDictionary(): fAttributeMap(0), fUpdatingTransactionCount(0) { }
TDictionary(const char* name): TNamed(name, ""), fAttributeMap(0), fUpdatingTransactionCount(0) { }
TDictionary(const TDictionary& dict);
virtual ~TDictionary();

Expand Down
5 changes: 2 additions & 3 deletions core/meta/inc/TEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
class TClass;
class TEnumConstant;

class TEnum : public TNamed {

typedef TDictionary::DeclId_t DeclId_t;
class TEnum : public TDictionary {

private:
THashList fConstantList; //list of constants the enum type
Expand All @@ -61,6 +59,7 @@ typedef TDictionary::DeclId_t DeclId_t;
}
DeclId_t GetDeclId() const { return (DeclId_t)fInfo; }
Bool_t IsValid();
Long_t Property() const;
void Update(DeclId_t id);

ClassDef(TEnum,2) //Enum type class
Expand Down
8 changes: 8 additions & 0 deletions core/meta/inc/TInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class TObjArray;
class TVirtualMutex;
class TEnum;

namespace cling {
class Interpreter;
class Transaction;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TInterpreter must stay agnostics to the implementation chosen and thus it must not know about cling.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, corrected.

R__EXTERN TVirtualMutex *gInterpreterMutex;

class TInterpreter : public TNamed {
Expand Down Expand Up @@ -212,6 +217,9 @@ class TInterpreter : public TNamed {

// core/meta helper functions.
virtual TMethodCall::EReturnType MethodCallReturnType(TFunction *func) const = 0;
virtual ULong64_t GetTransactionCount() const = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to be too specific on the underlying semantic of the number. I.e. maybe GetInterpreterStateMarker (or some better name :) )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do

virtual void UpdateListsOnCommitted(const cling::Transaction &T, cling::Interpreter* interp) = 0;
virtual void UpdateListsOnUnloaded(const cling::Transaction &T) = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need those exposed in the abstract interface? Could the usage be limited to inside TCling.cxx? (I.e. what other routines know about transactions?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I would want to do that, but how? Because TCling__UpdateListsOnUnloaded/TCling__UpdateListsOnCommited are extern functions and they need to update the TCling fTransactionCOunt(or how we name it) and call the TCling::HandleNewTransaction. I could expose andleNewTransaction, but then it still requires the cling::Transaction...Any idea is very welcomed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In TCling_* you can assume that the type of gCling is TCling (we already do that in many places ... see ((TCling*)gCling)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that before but I got the cast wrong: (TCling_)gCling->. Now with ((TCling_)gCling) it works. Sorry about the noise


typedef TDictionary::DeclId_t DeclId_t;
virtual DeclId_t GetDeclId(CallFunc_t *info) const = 0;
Expand Down
Loading