summaryrefslogtreecommitdiff
path: root/src/wasm-linker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-linker.h')
-rw-r--r--src/wasm-linker.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/wasm-linker.h b/src/wasm-linker.h
index 535b5dc55..701585190 100644
--- a/src/wasm-linker.h
+++ b/src/wasm-linker.h
@@ -141,6 +141,11 @@ class LinkerObject {
return f->second;
}
+ void addIndirectIndex(Name name, Address index) {
+ assert(!indirectIndexes.count(name));
+ indirectIndexes[name] = index;
+ }
+
bool isEmpty() {
return wasm.functions.empty();
}
@@ -173,6 +178,9 @@ class LinkerObject {
std::map<Name, Address> segments; // name => segment index (in wasm module)
+ // preassigned indexes for functions called indirectly
+ std::map<Name, Address> indirectIndexes;
+
std::vector<Name> initializerFunctions;
LinkerObject(const LinkerObject&) = delete;
@@ -309,8 +317,8 @@ class Linker {
std::unordered_map<cashew::IString, int32_t> staticAddresses; // name => address
std::unordered_map<Address, Address> segmentsByAddress; // address => segment index
- std::unordered_map<cashew::IString, size_t> functionIndexes;
-
+ std::unordered_map<cashew::IString, Address> functionIndexes;
+ std::map<Address, cashew::IString> functionNames;
};