Skip to content

Commit 603d41a

Browse files
committed
[ELF] decompress: remove mutex
decompress() is in the parallel code path splitIntoPieces and we should avoid mutex.
1 parent 2a5e1da commit 603d41a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lld/ELF/InputSection.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,9 @@ static void decompressAux(Ctx &ctx, const InputSectionBase &sec, uint8_t *out,
128128

129129
void InputSectionBase::decompress() const {
130130
Ctx &ctx = getCtx();
131-
uint8_t *uncompressedBuf;
132-
{
133-
static std::mutex mu;
134-
std::lock_guard<std::mutex> lock(mu);
135-
uncompressedBuf = ctx.bAlloc.Allocate<uint8_t>(size);
136-
}
137-
138-
invokeELFT(decompressAux, ctx, *this, uncompressedBuf, size);
139-
content_ = uncompressedBuf;
131+
uint8_t *buf = makeThreadLocalN<uint8_t>(size);
132+
invokeELFT(decompressAux, ctx, *this, buf, size);
133+
content_ = buf;
140134
compressed = false;
141135
}
142136

0 commit comments

Comments
 (0)