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 #58

Closed
2 changes: 1 addition & 1 deletion core/meta/inc/TDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class TDictionary : public TNamed {
ULong64_t fUpdatingTransactionCount; //the Cling ID of the transaction that last updated the object

protected:
Bool_t InterpreterStateHasChanged();
Bool_t UpdateInterpreterStateMarker();

public:
TDictionary(): fAttributeMap(0), fUpdatingTransactionCount(0) { }
Expand Down
19 changes: 12 additions & 7 deletions core/meta/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ extern "C"
void TCling__UpdateListsOnCommitted(const cling::Transaction &T,
cling::Interpreter* interp) {

((TCling*)gCling)->UpdateListsOnCommitted(T, interp);
((TCling*)gCling)->UpdateListsOnCommitted(T);
}

extern "C"
Expand Down Expand Up @@ -1937,16 +1937,21 @@ void TCling::SetGetline(const char * (*getlineFunc)(const char* prompt),
}

//______________________________________________________________________________
void TCling::HandleNewTransaction(const cling::Transaction &T)
Bool_t TCling::HandleNewTransaction(const cling::Transaction &T)
{
// Helper function to increase the internal Cling count of transactions
// that change the AST.

R__LOCKGUARD(gInterpreterMutex);

if ((std::distance(T.decls_begin(), T.decls_end()) != 1)
|| T.deserialized_decls_begin() != T.deserialized_decls_end()
|| T.macros_begin() != T.macros_end()
|| ((!T.getFirstDecl().isNull()) && ((*T.getFirstDecl().begin()) != T.getWrapperFD()))) {
fTransactionCount++;
return true;
}
return false;
}

//______________________________________________________________________________
Expand Down Expand Up @@ -4366,12 +4371,12 @@ void TCling::UpdateAllCanvases()
}

//______________________________________________________________________________
void TCling::UpdateListsOnCommitted(const cling::Transaction &T,
cling::Interpreter* interp) {
void TCling::UpdateListsOnCommitted(const cling::Transaction &T) {

std::set<TClass*> modifiedTClasses; // TClasses that require update after this transaction

HandleNewTransaction(T);
// If the transaction does not contain anything we can return earlier.
if (!HandleNewTransaction(T)) return;

bool isTUTransaction = false;
if (T.decls_end()-T.decls_begin() == 1 && !T.hasNestedTransactions()) {
Expand All @@ -4388,7 +4393,7 @@ void TCling::UpdateListsOnCommitted(const cling::Transaction &T,
// TInterpreterLookupCollection, one that reimplements
// TCollection::FindObject(name) and performs a lookup
// if not found in its T(Hash)List.
cling::Interpreter::PushTransactionRAII RAII(interp);
cling::Interpreter::PushTransactionRAII RAII(fInterpreter);
for (clang::DeclContext::decl_iterator TUI = TU->decls_begin(),
TUE = TU->decls_end(); TUI != TUE; ++TUI)
((TCling*)gCling)->HandleNewDecl(*TUI, (*TUI)->isFromASTFile(),modifiedTClasses);
Expand Down Expand Up @@ -4453,7 +4458,7 @@ void TCling::UpdateListsOnCommitted(const cling::Transaction &T,
continue;
}
// Could trigger deserialization of decls.
cling::Interpreter::PushTransactionRAII RAII(interp);
cling::Interpreter::PushTransactionRAII RAII(fInterpreter);
// Unlock the TClass for updates
((TCling*)gCling)->GetModTClasses().erase(*I);

Expand Down
7 changes: 4 additions & 3 deletions core/meta/src/TCling.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class TCling : public TInterpreter {
TObjArray* GetRootMapFiles() const { return fRootmapFiles; }
Bool_t HasDictionary(TClass* cl);
void GetMissingDictionaries(TClass* cl, TObjArray& result, bool recurse);
unsigned long long GetInterpreterStateMarker() const { return fTransactionCount;}
ULong64_t GetInterpreterStateMarker() const { return fTransactionCount;}

virtual void Initialize();
void InspectMembers(TMemberInspector&, const void* obj, const TClass* cl, Bool_t isTransient);
Bool_t IsLoaded(const char* filename) const;
Expand Down Expand Up @@ -473,7 +474,7 @@ class TCling : public TInterpreter {
std::set<TClass*>& GetModTClasses() { return fModTClasses; }

void HandleNewDecl(const void* DV, bool isDeserialized, std::set<TClass*>& modifiedClasses);
void UpdateListsOnCommitted(const cling::Transaction &T, cling::Interpreter* interp);
void UpdateListsOnCommitted(const cling::Transaction &T);
void UpdateListsOnUnloaded(const cling::Transaction &T);

private: // Private Utility Functions
Expand All @@ -495,7 +496,7 @@ class TCling : public TInterpreter {
bool InsertMissingDictionaryDecl(const clang::Decl* D, std::set<std::string> &netD, clang::QualType qType, bool recurse);
void InitRootmapFile(const char *name);
int ReadRootmapFile(const char *rootmapfile);
void HandleNewTransaction(const cling::Transaction &T);
Bool_t HandleNewTransaction(const cling::Transaction &T);

};

Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TDataMember.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ Bool_t TDataMember::IsValid()
// is created, the TDataMember will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
DeclId_t newId = gInterpreter->GetDataMember(0, fName);
if (newId) {
DataMemberInfo_t *info = gInterpreter->DataMemberInfo_Factory(newId, 0);
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TDictionary.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TDictionary* TDictionary::GetDictionary(const type_info &typeinfo)
return TClass::GetClass(typeinfo, true);
}

Bool_t TDictionary::InterpreterStateHasChanged()
Bool_t TDictionary::UpdateInterpreterStateMarker()
{
// Return true if there were any transactions that could have changed the
// state of the object.
Expand Down
5 changes: 2 additions & 3 deletions core/meta/src/TEnum.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Bool_t TEnum::IsValid()
// is created, the TEnum will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
DeclId_t newId = gInterpreter->GetEnum(fClass, fName);
if (newId) {
Update(newId);
Expand All @@ -74,8 +74,7 @@ Long_t TEnum::Property() const
{
// Get property description word. For meaning of bits see EProperty.

Long_t property = 0L;
return property |= kIsEnum;
return kIsEnum;
}

//______________________________________________________________________________
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TFunction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Bool_t TFunction::IsValid()
// is created, the TFunction will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
// Only for global functions. For data member functions TMethod does it.
DeclId_t newId = gInterpreter->GetFunction(0, fName);
if (newId) {
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TFunctionTemplate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Bool_t TFunctionTemplate::IsValid()
// is created, the TFunction will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
// Only for global functions. For data member functions TMethod does it.
DeclId_t newId = gInterpreter->GetFunction(0, fName);
if (newId) {
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TGlobal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Bool_t TGlobal::IsValid()
// is created, the TGlobal will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
DeclId_t newId = gInterpreter->GetDataMember(0, fName);
if (newId) {
DataMemberInfo_t *info = gInterpreter->DataMemberInfo_Factory(newId, 0);
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TMethod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ Bool_t TMethod::IsValid()
// is created, the TMethod will be set to be invalid.

// Register the transaction when checking the validity of the object.
if (!fInfo && InterpreterStateHasChanged()) {
if (!fInfo && UpdateInterpreterStateMarker()) {
DeclId_t newId = gInterpreter->GetFunction(fClass->GetClassInfo(), fName);
if (newId) {
MethodInfo_t *info = gInterpreter->MethodInfo_Factory(newId);
Expand Down