summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index e2323967e..ea1a8ad82 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -28,6 +28,7 @@
#include "asm_v_wasm.h"
#include "asmjs/shared-constants.h"
#include "ir/import-utils.h"
+#include "ir/module-utils.h"
#include "parsing.h"
#include "wasm-builder.h"
#include "wasm-traversal.h"
@@ -902,7 +903,7 @@ inline S32LEB binaryType(Type type) {
class WasmBinaryWriter {
public:
WasmBinaryWriter(Module* input, BufferWithRandomAccess& o, bool debug = false)
- : wasm(input), o(o), debug(debug) {
+ : wasm(input), o(o), debug(debug), indexes(*input) {
prepare();
}
@@ -951,13 +952,6 @@ public:
void writeDataSegments();
void writeEvents();
- // name of the Function => index. first imports, then internals
- std::unordered_map<Name, Index> mappedFunctions;
- // name of the Global => index. first imported globals, then internal globals
- std::unordered_map<Name, uint32_t> mappedGlobals;
- // name of the Event => index. first imported events, then internal events
- std::unordered_map<Name, uint32_t> mappedEvents;
-
uint32_t getFunctionIndex(Name name);
uint32_t getGlobalIndex(Name name);
uint32_t getEventIndex(Name name);
@@ -1003,6 +997,7 @@ private:
Module* wasm;
BufferWithRandomAccess& o;
bool debug;
+ ModuleUtils::BinaryIndexes indexes;
bool debugInfo = true;
std::ostream* sourceMap = nullptr;