try
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 474c1be..ebb31ed 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp
@@ -206,7 +206,8 @@ instanceInitialized, wasm, [this](Name name, Type type) { return makeFuncData(name, type); }), - linkedInstances_) {} + linkedInstances_), + instanceInitialized(instanceInitialized) {} Flow visitGlobalGet(GlobalGet* curr) { // Error on reads of imported globals. @@ -230,6 +231,14 @@ throw FailToEvalException("TODO: table.set"); } + Flow visitTableInit(TableInit* curr) { + if (instanceInitialized) { + throw FailToEvalException("TODO: table.init"); + } + + return ModuleRunnerBase<EvallingModuleRunner>::visitTableInit(curr); + } + bool allowContNew = true; Flow visitContNew(ContNew* curr) { @@ -250,6 +259,9 @@ #endif return Literal(allocation, type); } + +private: + const bool& instanceInitialized; }; // Build an artificial `env` module based on a module's imports, so that the
diff --git a/test/lit/ctor-eval/table.init.wat b/test/lit/ctor-eval/table.init.wat index f6d7b63..7af2a09 100644 --- a/test/lit/ctor-eval/table.init.wat +++ b/test/lit/ctor-eval/table.init.wat
@@ -11,6 +11,7 @@ ;; CHECK: (elem $init (i32.const 0) $nop) (elem $init (i32.const 0) $nop) + ;; CHECK: (elem $later func $trap) (elem $later $trap) (export "run" (func $run)) @@ -42,11 +43,19 @@ (nop) ) + ;; CHECK: (func $trap (type $none_=>_none) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $trap (type $none_=>_none) (unreachable) ) ) ;; CHECK: (func $run_3 (type $none_=>_none) +;; CHECK-NEXT: (table.init $table $later +;; CHECK-NEXT: (i32.const 0) +;; CHECK-NEXT: (i32.const 0) +;; CHECK-NEXT: (i32.const 1) +;; CHECK-NEXT: ) ;; CHECK-NEXT: (call_indirect $table (type $none_=>_none) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: )