diff options
Diffstat (limited to 'src/wasm-stack.h')
-rw-r--r-- | src/wasm-stack.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wasm-stack.h b/src/wasm-stack.h index 5af9adbce..38b64dff4 100644 --- a/src/wasm-stack.h +++ b/src/wasm-stack.h @@ -118,6 +118,8 @@ public: void emitUnreachable(); void mapLocalsAndEmitHeader(); + MappedLocals mappedLocals; + private: void emitMemoryAccess(size_t alignment, size_t bytes, uint32_t offset); int32_t getBreakIndex(Name name); @@ -130,10 +132,12 @@ private: std::vector<Name> breakStack; + // The types of locals in the compact form, in order. + std::vector<Type> localTypes; // type => number of locals of that type in the compact form - std::map<Type, size_t> numLocalsByType; - // (local index, tuple index) => binary local index - std::map<std::pair<Index, Index>, size_t> mappedLocals; + std::unordered_map<Type, size_t> numLocalsByType; + + void noteLocalType(Type type); // Keeps track of the binary index of the scratch locals used to lower // tuple.extract. @@ -401,6 +405,8 @@ public: } } + MappedLocals& getMappedLocals() { return writer.mappedLocals; } + private: WasmBinaryWriter& parent; BinaryInstWriter writer; @@ -458,6 +464,8 @@ public: void write(); + MappedLocals& getMappedLocals() { return writer.mappedLocals; } + private: BinaryInstWriter writer; Function* func; |