Skip to content

Commit

Permalink
[ORC] Work around AIX build compiler: Replace lambda; NFC
Browse files Browse the repository at this point in the history
By replacing a lambda expression with a functor class instance, this
patch works around an issue encountered on AIX where the IBM XL compiler
appears to make no progress for many hours.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D106554
  • Loading branch information
hubert-reinterpretcast committed Jul 23, 2021
1 parent f060aa1 commit af5602d
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,19 +446,30 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
return;
}

// Use functor class to work around XL build compiler issue on AIX.
class RtLookupNotifyComplete {
public:
RtLookupNotifyComplete(SendSymbolAddressFn &&SendResult)
: SendResult(std::move(SendResult)) {}
void operator()(Expected<SymbolMap> Result) {
if (Result) {
assert(Result->size() == 1 && "Unexpected result map count");
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
} else {
SendResult(Result.takeError());
}
}

private:
SendSymbolAddressFn SendResult;
};

// FIXME: Proper mangling.
auto MangledName = ("_" + SymbolName).str();
ES.lookup(
LookupKind::DLSym, {{JD, JITDylibLookupFlags::MatchExportedSymbolsOnly}},
SymbolLookupSet(ES.intern(MangledName)), SymbolState::Ready,
[SendResult = std::move(SendResult)](Expected<SymbolMap> Result) mutable {
if (Result) {
assert(Result->size() == 1 && "Unexpected result map count");
SendResult(ExecutorAddress(Result->begin()->second.getAddress()));
} else
SendResult(Result.takeError());
},
NoDependenciesToRegister);
RtLookupNotifyComplete(std::move(SendResult)), NoDependenciesToRegister);
}

Error MachOPlatform::bootstrapMachORuntime(JITDylib &PlatformJD) {
Expand Down

0 comments on commit af5602d

Please sign in to comment.