diff options
Diffstat (limited to 'src/shell-interface.h')
-rw-r--r-- | src/shell-interface.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shell-interface.h b/src/shell-interface.h index 1cb8768cf..0ba4946dd 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -86,7 +86,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { } } memory; - std::unordered_map<Name, std::vector<Name>> tables; + std::unordered_map<Name, std::vector<Literal>> tables; ShellExternalInterface() : memory() {} virtual ~ShellExternalInterface() = default; @@ -177,7 +177,10 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { if (index >= table.size()) { trap("callTable overflow"); } - auto* func = instance.wasm.getFunctionOrNull(table[index]); + Function* func = nullptr; + if (table[index].isFunction() && !table[index].isNull()) { + func = instance.wasm.getFunctionOrNull(table[index].getFunc()); + } if (!func) { trap("uninitialized table element"); } @@ -231,7 +234,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { memory.set<std::array<uint8_t, 16>>(addr, value); } - void tableStore(Name tableName, Address addr, Name entry) override { + void tableStore(Name tableName, Address addr, Literal entry) override { tables[tableName][addr] = entry; } |