[PATCH] D43435: Expand a lambda that is used only once.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 17 15:53:42 PST 2018
ruiu created this revision.
ruiu added a reviewer: sbc100.
Herald added a subscriber: aheejin.
Expand a lambda that is used only once.
https://reviews.llvm.org/D43435
Files:
lld/wasm/MarkLive.cpp
Index: lld/wasm/MarkLive.cpp
===================================================================
--- lld/wasm/MarkLive.cpp
+++ lld/wasm/MarkLive.cpp
@@ -61,33 +61,33 @@
// 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43435.134823.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180217/8d1834f1/attachment.bin>
More information about the llvm-commits
mailing list