[PATCH] D62548: [WebAssembly] Move direct call tracking from member to local. NFC.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 28 13:35:41 PDT 2019
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.
This data structure is only needed temporarily while symbols are being
created.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62548
Files:
lld/wasm/InputFiles.cpp
lld/wasm/InputFiles.h
Index: lld/wasm/InputFiles.h
===================================================================
--- lld/wasm/InputFiles.h
+++ lld/wasm/InputFiles.h
@@ -69,13 +69,6 @@
// List of all symbols referenced or defined by this file.
std::vector<Symbol *> Symbols;
- // Bool for each symbol, true if called directly. This allows us to implement
- // a weaker form of signature checking where undefined functions that are not
- // called directly (i.e. only address taken) don't have to match the defined
- // function's signature. We cannot do this for directly called functions
- // because those signatures are checked at validation times.
- // See https://bugs.llvm.org/show_bug.cgi?id=40412
- std::vector<bool> SymbolIsCalledDirectly;
private:
const Kind FileKind;
Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -272,7 +272,14 @@
}
uint32_t SectionIndex = 0;
- SymbolIsCalledDirectly.resize(WasmObj->getNumberOfSymbols(), false);
+
+ // Bool for each symbol, true if called directly. This allows us to implement
+ // a weaker form of signature checking where undefined functions that are not
+ // called directly (i.e. only address taken) don't have to match the defined
+ // function's signature. We cannot do this for directly called functions
+ // because those signatures are checked at validation times.
+ // See https://bugs.llvm.org/show_bug.cgi?id=40412
+ std::vector<bool> IsCalledDirectly(WasmObj->getNumberOfSymbols(), false);
for (const SectionRef &Sec : WasmObj->sections()) {
const WasmSection &Section = WasmObj->getWasmSection(Sec);
// Wasm objects can have at most one code and one data section.
@@ -292,7 +299,7 @@
// directly
for (const WasmRelocation &Reloc : Section.Relocations)
if (Reloc.Type == R_WASM_FUNCTION_INDEX_LEB)
- SymbolIsCalledDirectly[Reloc.Index] = true;
+ IsCalledDirectly[Reloc.Index] = true;
}
TypeMap.resize(getWasmObj()->types().size());
@@ -342,7 +349,7 @@
}
}
size_t Idx = Symbols.size();
- Symbols.push_back(createUndefined(WasmSym, SymbolIsCalledDirectly[Idx]));
+ Symbols.push_back(createUndefined(WasmSym, IsCalledDirectly[Idx]));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62548.201750.patch
Type: text/x-patch
Size: 2313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190528/5191ef29/attachment.bin>
More information about the llvm-commits
mailing list