diff options
author | Lang Hames <lhames@gmail.com> | 2018-06-17 16:59:52 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2018-06-17 16:59:52 +0000 |
commit | 11adecfb2ca7f97551aaa0df32507bf7c432ba18 (patch) | |
tree | d46244bbc5deec810c1ed1fbe7775e97055d74bd | |
parent | b0e986f88e4db23f1e2613b9e80e496e689596d7 (diff) | |
download | bcm5719-llvm-11adecfb2ca7f97551aaa0df32507bf7c432ba18.tar.gz bcm5719-llvm-11adecfb2ca7f97551aaa0df32507bf7c432ba18.zip |
[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.
llvm-svn: 334909
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/Core.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 894e210da13..96baf624caa 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -228,8 +228,10 @@ MaterializationResponsibility::MaterializationResponsibility( : 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 MaterializationResponsibility::getRequestedSymbols() { } 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::defineMaterializing( // symbol error. for (auto &KV : NewSymbolFlags) { auto I = SymbolFlags.insert(KV).first; +#ifndef NDEBUG I->second |= JITSymbolFlags::Materializing; +#endif } return V.defineMaterializing(NewSymbolFlags); |