diff options
author | Alon Zakai <azakai@google.com> | 2021-03-18 15:12:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 15:12:28 -0700 |
commit | 26e6888d235645e993a9f870d597612412d28faf (patch) | |
tree | ca334ea3506933360cb157dbd8a04373850f82df /src/wasm-binary.h | |
parent | e5aaa07844687493e0155dacb6b79bf856a4dd81 (diff) | |
download | binaryen-26e6888d235645e993a9f870d597612412d28faf.tar.gz binaryen-26e6888d235645e993a9f870d597612412d28faf.tar.bz2 binaryen-26e6888d235645e993a9f870d597612412d28faf.zip |
wasm-emscripten-finalize: Do not read the Names section when not writing output (#3698)
When not writing output we don't need debug info, as it is not relevant for
our metadata. This saves loading and interning all the names, which takes
several seconds on massive inputs.
This is possible in principle in other tools, but this does not change anything
in them for now. (We do use names internally in some nontrivial ways without
opting in to it, so that would require further refactoring. Also the other tools
almost always do write an output.)
This is not 100% unobservable. If validation fails then the validation error would
just contain the function index instead of the name from the Names section if
there is one. However finalize does not validate atm so that would only matter
if we change that later.
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r-- | src/wasm-binary.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 453bcb9af..1cf8186f8 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1306,6 +1306,7 @@ class WasmBinaryBuilder { const std::vector<char>& input; std::istream* sourceMap; std::pair<uint32_t, Function::DebugLocation> nextDebugLocation; + bool debugInfo = true; bool DWARF = false; bool skipFunctionBodies = false; @@ -1324,6 +1325,7 @@ public: : wasm(wasm), allocator(wasm.allocator), input(input), sourceMap(nullptr), nextDebugLocation(0, {0, 0, 0}), debugLocation() {} + void setDebugInfo(bool value) { debugInfo = value; } void setDWARF(bool value) { DWARF = value; } void setSkipFunctionBodies(bool skipFunctionBodies_) { skipFunctionBodies = skipFunctionBodies_; |