[llvm] r334909 - [ORC] In MaterializationResponsibility, only maintain the Materializing flag on
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 17 09:59:52 PDT 2018
Author: lhames
Date: Sun Jun 17 09:59:52 2018
New Revision: 334909
URL: http://llvm.org/viewvc/llvm-project?rev=334909&view=rev
Log:
[ORC] In MaterializationResponsibility, only maintain the Materializing flag on
symbols in debug mode.
The MaterializationResponsibility class hijacks the Materializing flag to track
symbols that have not yet been resolved in order to guard against redundant
resolution. Since this is an API contract check and only enforced in debug mode
there is no reason to maintain the flag state in release mode.
Modified:
llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=334909&r1=334908&r2=334909&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Sun Jun 17 09:59:52 2018
@@ -228,8 +228,10 @@ MaterializationResponsibility::Materiali
: V(V), SymbolFlags(std::move(SymbolFlags)) {
assert(!this->SymbolFlags.empty() && "Materializing nothing?");
+#ifndef NDEBUG
for (auto &KV : this->SymbolFlags)
KV.second |= JITSymbolFlags::Materializing;
+#endif
}
MaterializationResponsibility::~MaterializationResponsibility() {
@@ -242,15 +244,21 @@ SymbolNameSet MaterializationResponsibil
}
void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
+#ifndef NDEBUG
for (auto &KV : Symbols) {
auto I = SymbolFlags.find(KV.first);
assert(I != SymbolFlags.end() &&
"Resolving symbol outside this responsibility set");
assert(I->second.isMaterializing() && "Duplicate resolution");
I->second &= ~JITSymbolFlags::Materializing;
- assert(KV.second.getFlags() == I->second &&
- "Resolving symbol with incorrect flags");
+ if (I->second.isWeak())
+ assert(I->second == (KV.second.getFlags() | JITSymbolFlags::Weak) &&
+ "Resolving symbol with incorrect flags");
+ else
+ assert(I->second == KV.second.getFlags() &&
+ "Resolving symbol with incorrect flags");
}
+#endif
V.resolve(Symbols);
}
@@ -274,7 +282,9 @@ Error MaterializationResponsibility::def
// symbol error.
for (auto &KV : NewSymbolFlags) {
auto I = SymbolFlags.insert(KV).first;
+#ifndef NDEBUG
I->second |= JITSymbolFlags::Materializing;
+#endif
}
return V.defineMaterializing(NewSymbolFlags);
More information about the llvm-commits
mailing list