From 9178f27bfa606d58bb2fd827a3f4ed655e93518a Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Thu, 13 Aug 2020 20:13:00 +0000 Subject: [PATCH] [gmi] Do not load all modules for a given identifier. This should reduce the amount of modules we load for namespace lookups at the cost of being more fragile. Improves the memory of hsimple.c from 145864 to 118696 and skips loading of 15 redundant modules. --- core/metacling/src/TClingCallbacks.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/metacling/src/TClingCallbacks.cxx b/core/metacling/src/TClingCallbacks.cxx index 6ef3e8b98a430..87095c1c84e9a 100644 --- a/core/metacling/src/TClingCallbacks.cxx +++ b/core/metacling/src/TClingCallbacks.cxx @@ -328,6 +328,8 @@ bool TClingCallbacks::findInGlobalModuleIndex(DeclarationName Name, bool loadFir if (gDebug > 2) llvm::errs() << "Module '" << ModuleName << "' already loaded" << " for '" << Name.getAsString() << "'\n"; + if (loadFirstMatchOnly) + break; continue; } @@ -359,7 +361,7 @@ bool TClingCallbacks::LookupObject(const DeclContext* DC, DeclarationName Name) if (fIsAutoParsingSuspended || fIsAutoLoadingRecursively) return false; - if (findInGlobalModuleIndex(Name, /*loadFirstMatchOnly*/ false)) + if (findInGlobalModuleIndex(Name, /*loadFirstMatchOnly*/ true)) return true; if (Name.getNameKind() != DeclarationName::Identifier)