[lld] r325536 - [WebAssembly] Expand a lambda that is used only once.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 14:34:47 PST 2018
Author: ruiu
Date: Mon Feb 19 14:34:47 2018
New Revision: 325536
URL: http://llvm.org/viewvc/llvm-project?rev=325536&view=rev
Log:
[WebAssembly] Expand a lambda that is used only once.
Differential Revision: https://reviews.llvm.org/D43435
Modified:
lld/trunk/wasm/MarkLive.cpp
Modified: lld/trunk/wasm/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/MarkLive.cpp?rev=325536&r1=325535&r2=325536&view=diff
==============================================================================
--- lld/trunk/wasm/MarkLive.cpp (original)
+++ lld/trunk/wasm/MarkLive.cpp Mon Feb 19 14:34:47 2018
@@ -61,33 +61,33 @@ void lld::wasm::markLive() {
// The ctor functions are all used in the synthetic __wasm_call_ctors
// function, but since this function is created in-place it doesn't contain
- // reloctations which mean we have to manually mark the ctors.
+ // relocations which mean we have to manually mark the ctors.
for (const ObjFile *Obj : Symtab->ObjectFiles) {
const WasmLinkingData &L = Obj->getWasmObj()->linkingData();
for (const WasmInitFunc &F : L.InitFunctions)
Enqueue(Obj->getFunctionSymbol(F.FunctionIndex));
}
- auto EnqueueSuccessors = [Enqueue](InputChunk &Chunk) {
- for (const WasmRelocation Reloc : Chunk.getRelocations()) {
+ // Follow relocations to mark all reachable chunks.
+ while (!Q.empty()) {
+ InputChunk *C = Q.pop_back_val();
+
+ for (const WasmRelocation Reloc : C->getRelocations()) {
switch (Reloc.Type) {
case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
case R_WEBASSEMBLY_TABLE_INDEX_I32:
case R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- Enqueue(Chunk.File->getFunctionSymbol(Reloc.Index));
+ Enqueue(C->File->getFunctionSymbol(Reloc.Index));
break;
case R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
case R_WEBASSEMBLY_MEMORY_ADDR_LEB:
case R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
case R_WEBASSEMBLY_MEMORY_ADDR_I32:
- Enqueue(Chunk.File->getGlobalSymbol(Reloc.Index));
+ Enqueue(C->File->getGlobalSymbol(Reloc.Index));
break;
}
}
- };
-
- while (!Q.empty())
- EnqueueSuccessors(*Q.pop_back_val());
+ }
// Report garbage-collected sections.
if (Config->PrintGcSections) {
More information about the llvm-commits
mailing list