Skip to content

Commit 34531cf

Browse files
committed
Revert "[llvm-jitlink] Use concurrent linking by default."
This reverts commit edca1d9 while I investigate bot failures, e.g. https://lab.llvm.org/buildbot/#/builders/137/builds/10791.
1 parent 85a7989 commit 34531cf

File tree

5 files changed

+8
-55
lines changed

5 files changed

+8
-55
lines changed

llvm/tools/llvm-jitlink/llvm-jitlink-coff.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ static Expected<Symbol &> getCOFFStubTarget(LinkGraph &G, Block &B) {
6666

6767
namespace llvm {
6868
Error registerCOFFGraphInfo(Session &S, LinkGraph &G) {
69-
std::lock_guard<std::mutex> Lock(S.M);
70-
7169
auto FileName = sys::path::filename(G.getName());
7270
if (S.FileInfos.count(FileName)) {
7371
return make_error<StringError>("When -check is passed, file names must be "

llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ static Error registerSymbol(LinkGraph &G, Symbol &Sym, Session::FileInfo &FI,
101101
namespace llvm {
102102

103103
Error registerELFGraphInfo(Session &S, LinkGraph &G) {
104-
std::lock_guard<std::mutex> Lock(S.M);
105-
106104
auto FileName = sys::path::filename(G.getName());
107105
if (S.FileInfos.count(FileName)) {
108106
return make_error<StringError>("When -check is passed, file names must be "

llvm/tools/llvm-jitlink/llvm-jitlink-macho.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ static Expected<Symbol &> getMachOStubTarget(LinkGraph &G, Block &B) {
6969
namespace llvm {
7070

7171
Error registerMachOGraphInfo(Session &S, LinkGraph &G) {
72-
std::lock_guard<std::mutex> Lock(S.M);
73-
7472
auto FileName = sys::path::filename(G.getName());
7573
if (S.FileInfos.count(FileName)) {
7674
return make_error<StringError>("When -check is passed, file names must be "

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ static cl::list<std::string> InputFiles(cl::Positional, cl::OneOrMore,
9191
cl::desc("input files"),
9292
cl::cat(JITLinkCategory));
9393

94-
cl::opt<size_t> MaterializationThreads(
95-
"threads", cl::desc("Number of materialization threads to use"),
96-
cl::init(std::numeric_limits<size_t>::max()), cl::cat(JITLinkCategory));
97-
9894
static cl::list<std::string>
9995
LibrarySearchPaths("L",
10096
cl::desc("Add dir to the list of library search paths"),
@@ -404,7 +400,6 @@ bool lazyLinkingRequested() {
404400
}
405401

406402
static Error applyHarnessPromotions(Session &S, LinkGraph &G) {
407-
std::lock_guard<std::mutex> Lock(S.M);
408403

409404
// If this graph is part of the test harness there's nothing to do.
410405
if (S.HarnessFiles.empty() || S.HarnessFiles.count(G.getName()))
@@ -455,11 +450,7 @@ static Error applyHarnessPromotions(Session &S, LinkGraph &G) {
455450
return Error::success();
456451
}
457452

458-
static void dumpSectionContents(raw_ostream &OS, Session &S, LinkGraph &G) {
459-
std::lock_guard<std::mutex> Lock(S.M);
460-
461-
outs() << "Relocated section contents for " << G.getName() << ":\n";
462-
453+
static void dumpSectionContents(raw_ostream &OS, LinkGraph &G) {
463454
constexpr orc::ExecutorAddrDiff DumpWidth = 16;
464455
static_assert(isPowerOf2_64(DumpWidth), "DumpWidth must be a power of two");
465456

@@ -851,7 +842,7 @@ static Expected<std::unique_ptr<ExecutorProcessControl>> launchExecutor() {
851842
S.CreateMemoryManager = createSharedMemoryManager;
852843

853844
return SimpleRemoteEPC::Create<FDSimpleRemoteEPCTransport>(
854-
std::make_unique<DynamicThreadPoolTaskDispatcher>(MaterializationThreads),
845+
std::make_unique<DynamicThreadPoolTaskDispatcher>(std::nullopt),
855846
std::move(S), FromExecutor[ReadEnd], ToExecutor[WriteEnd]);
856847
#endif
857848
}
@@ -993,16 +984,10 @@ Expected<std::unique_ptr<Session>> Session::Create(Triple TT,
993984
auto PageSize = sys::Process::getPageSize();
994985
if (!PageSize)
995986
return PageSize.takeError();
996-
std::unique_ptr<TaskDispatcher> Dispatcher;
997-
if (MaterializationThreads == 0)
998-
Dispatcher = std::make_unique<InPlaceTaskDispatcher>();
999-
else
1000-
Dispatcher = std::make_unique<DynamicThreadPoolTaskDispatcher>(
1001-
MaterializationThreads);
1002-
1003987
EPC = std::make_unique<SelfExecutorProcessControl>(
1004-
std::make_shared<SymbolStringPool>(), std::move(Dispatcher),
1005-
std::move(TT), *PageSize, createInProcessMemoryManager());
988+
std::make_shared<SymbolStringPool>(),
989+
std::make_unique<InPlaceTaskDispatcher>(), std::move(TT), *PageSize,
990+
createInProcessMemoryManager());
1006991
}
1007992

1008993
Error Err = Error::success();
@@ -1236,7 +1221,6 @@ void Session::modifyPassConfig(LinkGraph &G, PassConfiguration &PassConfig) {
12361221

12371222
if (ShowGraphsRegex)
12381223
PassConfig.PostFixupPasses.push_back([this](LinkGraph &G) -> Error {
1239-
std::lock_guard<std::mutex> Lock(M);
12401224
// Print graph if ShowLinkGraphs is specified-but-empty, or if
12411225
// it contains the given graph.
12421226
if (ShowGraphsRegex->match(G.getName())) {
@@ -1250,8 +1234,9 @@ void Session::modifyPassConfig(LinkGraph &G, PassConfiguration &PassConfig) {
12501234
[this](LinkGraph &G) { return applyHarnessPromotions(*this, G); });
12511235

12521236
if (ShowRelocatedSectionContents)
1253-
PassConfig.PostFixupPasses.push_back([this](LinkGraph &G) -> Error {
1254-
dumpSectionContents(outs(), *this, G);
1237+
PassConfig.PostFixupPasses.push_back([](LinkGraph &G) -> Error {
1238+
outs() << "Relocated section contents for " << G.getName() << ":\n";
1239+
dumpSectionContents(outs(), G);
12551240
return Error::success();
12561241
});
12571242

@@ -1616,31 +1601,6 @@ static Error sanitizeArguments(const Triple &TT, const char *ArgV0) {
16161601
}
16171602
}
16181603

1619-
if (MaterializationThreads == std::numeric_limits<size_t>::max()) {
1620-
if (auto HC = std::thread::hardware_concurrency())
1621-
MaterializationThreads = HC;
1622-
else {
1623-
errs() << "Warning: std::thread::hardware_concurrency() returned 0, "
1624-
"defaulting to -threads=1.\n";
1625-
MaterializationThreads = 1;
1626-
}
1627-
}
1628-
1629-
if (!!OutOfProcessExecutor.getNumOccurrences() ||
1630-
!!OutOfProcessExecutorConnect.getNumOccurrences()) {
1631-
if (NoExec)
1632-
return make_error<StringError>("-noexec cannot be used with " +
1633-
OutOfProcessExecutor.ArgStr + " or " +
1634-
OutOfProcessExecutorConnect.ArgStr,
1635-
inconvertibleErrorCode());
1636-
1637-
if (MaterializationThreads == 0)
1638-
return make_error<StringError>("-threads=0 cannot be used with " +
1639-
OutOfProcessExecutor.ArgStr + " or " +
1640-
OutOfProcessExecutorConnect.ArgStr,
1641-
inconvertibleErrorCode());
1642-
}
1643-
16441604
// Only one of -oop-executor and -oop-executor-connect can be used.
16451605
if (!!OutOfProcessExecutor.getNumOccurrences() &&
16461606
!!OutOfProcessExecutorConnect.getNumOccurrences())

llvm/tools/llvm-jitlink/llvm-jitlink.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ struct Session {
110110

111111
DynLibJDMap DynLibJDs;
112112

113-
std::mutex M;
114113
SymbolInfoMap SymbolInfos;
115114
FileInfoMap FileInfos;
116115

0 commit comments

Comments
 (0)