wip
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 10b948b..df5af99 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp
@@ -87,6 +87,12 @@ return ModuleRunnerBase::visitGlobalGet(curr); } + Flow visitTableGet(TableGet* curr) { + // We support tableLoad, below, so that call_indirect works (it calls it + // internally), but we want to disable table.get for now. + throw FailToEvalException("TODO: table.get"); + } + Flow visitLoad(Load* curr) { auto* memory = wasm.getMemory(curr->memory); if (memory->imported()) {
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 7124f61..61e078d 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h
@@ -3310,8 +3310,8 @@ TableInstanceInfo getTableInstanceInfo(Name name) { auto* table = wasm.getTable(name); - SubType* importedInstance; if (table->imported()) { + SubType* importedInstance; if (auto it = linkedInstances.find(table->module); it != linkedInstances.end()) { importedInstance = it->second.get(); @@ -3319,7 +3319,6 @@ Fatal() << "getTableInstanceInfo: no imported module providing " << std::quoted(name.toString()); } - // auto& importedInstance = linkedInstances.at(table->module); auto* tableExport = importedInstance->wasm.getExport(table->base); return importedInstance->getTableInstanceInfo( *tableExport->getInternalName());
diff --git a/test/ctor-eval/imports.wast b/test/ctor-eval/imports.wast index 74d034e..17f6689 100644 --- a/test/ctor-eval/imports.wast +++ b/test/ctor-eval/imports.wast
@@ -1,8 +1,10 @@ (module + ;; Importing things without using them doesn't affect evaluation of ctors. (import "import" "tag" (tag $tag)) (import "import" "func" (func $logi64 (param i64))) (import "import" "memory" (memory $memory 1 1)) ;; TODO: Fix importing for these two remaining types + ;; https://github.com/WebAssembly/binaryen/issues/8145 ;; (import "import" "global" (global $global i32)) ;; (import "import" "table" (table $table 1 1 anyref))
diff --git a/test/ctor-eval/repeated-import.wast b/test/ctor-eval/repeated-import.wast deleted file mode 100644 index 19b4dc6..0000000 --- a/test/ctor-eval/repeated-import.wast +++ /dev/null
@@ -1,16 +0,0 @@ -(module - ;; We can import the same name with completely different types. This is - ;; valid because the runtime may dynamically swap out the import name each time - ;; it is read. - (import "env" "log" (func $logi32 (param i32))) - (import "env" "log" (func $logi64 (param i64))) - (import "env" "log" (global $global i32)) - (func $foo (param $i32 i32) (param $i64 i64) (result i32) - (local.get $i32) - (call $logi32) - (local.get $i64) - (call $logi64) - (global.get $global) - ) - (export "foo" (func $foo)) -)
diff --git a/test/ctor-eval/repeated-import.wast.ctors b/test/ctor-eval/repeated-import.wast.ctors deleted file mode 100644 index 257cc56..0000000 --- a/test/ctor-eval/repeated-import.wast.ctors +++ /dev/null
@@ -1 +0,0 @@ -foo
diff --git a/test/ctor-eval/repeated-import.wast.out b/test/ctor-eval/repeated-import.wast.out deleted file mode 100644 index 664fe28..0000000 --- a/test/ctor-eval/repeated-import.wast.out +++ /dev/null
@@ -1,18 +0,0 @@ -(module - (type $0 (func (param i32))) - (type $1 (func (param i64))) - (type $2 (func (param i32 i64) (result i32))) - (import "env" "log" (global $global i32)) - (import "env" "log" (func $logi32 (type $0) (param i32))) - (import "env" "log" (func $logi64 (type $1) (param i64))) - (export "foo" (func $foo)) - (func $foo (type $2) (param $i32 i32) (param $i64 i64) (result i32) - (call $logi32 - (local.get $i32) - ) - (call $logi64 - (local.get $i64) - ) - (global.get $global) - ) -)