Skip to content

Commit 5ae500c

Browse files
committed
revert fmt
1 parent 9e26f2f commit 5ae500c

File tree

4 files changed

+93
-112
lines changed

4 files changed

+93
-112
lines changed

llvm/include/llvm/ExecutionEngine/Orc/Core.h

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,10 @@ class SymbolLookupSet {
308308
/// If Body returns true then the element just passed in is removed from the
309309
/// set. If Body returns false then the element is retained.
310310
template <typename BodyFn>
311-
auto forEachWithRemoval(BodyFn &&Body)
312-
-> std::enable_if_t<
313-
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
314-
std::declval<SymbolLookupFlags>())),
315-
bool>::value> {
311+
auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t<
312+
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
313+
std::declval<SymbolLookupFlags>())),
314+
bool>::value> {
316315
UnderlyingVector::size_type I = 0;
317316
while (I != Symbols.size()) {
318317
const auto &Name = Symbols[I].first;
@@ -331,12 +330,11 @@ class SymbolLookupSet {
331330
/// returns true then the element just passed in is removed from the set. If
332331
/// Body returns false then the element is retained.
333332
template <typename BodyFn>
334-
auto forEachWithRemoval(BodyFn &&Body)
335-
-> std::enable_if_t<
336-
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
337-
std::declval<SymbolLookupFlags>())),
338-
Expected<bool>>::value,
339-
Error> {
333+
auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t<
334+
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
335+
std::declval<SymbolLookupFlags>())),
336+
Expected<bool>>::value,
337+
Error> {
340338
UnderlyingVector::size_type I = 0;
341339
while (I != Symbols.size()) {
342340
const auto &Name = Symbols[I].first;
@@ -527,7 +525,6 @@ class MissingSymbolDefinitions : public ErrorInfo<MissingSymbolDefinitions> {
527525
std::shared_ptr<SymbolStringPool> getSymbolStringPool() { return SSP; }
528526
const std::string &getModuleName() const { return ModuleName; }
529527
const SymbolNameVector &getSymbols() const { return Symbols; }
530-
531528
private:
532529
std::shared_ptr<SymbolStringPool> SSP;
533530
std::string ModuleName;
@@ -538,8 +535,7 @@ class MissingSymbolDefinitions : public ErrorInfo<MissingSymbolDefinitions> {
538535
/// symbols that are not claimed by the module's associated
539536
/// MaterializationResponsibility. If this error is returned it is indicative of
540537
/// a broken transformation / compiler / object cache.
541-
class UnexpectedSymbolDefinitions
542-
: public ErrorInfo<UnexpectedSymbolDefinitions> {
538+
class UnexpectedSymbolDefinitions : public ErrorInfo<UnexpectedSymbolDefinitions> {
543539
public:
544540
static char ID;
545541

@@ -552,7 +548,6 @@ class UnexpectedSymbolDefinitions
552548
std::shared_ptr<SymbolStringPool> getSymbolStringPool() { return SSP; }
553549
const std::string &getModuleName() const { return ModuleName; }
554550
const SymbolNameVector &getSymbols() const { return Symbols; }
555-
556551
private:
557552
std::shared_ptr<SymbolStringPool> SSP;
558553
std::string ModuleName;
@@ -809,6 +804,7 @@ class AsynchronousSymbolQuery {
809804
/// resolved.
810805
bool isComplete() const { return OutstandingSymbolsCount == 0; }
811806

807+
812808
private:
813809
void handleComplete(ExecutionSession &ES);
814810

@@ -907,8 +903,8 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
907903
friend class ExecutionSession;
908904
friend class Platform;
909905
friend class MaterializationResponsibility;
910-
911906
public:
907+
912908
JITDylib(const JITDylib &) = delete;
913909
JITDylib &operator=(const JITDylib &) = delete;
914910
JITDylib(JITDylib &&) = delete;
@@ -1112,7 +1108,7 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
11121108

11131109
private:
11141110
using AsynchronousSymbolQuerySet =
1115-
std::set<std::shared_ptr<AsynchronousSymbolQuery>>;
1111+
std::set<std::shared_ptr<AsynchronousSymbolQuery>>;
11161112

11171113
using AsynchronousSymbolQueryList =
11181114
std::vector<std::shared_ptr<AsynchronousSymbolQuery>>;
@@ -1168,7 +1164,6 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
11681164
const AsynchronousSymbolQueryList &pendingQueries() const {
11691165
return PendingQueries;
11701166
}
1171-
11721167
private:
11731168
AsynchronousSymbolQueryList PendingQueries;
11741169
};
@@ -1364,13 +1359,13 @@ class ExecutionSession {
13641359
using ErrorReporter = unique_function<void(Error)>;
13651360

13661361
/// Send a result to the remote.
1367-
using SendResultFunction =
1368-
unique_function<void(shared::WrapperFunctionResult)>;
1362+
using SendResultFunction = unique_function<void(shared::WrapperFunctionResult)>;
13691363

13701364
/// An asynchronous wrapper-function callable from the executor via
13711365
/// jit-dispatch.
13721366
using JITDispatchHandlerFunction = unique_function<void(
1373-
SendResultFunction SendResult, const char *ArgData, size_t ArgSize)>;
1367+
SendResultFunction SendResult,
1368+
const char *ArgData, size_t ArgSize)>;
13741369

13751370
/// A map associating tag names with asynchronous wrapper function
13761371
/// implementations in the JIT.
@@ -1598,7 +1593,8 @@ class ExecutionSession {
15981593
/// \endcode{.cpp}
15991594
///
16001595
/// The given OnComplete function will be called to return the result.
1601-
template <typename... ArgTs> void callWrapperAsync(ArgTs &&...Args) {
1596+
template <typename... ArgTs>
1597+
void callWrapperAsync(ArgTs &&... Args) {
16021598
EPC->callWrapperAsync(std::forward<ArgTs>(Args)...);
16031599
}
16041600

@@ -1643,9 +1639,9 @@ class ExecutionSession {
16431639
/// (using registerJITDispatchHandler) and called from the executor.
16441640
template <typename SPSSignature, typename HandlerT>
16451641
static JITDispatchHandlerFunction wrapAsyncWithSPS(HandlerT &&H) {
1646-
return [H = std::forward<HandlerT>(H)](SendResultFunction SendResult,
1647-
const char *ArgData,
1648-
size_t ArgSize) mutable {
1642+
return [H = std::forward<HandlerT>(H)](
1643+
SendResultFunction SendResult,
1644+
const char *ArgData, size_t ArgSize) mutable {
16491645
shared::WrapperFunction<SPSSignature>::handleAsync(ArgData, ArgSize, H,
16501646
std::move(SendResult));
16511647
};
@@ -1750,8 +1746,8 @@ class ExecutionSession {
17501746
unique_function<void(Expected<SymbolFlagsMap>)> OnComplete);
17511747

17521748
// State machine functions for MaterializationResponsibility.
1753-
void
1754-
OL_destroyMaterializationResponsibility(MaterializationResponsibility &MR);
1749+
void OL_destroyMaterializationResponsibility(
1750+
MaterializationResponsibility &MR);
17551751
SymbolNameSet OL_getRequestedSymbols(const MaterializationResponsibility &MR);
17561752
Error OL_notifyResolved(MaterializationResponsibility &MR,
17571753
const SymbolMap &Symbols);
@@ -1973,13 +1969,12 @@ inline MaterializationResponsibility::~MaterializationResponsibility() {
19731969
getExecutionSession().OL_destroyMaterializationResponsibility(*this);
19741970
}
19751971

1976-
inline SymbolNameSet
1977-
MaterializationResponsibility::getRequestedSymbols() const {
1972+
inline SymbolNameSet MaterializationResponsibility::getRequestedSymbols() const {
19781973
return getExecutionSession().OL_getRequestedSymbols(*this);
19791974
}
19801975

1981-
inline Error
1982-
MaterializationResponsibility::notifyResolved(const SymbolMap &Symbols) {
1976+
inline Error MaterializationResponsibility::notifyResolved(
1977+
const SymbolMap &Symbols) {
19831978
return getExecutionSession().OL_notifyResolved(*this, Symbols);
19841979
}
19851980

@@ -1988,8 +1983,8 @@ inline Error MaterializationResponsibility::notifyEmitted(
19881983
return getExecutionSession().OL_notifyEmitted(*this, EmittedDeps);
19891984
}
19901985

1991-
inline Error
1992-
MaterializationResponsibility::defineMaterializing(SymbolFlagsMap SymbolFlags) {
1986+
inline Error MaterializationResponsibility::defineMaterializing(
1987+
SymbolFlagsMap SymbolFlags) {
19931988
return getExecutionSession().OL_defineMaterializing(*this,
19941989
std::move(SymbolFlags));
19951990
}

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 58 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "llvm/Config/llvm-config.h"
1313
#include "llvm/ExecutionEngine/Orc/DebugUtils.h"
1414
#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h"
15-
#include "llvm/Support/Debug.h"
1615
#include "llvm/Support/FormatVariadic.h"
1716
#include "llvm/Support/MSVCErrorWorkarounds.h"
1817
#include "llvm/Support/raw_ostream.h"
@@ -166,15 +165,17 @@ std::error_code MissingSymbolDefinitions::convertToErrorCode() const {
166165
}
167166

168167
void MissingSymbolDefinitions::log(raw_ostream &OS) const {
169-
OS << "Missing definitions in module " << ModuleName << ": " << Symbols;
168+
OS << "Missing definitions in module " << ModuleName
169+
<< ": " << Symbols;
170170
}
171171

172172
std::error_code UnexpectedSymbolDefinitions::convertToErrorCode() const {
173173
return orcError(OrcErrorCode::UnexpectedSymbolDefinitions);
174174
}
175175

176176
void UnexpectedSymbolDefinitions::log(raw_ostream &OS) const {
177-
OS << "Unexpected definitions in module " << ModuleName << ": " << Symbols;
177+
OS << "Unexpected definitions in module " << ModuleName
178+
<< ": " << Symbols;
178179
}
179180

180181
void SymbolInstance::lookupAsync(LookupAsyncOnCompleteFn OnComplete) const {
@@ -739,7 +740,7 @@ JITDylib::defineMaterializing(MaterializationResponsibility &FromMR,
739740
continue;
740741
} else
741742
EntryItr =
742-
Symbols.insert(std::make_pair(Name, SymbolTableEntry(Flags))).first;
743+
Symbols.insert(std::make_pair(Name, SymbolTableEntry(Flags))).first;
743744

744745
AddedSyms.push_back(NonOwningSymbolStringPtr(Name));
745746
EntryItr->second.setState(SymbolState::Materializing);
@@ -761,62 +762,63 @@ Error JITDylib::replace(MaterializationResponsibility &FromMR,
761762
std::unique_ptr<MaterializationUnit> MustRunMU;
762763
std::unique_ptr<MaterializationResponsibility> MustRunMR;
763764

764-
auto Err = ES.runSessionLocked([&, this]() -> Error {
765-
if (FromMR.RT->isDefunct())
766-
return make_error<ResourceTrackerDefunct>(std::move(FromMR.RT));
765+
auto Err =
766+
ES.runSessionLocked([&, this]() -> Error {
767+
if (FromMR.RT->isDefunct())
768+
return make_error<ResourceTrackerDefunct>(std::move(FromMR.RT));
767769

768770
#ifndef NDEBUG
769-
for (auto &KV : MU->getSymbols()) {
770-
auto SymI = Symbols.find(KV.first);
771-
assert(SymI != Symbols.end() && "Replacing unknown symbol");
772-
assert(SymI->second.getState() == SymbolState::Materializing &&
773-
"Can not replace a symbol that ha is not materializing");
774-
assert(!SymI->second.hasMaterializerAttached() &&
775-
"Symbol should not have materializer attached already");
776-
assert(UnmaterializedInfos.count(KV.first) == 0 &&
777-
"Symbol being replaced should have no UnmaterializedInfo");
778-
}
771+
for (auto &KV : MU->getSymbols()) {
772+
auto SymI = Symbols.find(KV.first);
773+
assert(SymI != Symbols.end() && "Replacing unknown symbol");
774+
assert(SymI->second.getState() == SymbolState::Materializing &&
775+
"Can not replace a symbol that ha is not materializing");
776+
assert(!SymI->second.hasMaterializerAttached() &&
777+
"Symbol should not have materializer attached already");
778+
assert(UnmaterializedInfos.count(KV.first) == 0 &&
779+
"Symbol being replaced should have no UnmaterializedInfo");
780+
}
779781
#endif // NDEBUG
780782

781-
// If the tracker is defunct we need to bail out immediately.
782-
783-
// If any symbol has pending queries against it then we need to
784-
// materialize MU immediately.
785-
for (auto &KV : MU->getSymbols()) {
786-
auto MII = MaterializingInfos.find(KV.first);
787-
if (MII != MaterializingInfos.end()) {
788-
if (MII->second.hasQueriesPending()) {
789-
MustRunMR = ES.createMaterializationResponsibility(
790-
*FromMR.RT, std::move(MU->SymbolFlags),
791-
std::move(MU->InitSymbol));
792-
MustRunMU = std::move(MU);
793-
return Error::success();
783+
// If the tracker is defunct we need to bail out immediately.
784+
785+
// If any symbol has pending queries against it then we need to
786+
// materialize MU immediately.
787+
for (auto &KV : MU->getSymbols()) {
788+
auto MII = MaterializingInfos.find(KV.first);
789+
if (MII != MaterializingInfos.end()) {
790+
if (MII->second.hasQueriesPending()) {
791+
MustRunMR = ES.createMaterializationResponsibility(
792+
*FromMR.RT, std::move(MU->SymbolFlags),
793+
std::move(MU->InitSymbol));
794+
MustRunMU = std::move(MU);
795+
return Error::success();
796+
}
797+
}
794798
}
795-
}
796-
}
797799

798-
// Otherwise, make MU responsible for all the symbols.
799-
auto UMI =
800-
std::make_shared<UnmaterializedInfo>(std::move(MU), FromMR.RT.get());
801-
for (auto &KV : UMI->MU->getSymbols()) {
802-
auto SymI = Symbols.find(KV.first);
803-
assert(SymI->second.getState() == SymbolState::Materializing &&
804-
"Can not replace a symbol that is not materializing");
805-
assert(!SymI->second.hasMaterializerAttached() &&
806-
"Can not replace a symbol that has a materializer attached");
807-
assert(UnmaterializedInfos.count(KV.first) == 0 &&
808-
"Unexpected materializer entry in map");
809-
SymI->second.setAddress(SymI->second.getAddress());
810-
SymI->second.setMaterializerAttached(true);
811-
812-
auto &UMIEntry = UnmaterializedInfos[KV.first];
813-
assert((!UMIEntry || !UMIEntry->MU) &&
814-
"Replacing symbol with materializer still attached");
815-
UMIEntry = UMI;
816-
}
800+
// Otherwise, make MU responsible for all the symbols.
801+
auto UMI = std::make_shared<UnmaterializedInfo>(std::move(MU),
802+
FromMR.RT.get());
803+
for (auto &KV : UMI->MU->getSymbols()) {
804+
auto SymI = Symbols.find(KV.first);
805+
assert(SymI->second.getState() == SymbolState::Materializing &&
806+
"Can not replace a symbol that is not materializing");
807+
assert(!SymI->second.hasMaterializerAttached() &&
808+
"Can not replace a symbol that has a materializer attached");
809+
assert(UnmaterializedInfos.count(KV.first) == 0 &&
810+
"Unexpected materializer entry in map");
811+
SymI->second.setAddress(SymI->second.getAddress());
812+
SymI->second.setMaterializerAttached(true);
813+
814+
auto &UMIEntry = UnmaterializedInfos[KV.first];
815+
assert((!UMIEntry || !UMIEntry->MU) &&
816+
"Replacing symbol with materializer still attached");
817+
UMIEntry = UMI;
818+
}
817819

818-
return Error::success();
819-
});
820+
return Error::success();
821+
});
820822

821823
if (Err)
822824
return Err;
@@ -920,12 +922,9 @@ Error JITDylib::resolve(MaterializationResponsibility &MR,
920922
(SymI->second.getFlags() & ~JITSymbolFlags::Common) &&
921923
"Resolving symbol with incorrect flags");
922924

923-
} else {
924-
/*
925+
} else
925926
assert(KV.second.getFlags() == SymI->second.getFlags() &&
926927
"Resolved flags should match the declared flags");
927-
*/
928-
}
929928

930929
Worklist.push_back(
931930
{SymI, {KV.second.getAddress(), SymI->second.getFlags()}});
@@ -2056,8 +2055,7 @@ bool ExecutionSession::verifySessionState(Twine Phase) {
20562055
// Pending queries should be for subsequent states.
20572056
auto CurState = static_cast<SymbolState>(
20582057
static_cast<std::underlying_type_t<SymbolState>>(
2059-
SymItr->second.getState()) +
2060-
1);
2058+
SymItr->second.getState()) + 1);
20612059
for (auto &Q : MII.PendingQueries) {
20622060
if (Q->getRequiredState() != CurState) {
20632061
if (Q->getRequiredState() > CurState)
@@ -2901,14 +2899,6 @@ Error ExecutionSession::OL_notifyResolved(MaterializationResponsibility &MR,
29012899
#ifndef NDEBUG
29022900
for (auto &KV : Symbols) {
29032901
auto I = MR.SymbolFlags.find(KV.first);
2904-
2905-
LLVM_DEBUG(dbgs() << " Flags for " << KV.first << ": "
2906-
<< formatv("expected {0:x}", I->second.getRawFlagsValue())
2907-
<< " "
2908-
<< formatv("found {0:x}",
2909-
KV.second.getFlags().getRawFlagsValue())
2910-
<< "\n");
2911-
29122902
assert(I != MR.SymbolFlags.end() &&
29132903
"Resolving symbol outside this responsibility set");
29142904
assert(!I->second.hasMaterializationSideEffectsOnly() &&
@@ -2920,12 +2910,9 @@ Error ExecutionSession::OL_notifyResolved(MaterializationResponsibility &MR,
29202910
assert((KV.second.getFlags() & ~WeakOrCommon) ==
29212911
(I->second & ~JITSymbolFlags::Common) &&
29222912
"Resolving symbol with incorrect flags");
2923-
} else {
2924-
/*
2913+
} else
29252914
assert(KV.second.getFlags() == I->second &&
29262915
"Resolving symbol with incorrect flags");
2927-
*/
2928-
}
29292916
}
29302917
#endif
29312918

llvm/lib/ExecutionEngine/Orc/LinkGraphLayer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ JITSymbolFlags LinkGraphLayer::getJITSymbolFlagsForSymbol(Symbol &Sym) {
8686
if (Sym.isCallable())
8787
Flags |= JITSymbolFlags::Callable;
8888

89-
LLVM_DEBUG(dbgs() << " Symbol Flag for " << Sym.getName()
90-
<< formatv(" {0:x}\n", Flags.getRawFlagsValue()));
91-
9289
return Flags;
9390
}
9491

0 commit comments

Comments
 (0)