diff options
Diffstat (limited to 'test')
48 files changed, 454 insertions, 132 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 3d2a5d138..4c97cdb90 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -295,6 +295,7 @@ console.log("# CallIndirect"); (function testCallIndirect() { const module = new binaryen.Module(); + var table = "0"; var target = module.i32.const(42); var params = binaryen.none; var results = binaryen.none; @@ -302,9 +303,10 @@ console.log("# CallIndirect"); module.i32.const(1), module.i32.const(2) ]; - const theCallIndirect = binaryen.CallIndirect(module.call_indirect(target, operands, params, results)); + const theCallIndirect = binaryen.CallIndirect(module.call_indirect(table, target, operands, params, results)); assert(theCallIndirect instanceof binaryen.CallIndirect); assert(theCallIndirect instanceof binaryen.Expression); + assert(theCallIndirect.table === table); assert(theCallIndirect.target === target); assertDeepEqual(theCallIndirect.operands, operands); assert(theCallIndirect.params === params); @@ -346,7 +348,7 @@ console.log("# CallIndirect"); assert( theCallIndirect.toText() == - "(call_indirect (type $i32_i32_=>_i32)\n (i32.const 7)\n (i32.const 6)\n (i32.const 9000)\n)\n" + "(call_indirect $0 (type $i32_i32_=>_i32)\n (i32.const 7)\n (i32.const 6)\n (i32.const 9000)\n)\n" ); module.dispose(); diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt index 5a0353c27..80a642af8 100644 --- a/test/binaryen.js/expressions.js.txt +++ b/test/binaryen.js/expressions.js.txt @@ -42,7 +42,7 @@ ) # CallIndirect -(call_indirect (type $i32_i32_=>_i32) +(call_indirect $0 (type $i32_i32_=>_i32) (i32.const 7) (i32.const 6) (i32.const 9000) diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 39154ef7d..327cf0534 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -517,7 +517,7 @@ function test_core() { ) ), module.i32.eqz( // check the output type of the call node - module.call_indirect(makeInt32(2449), [ makeInt32(13), makeInt64(37, 0), makeFloat32(1.3), makeFloat64(3.7) ], iIfF, binaryen.i32) + module.call_indirect("0", makeInt32(2449), [ makeInt32(13), makeInt64(37, 0), makeFloat32(1.3), makeFloat64(3.7) ], iIfF, binaryen.i32) ), module.drop(module.local.get(0, binaryen.i32)), module.local.set(0, makeInt32(101)), @@ -532,7 +532,7 @@ function test_core() { module.return(makeInt32(1337)), // Tail Call module.return_call("kitchen()sinker", [ makeInt32(13), makeInt64(37, 0), makeFloat32(1.3), makeFloat64(3.7) ], binaryen.i32), - module.return_call_indirect(makeInt32(2449), [ makeInt32(13), makeInt64(37, 0), makeFloat32(1.3), makeFloat64(3.7) ], iIfF, binaryen.i32), + module.return_call_indirect("0", makeInt32(2449), [ makeInt32(13), makeInt64(37, 0), makeFloat32(1.3), makeFloat64(3.7) ], iIfF, binaryen.i32), // Reference types module.ref.is_null(module.ref.null(binaryen.externref)), @@ -661,9 +661,25 @@ function test_core() { module.addGlobalExport("a-global", "a-global-exp"); module.addEventExport("a-event", "a-event-exp"); - // Function table. One per module + // Tables + module.addTable("t1", 0, 2, []); + var tablePtr = module.getTable("t1"); + assert(tablePtr !== 0); + assert(tablePtr === module.getTableByIndex(0)); + var table = binaryen.getTableInfo(tablePtr); + assert(table.name === "t1"); + assert(table.module === ""); + assert(table.base === ""); + assert(table.initial === 0); + assert(table.max === 2); + + module.removeTable("t1"); + assert(module.getNumTables() === 0); + + // Legacy module.setFunctionTable(1, 0xffffffff, [ binaryen.getFunctionInfo(sinker).name ]); + assert(module.getNumTables() === 1); // Memory. One per module diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 9b45d9a01..4b9de93ab 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -1758,7 +1758,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) (drop (i32.eqz - (call_indirect (type $i32_i64_f32_f64_=>_i32) + (call_indirect $0 (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) @@ -1822,7 +1822,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (f32.const 1.2999999523162842) (f64.const 3.7) ) - (return_call_indirect (type $i32_i64_f32_f64_=>_i32) + (return_call_indirect $0 (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) @@ -3620,7 +3620,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) (drop (i32.eqz - (call_indirect (type $i32_i64_f32_f64_=>_i32) + (call_indirect $0 (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) @@ -3684,7 +3684,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (f32.const 1.2999999523162842) (f64.const 3.7) ) - (return_call_indirect (type $i32_i64_f32_f64_=>_i32) + (return_call_indirect $0 (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) diff --git a/test/binaryen.js/tail_calls.js b/test/binaryen.js/tail_calls.js index 1b993be91..61fe5d829 100644 --- a/test/binaryen.js/tail_calls.js +++ b/test/binaryen.js/tail_calls.js @@ -18,6 +18,7 @@ var bar = module.addFunction( binaryen.none, [], module.return_call_indirect( + "0", module.i32.const(0), [], binaryen.none, diff --git a/test/ctor-eval/bad-indirect-call.wast.out b/test/ctor-eval/bad-indirect-call.wast.out index 4c33e46ca..6629e6bbb 100644 --- a/test/ctor-eval/bad-indirect-call.wast.out +++ b/test/ctor-eval/bad-indirect-call.wast.out @@ -6,7 +6,7 @@ (elem (i32.const 0) $call-indirect) (export "test1" (func $test1)) (func $test1 - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 1) ) (i32.store8 diff --git a/test/ctor-eval/bad-indirect-call2.wast.out b/test/ctor-eval/bad-indirect-call2.wast.out index ed7546981..9a9186a78 100644 --- a/test/ctor-eval/bad-indirect-call2.wast.out +++ b/test/ctor-eval/bad-indirect-call2.wast.out @@ -7,7 +7,7 @@ (elem (i32.const 0) $_abort $call-indirect) (export "test1" (func $test1)) (func $test1 - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) (i32.store8 diff --git a/test/ctor-eval/bad-indirect-call3.wast.out b/test/ctor-eval/bad-indirect-call3.wast.out index 5edfb58b1..422360974 100644 --- a/test/ctor-eval/bad-indirect-call3.wast.out +++ b/test/ctor-eval/bad-indirect-call3.wast.out @@ -14,7 +14,7 @@ ) ) (func $sig_mismatch - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.null func) (i32.const 0) ) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 907ab58c9..b45039c69 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -318,6 +318,8 @@ void test_core() { BinaryenAddEvent( module, "a-event", 0, BinaryenTypeInt32(), BinaryenTypeNone()); + BinaryenAddTable(module, "tab", 0, 100, NULL, 0, makeInt32(module, 0)); + // Exception handling // (try @@ -680,6 +682,7 @@ void test_core() { BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node BinaryenCallIndirect(module, + "tab", makeInt32(module, 2449), callOperands4b, 4, @@ -704,6 +707,7 @@ void test_core() { BinaryenReturnCall( module, "kitchen()sinker", callOperands4, 4, BinaryenTypeInt32()), BinaryenReturnCallIndirect(module, + "tab", makeInt32(module, 2449), callOperands4b, 4, @@ -840,6 +844,7 @@ void test_core() { void test_unreachable() { BinaryenModuleRef module = BinaryenModuleCreate(); BinaryenExpressionRef body = BinaryenCallIndirect(module, + "invalid-table", BinaryenUnreachable(module), NULL, 0, diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 8b06c1109..f03e4ec6c 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -38,7 +38,7 @@ BinaryenFeatureAll: 8191 (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") - (table $0 1 1 funcref) + (table $tab 1 1 funcref) (elem (i32.const 0) "$kitchen()sinker") (global $a-global i32 (i32.const 7)) (global $a-mutable-global (mut f32) (f32.const 7.5)) @@ -1666,7 +1666,7 @@ BinaryenFeatureAll: 8191 ) (drop (i32.eqz - (call_indirect (type $i32_i64_f32_f64_=>_i32) + (call_indirect $tab (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) @@ -1730,7 +1730,7 @@ BinaryenFeatureAll: 8191 (f32.const 1.2999999523162842) (f64.const 3.7) ) - (return_call_indirect (type $i32_i64_f32_f64_=>_i32) + (return_call_indirect $tab (type $i32_i64_f32_f64_=>_i32) (i32.const 13) (i64.const 37) (f32.const 1.2999999523162842) diff --git a/test/example/c-api-multiple-tables.c b/test/example/c-api-multiple-tables.c new file mode 100644 index 000000000..4ba612658 --- /dev/null +++ b/test/example/c-api-multiple-tables.c @@ -0,0 +1,90 @@ +#include <assert.h> +#include <string.h> +#include <binaryen-c.h> + +// "hello world" type example: create a function that adds two i32s and returns +// the result + +int main() { + BinaryenModuleRef module = BinaryenModuleCreate(); + BinaryenModuleSetFeatures(module, BinaryenFeatureReferenceTypes()); + + // Create a function type for i32 (i32, i32) + BinaryenType ii[2] = {BinaryenTypeInt32(), BinaryenTypeInt32()}; + BinaryenType params = BinaryenTypeCreate(ii, 2); + BinaryenType results = BinaryenTypeInt32(); + + assert(BinaryenGetNumTables(module) == 0); + + { + // Get the 0 and 1 arguments, and add them + BinaryenExpressionRef x = BinaryenLocalGet(module, 0, BinaryenTypeInt32()), + y = BinaryenLocalGet(module, 1, BinaryenTypeInt32()); + BinaryenExpressionRef add = + BinaryenBinary(module, BinaryenAddInt32(), x, y); + + // Create the add function + // Note: no additional local variables + // Note: no basic blocks here, we are an AST. The function body is just an + // expression node. + BinaryenFunctionRef adder = + BinaryenAddFunction(module, "adder", params, results, NULL, 0, add); + + const char* funcNames[] = {"adder"}; + BinaryenAddTable(module, + "tab", + 1, + 1, + funcNames, + 1, + BinaryenConst(module, BinaryenLiteralInt32(0))); + assert(BinaryenGetTable(module, "tab") != NULL); + + BinaryenAddTable(module, + "t2", + 1, + 1, + funcNames, + 1, + BinaryenConst(module, BinaryenLiteralInt32(0))); + BinaryenTableRef t2 = BinaryenGetTableByIndex(module, 1); + assert(t2 != NULL); + + assert(strcmp(BinaryenTableGetName(t2), "t2") == 0); + assert(BinaryenTableGetInitial(t2) == 1); + assert(BinaryenTableHasMax(t2) == 1); + assert(BinaryenTableGetMax(t2) == 1); + assert(strcmp(BinaryenTableImportGetModule(t2), "") == 0); + assert(strcmp(BinaryenTableImportGetBase(t2), "") == 0); + + assert(BinaryenGetNumTables(module) == 2); + } + + { + // Get the 0 and 1 arguments, and add them + BinaryenExpressionRef operands[] = { + BinaryenLocalGet(module, 0, BinaryenTypeInt32()), + BinaryenLocalGet(module, 1, BinaryenTypeInt32())}; + + BinaryenExpressionRef add_indirect = + BinaryenCallIndirect(module, + "tab", + BinaryenConst(module, BinaryenLiteralInt32(0)), + operands, + 2, + params, + results); + BinaryenCallIndirectSetTable(add_indirect, "t2"); + + BinaryenFunctionRef call_adder_indirectly = BinaryenAddFunction( + module, "call_adder_indirect", params, results, NULL, 0, add_indirect); + } + + // Print it out + BinaryenModulePrint(module); + + // Clean up the module, which owns all the objects we created above + BinaryenModuleDispose(module); + + return 0; +} diff --git a/test/example/c-api-multiple-tables.txt b/test/example/c-api-multiple-tables.txt new file mode 100644 index 000000000..c0f2da53b --- /dev/null +++ b/test/example/c-api-multiple-tables.txt @@ -0,0 +1,20 @@ +(module + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (table $tab 1 1 funcref) + (elem (table $tab) (i32.const 0) func $adder) + (table $t2 1 1 funcref) + (elem (table $t2) (i32.const 0) func $adder) + (func $adder (param $0 i32) (param $1 i32) (result i32) + (i32.add + (local.get $0) + (local.get $1) + ) + ) + (func $call_adder_indirect (param $0 i32) (param $1 i32) (result i32) + (call_indirect $t2 (type $i32_i32_=>_i32) + (local.get $0) + (local.get $1) + (i32.const 0) + ) + ) +) diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index 32d579c2c..93a766652 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -311,7 +311,7 @@ After: (export "foo" (func $foo)) (export "%table" (table $0)) (func $foo (param $0 i32) (result i32) - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (local.get $0) (i32.const 0) ) @@ -377,7 +377,7 @@ After: (export "foo" (func $foo)) (export "%table" (table $table)) (func $foo (param $0 i32) (result i32) - (call_indirect (type $i32_=>_i32) + (call_indirect $table (type $i32_=>_i32) (local.get $0) (i32.const 42) ) @@ -417,7 +417,7 @@ After: (export "%table" (table $table)) (export "%global" (global $base)) (func $foo (param $0 i32) (result i32) - (call_indirect (type $i32_=>_i32) + (call_indirect $table (type $i32_=>_i32) (local.get $0) (global.get $base) ) @@ -467,7 +467,7 @@ After: (nop) ) (func $foo (param $0 i32) (result i32) - (call_indirect (type $i32_=>_i32) + (call_indirect $table (type $i32_=>_i32) (local.get $0) (i32.add (global.get $base) @@ -564,7 +564,7 @@ After: (elem (i32.const 0) $placeholder_0) (export "%table" (table $0)) (func $foo - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) @@ -631,7 +631,7 @@ After: (nop) ) (func $bar - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) @@ -923,7 +923,7 @@ After: (export "%foo" (func $foo)) (export "%table" (table $table)) (func $foo (param $0 i32) (result i32) - (call_indirect (type $i32_=>_i32) + (call_indirect $table (type $i32_=>_i32) (i32.const 0) (i32.const 1) ) @@ -963,7 +963,7 @@ After: (export "foo2" (func $foo)) (export "%table" (table $0)) (func $foo - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) diff --git a/test/multi-table.minified.txt b/test/multi-table.minified.txt new file mode 100644 index 000000000..6222ea303 --- /dev/null +++ b/test/multi-table.minified.txt @@ -0,0 +1 @@ +(module(type $none_=>_none (func))(import "a" "b" (table $t1 1 10 funcref))(elem (table $t1) (i32.const 0) func $f)(table $t2 3 3 funcref)(elem (table $t2) (i32.const 0) func $f)(elem (table $t2) (i32.const 1) func $f $g)(func $f(nop))(func $g(nop)))
\ No newline at end of file diff --git a/test/multi-table.wast b/test/multi-table.wast new file mode 100644 index 000000000..07c1e0077 --- /dev/null +++ b/test/multi-table.wast @@ -0,0 +1,14 @@ +(module + (import "a" "b" (table $t1 1 10 funcref)) + (table $t2 3 3 funcref) + + ;; add to $t1 + (elem (i32.const 0) $f) + + ;; add to $t2 + (elem (table $t2) (i32.const 0) func $f) + (elem (table $t2) (offset (i32.const 1)) func $f $g) + + (func $f) + (func $g) +)
\ No newline at end of file diff --git a/test/multi-table.wast.from-wast b/test/multi-table.wast.from-wast new file mode 100644 index 000000000..9d1842b70 --- /dev/null +++ b/test/multi-table.wast.from-wast @@ -0,0 +1,14 @@ +(module + (type $none_=>_none (func)) + (import "a" "b" (table $t1 1 10 funcref)) + (elem (table $t1) (i32.const 0) func $f) + (table $t2 3 3 funcref) + (elem (table $t2) (i32.const 0) func $f) + (elem (table $t2) (i32.const 1) func $f $g) + (func $f + (nop) + ) + (func $g + (nop) + ) +) diff --git a/test/multi-table.wast.fromBinary b/test/multi-table.wast.fromBinary new file mode 100644 index 000000000..1bfd568da --- /dev/null +++ b/test/multi-table.wast.fromBinary @@ -0,0 +1,15 @@ +(module + (type $none_=>_none (func)) + (import "a" "b" (table $t1 1 10 funcref)) + (elem (table $t1) (i32.const 0) func $f) + (table $t2 3 3 funcref) + (elem (table $t2) (i32.const 0) func $f) + (elem (table $t2) (i32.const 1) func $f $g) + (func $f + (nop) + ) + (func $g + (nop) + ) +) + diff --git a/test/multi-table.wast.fromBinary.noDebugInfo b/test/multi-table.wast.fromBinary.noDebugInfo new file mode 100644 index 000000000..00c3a64cb --- /dev/null +++ b/test/multi-table.wast.fromBinary.noDebugInfo @@ -0,0 +1,15 @@ +(module + (type $none_=>_none (func)) + (import "a" "b" (table $timport$0 1 10 funcref)) + (elem (table $timport$0) (i32.const 0) func $0) + (table $0 3 3 funcref) + (elem (table $0) (i32.const 0) func $0) + (elem (table $0) (i32.const 1) func $0 $1) + (func $0 + (nop) + ) + (func $1 + (nop) + ) +) + diff --git a/test/newsyntax.wast.from-wast b/test/newsyntax.wast.from-wast index edf54b5b9..7b8e2b2a6 100644 --- a/test/newsyntax.wast.from-wast +++ b/test/newsyntax.wast.from-wast @@ -5,13 +5,13 @@ (export "call_indirect" (func $0)) (func $0 (drop - (call_indirect (type $i32_f64_=>_i32) + (call_indirect $timport$0 (type $i32_f64_=>_i32) (i32.const 10) (f64.const 20) (i32.const 30) ) ) - (call_indirect (type $none_=>_none) + (call_indirect $timport$0 (type $none_=>_none) (i32.const 1) ) ) diff --git a/test/newsyntax.wast.fromBinary b/test/newsyntax.wast.fromBinary index ea3b1ac9a..5309fb3eb 100644 --- a/test/newsyntax.wast.fromBinary +++ b/test/newsyntax.wast.fromBinary @@ -5,13 +5,13 @@ (export "call_indirect" (func $0)) (func $0 (drop - (call_indirect (type $i32_f64_=>_i32) + (call_indirect $timport$0 (type $i32_f64_=>_i32) (i32.const 10) (f64.const 20) (i32.const 30) ) ) - (call_indirect (type $none_=>_none) + (call_indirect $timport$0 (type $none_=>_none) (i32.const 1) ) ) diff --git a/test/newsyntax.wast.fromBinary.noDebugInfo b/test/newsyntax.wast.fromBinary.noDebugInfo index ea3b1ac9a..5309fb3eb 100644 --- a/test/newsyntax.wast.fromBinary.noDebugInfo +++ b/test/newsyntax.wast.fromBinary.noDebugInfo @@ -5,13 +5,13 @@ (export "call_indirect" (func $0)) (func $0 (drop - (call_indirect (type $i32_f64_=>_i32) + (call_indirect $timport$0 (type $i32_f64_=>_i32) (i32.const 10) (f64.const 20) (i32.const 30) ) ) - (call_indirect (type $none_=>_none) + (call_indirect $timport$0 (type $none_=>_none) (i32.const 1) ) ) diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt index 1ec56ef2c..db50f97a8 100644 --- a/test/passes/O3_low-memory-unused_metrics.txt +++ b/test/passes/O3_low-memory-unused_metrics.txt @@ -6,6 +6,7 @@ total [imports] : 10 [memory-data] : 0 [table-data] : 0 + [tables] : 0 [total] : 1964 [vars] : 9 Binary : 240 diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt index 1764458f6..2df4a4b0b 100644 --- a/test/passes/converge_O3_metrics.bin.txt +++ b/test/passes/converge_O3_metrics.bin.txt @@ -6,6 +6,7 @@ total [imports] : 3 [memory-data] : 28 [table-data] : 429 + [tables] : 0 [total] : 129 [vars] : 4 Binary : 12 @@ -247,6 +248,7 @@ total [imports] : 3 [memory-data] : 28 [table-data] : 429 + [tables] : 0 [total] : 129 [vars] : 4 Binary : 12 diff --git a/test/passes/dae_all-features.txt b/test/passes/dae_all-features.txt index 9a1a4d89a..1c8c9f799 100644 --- a/test/passes/dae_all-features.txt +++ b/test/passes/dae_all-features.txt @@ -268,7 +268,7 @@ (i32.const 42) ) (drop - (return_call_indirect (type $none_=>_i32) + (return_call_indirect $0 (type $none_=>_i32) (i32.const 0) ) ) diff --git a/test/passes/directize_all-features.txt b/test/passes/directize_all-features.txt index 4b6934f06..6b3d10b53 100644 --- a/test/passes/directize_all-features.txt +++ b/test/passes/directize_all-features.txt @@ -14,8 +14,29 @@ ) (module (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) (table $0 5 5 funcref) - (elem (i32.const 4) $foo) + (elem (table $0) (i32.const 1) func $dummy) + (table $1 5 5 funcref) + (elem (table $1) (i32.const 1) func $f) + (func $dummy (param $0 i32) (result i32) + (local.get $0) + ) + (func $f (param $0 i32) (param $1 i32) + (unreachable) + ) + (func $g (param $x i32) (param $y i32) + (call $f + (local.get $x) + (local.get $y) + ) + ) +) +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (table $0 5 5 funcref) + (table $1 5 5 funcref) + (elem (table $1) (i32.const 4) func $foo) (func $foo (param $0 i32) (param $1 i32) (unreachable) ) @@ -43,7 +64,9 @@ (module (type $i32_i32_=>_none (func (param i32 i32))) (table $0 5 5 funcref) - (elem (i32.const 0) $foo $foo $foo $foo $foo) + (elem (table $0) (i32.const 0) func $foo $foo $foo $foo $foo) + (table $1 5 5 funcref) + (elem (table $1) (i32.const 0) func $foo $foo $foo $foo $foo) (func $foo (param $0 i32) (param $1 i32) (unreachable) ) @@ -62,7 +85,7 @@ (unreachable) ) (func $bar (param $x i32) (param $y i32) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $table (type $i32_i32_=>_none) (local.get $x) (local.get $y) (i32.const 1) @@ -78,7 +101,7 @@ (unreachable) ) (func $bar (param $x i32) (param $y i32) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (local.get $x) (local.get $y) (i32.const 1) @@ -94,7 +117,24 @@ (unreachable) ) (func $bar (param $x i32) (param $y i32) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) + (local.get $x) + (local.get $y) + (i32.const 1) + ) + ) +) +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (table $0 5 5 funcref) + (table $1 5 5 funcref) + (elem (table $1) (global.get $g) func $foo) + (global $g (mut i32) (i32.const 1)) + (func $foo (param $0 i32) (param $1 i32) + (unreachable) + ) + (func $bar (param $x i32) (param $y i32) + (call_indirect $1 (type $i32_i32_=>_none) (local.get $x) (local.get $y) (i32.const 1) @@ -110,7 +150,7 @@ (unreachable) ) (func $bar (param $x i32) (param $y i32) (param $z i32) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (local.get $x) (local.get $y) (local.get $z) diff --git a/test/passes/directize_all-features.wast b/test/passes/directize_all-features.wast index b113af396..d07b2d191 100644 --- a/test/passes/directize_all-features.wast +++ b/test/passes/directize_all-features.wast @@ -13,16 +13,37 @@ ) ) ) +(module + (type $ii (func (param i32 i32))) + (table $0 5 5 funcref) + (table $1 5 5 funcref) + (elem (table $0) (i32.const 1) func $dummy) + (elem (table $1) (i32.const 1) func $f) + (func $dummy (param i32) (result i32) + (local.get 0) + ) + (func $f (param i32) (param i32) + (unreachable) + ) + (func $g (param $x i32) (param $y i32) + (call_indirect $1 (type $ii) + (local.get $x) + (local.get $y) + (i32.const 1) + ) + ) +) ;; at table edges (module (type $ii (func (param i32 i32))) (table $0 5 5 funcref) - (elem (i32.const 4) $foo) + (table $1 5 5 funcref) + (elem (table $1) (i32.const 4) func $foo) (func $foo (param i32) (param i32) (unreachable) ) (func $bar (param $x i32) (param $y i32) - (call_indirect (type $ii) + (call_indirect $1 (type $ii) (local.get $x) (local.get $y) (i32.const 4) @@ -47,12 +68,14 @@ (module (type $ii (func (param i32 i32))) (table $0 5 5 funcref) + (table $1 5 5 funcref) (elem (i32.const 0) $foo $foo $foo $foo $foo) + (elem (table $1) (i32.const 0) func $foo $foo $foo $foo $foo) (func $foo (param i32) (param i32) (unreachable) ) (func $bar (param $x i32) (param $y i32) - (call_indirect (type $ii) + (call_indirect $1 (type $ii) (local.get $x) (local.get $y) (i32.const 2) @@ -109,6 +132,23 @@ ) ) ) +(module + (type $ii (func (param i32 i32))) + (table $0 5 5 funcref) + (table $1 5 5 funcref) + (global $g (mut i32) (i32.const 1)) + (elem (table $1) (global.get $g) func $foo) + (func $foo (param i32) (param i32) + (unreachable) + ) + (func $bar (param $x i32) (param $y i32) + (call_indirect $1 (type $ii) + (local.get $x) + (local.get $y) + (i32.const 1) + ) + ) +) ;; non-constant call index (module (type $ii (func (param i32 i32))) diff --git a/test/passes/flatten_all-features.txt b/test/passes/flatten_all-features.txt index e3d2ca55e..192c9ad82 100644 --- a/test/passes/flatten_all-features.txt +++ b/test/passes/flatten_all-features.txt @@ -1050,7 +1050,7 @@ (i32.const -1) (block (unreachable) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 123) (i32.const 456) (unreachable) @@ -1062,7 +1062,7 @@ (i32.const -2) (block (unreachable) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 139) (unreachable) (i32.const 0) @@ -1075,7 +1075,7 @@ (block (unreachable) (unreachable) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 246) (unreachable) (unreachable) @@ -1089,7 +1089,7 @@ (unreachable) (unreachable) (unreachable) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (unreachable) (unreachable) (unreachable) diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index 117d9baf7..75ff9dcf2 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -6,6 +6,7 @@ global [imports] : 0 [memory-data] : 9 [table-data] : 3 + [tables] : 1 [total] : 3 Const : 3 func: empty @@ -95,6 +96,7 @@ global [funcs] : 0 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 0 (module ) @@ -104,6 +106,7 @@ global [funcs] : 3 [globals] : 0 [imports] : 1 + [tables] : 0 [total] : 0 func: func_a [binary-bytes] : 16 @@ -179,6 +182,7 @@ global [funcs] : 1 [globals] : 0 [imports] : 1 + [tables] : 0 [total] : 0 func: func_a [binary-bytes] : 12 @@ -211,6 +215,7 @@ global [funcs] : 1 [globals] : 0 [imports] : 1 + [tables] : 0 [total] : 0 func: func_a [binary-bytes] : 12 @@ -239,6 +244,7 @@ global [funcs] : 1 [globals] : 1 [imports] : 1 + [tables] : 0 [total] : 1 GlobalGet : 1 func: 0 diff --git a/test/passes/fuzz_metrics_noprint.bin.txt b/test/passes/fuzz_metrics_noprint.bin.txt index fd335ce6f..d8c708f3c 100644 --- a/test/passes/fuzz_metrics_noprint.bin.txt +++ b/test/passes/fuzz_metrics_noprint.bin.txt @@ -6,6 +6,7 @@ total [imports] : 4 [memory-data] : 4 [table-data] : 16 + [tables] : 1 [total] : 9206 [vars] : 186 Binary : 715 diff --git a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt index c3dfec2dc..9a0ec41ec 100644 --- a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt +++ b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_optimize-level=3.txt @@ -276,7 +276,7 @@ i32.and i32.const 8 i32.add - call_indirect (type $f32_=>_none) + call_indirect $0 (type $f32_=>_none) ) (func $cneg (param $x f32) local.get $x @@ -285,7 +285,7 @@ i32.and i32.const 8 i32.add - call_indirect (type $f32_=>_none) + call_indirect $0 (type $f32_=>_none) ) (func $___syscall_ret (local $$0 i32) diff --git a/test/passes/metrics_all-features.txt b/test/passes/metrics_all-features.txt index 79381a62d..0a22ac945 100644 --- a/test/passes/metrics_all-features.txt +++ b/test/passes/metrics_all-features.txt @@ -6,6 +6,7 @@ total [imports] : 0 [memory-data] : 9 [table-data] : 3 + [tables] : 1 [total] : 27 [vars] : 1 Binary : 1 @@ -69,6 +70,7 @@ total [funcs] : 0 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 0 [vars] : 0 (module diff --git a/test/passes/metrics_strip-debug_metrics.bin.txt b/test/passes/metrics_strip-debug_metrics.bin.txt index f873992bb..5df5c0772 100644 --- a/test/passes/metrics_strip-debug_metrics.bin.txt +++ b/test/passes/metrics_strip-debug_metrics.bin.txt @@ -4,6 +4,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 1 [vars] : 0 Nop : 1 @@ -13,6 +14,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 1 [vars] : 0 Nop : 1 diff --git a/test/passes/metrics_strip-producers_metrics.bin.txt b/test/passes/metrics_strip-producers_metrics.bin.txt index f20d10e0b..a7ae38f9a 100644 --- a/test/passes/metrics_strip-producers_metrics.bin.txt +++ b/test/passes/metrics_strip-producers_metrics.bin.txt @@ -4,6 +4,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 1 [vars] : 0 Nop : 1 @@ -13,6 +14,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 1 [vars] : 0 Nop : 1 diff --git a/test/passes/print_g_metrics.bin.txt b/test/passes/print_g_metrics.bin.txt index 57a1d2745..ca0eeaa58 100644 --- a/test/passes/print_g_metrics.bin.txt +++ b/test/passes/print_g_metrics.bin.txt @@ -70,6 +70,7 @@ total [funcs] : 3 [globals] : 1 [imports] : 0 + [tables] : 0 [total] : 37 [vars] : 0 Binary : 11 diff --git a/test/passes/remove-unused-module-elements_all-features.txt b/test/passes/remove-unused-module-elements_all-features.txt index 0873cfee4..22751f9f5 100644 --- a/test/passes/remove-unused-module-elements_all-features.txt +++ b/test/passes/remove-unused-module-elements_all-features.txt @@ -36,40 +36,40 @@ (call $called3) ) (func $other1 (param $0 i32) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $i32_=>_none) + (call_indirect $0 (type $i32_=>_none) (i32.const 0) (i32.const 0) ) - (call_indirect (type $i32_=>_none) + (call_indirect $0 (type $i32_=>_none) (i32.const 0) (i32.const 0) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) @@ -84,10 +84,22 @@ (module ) (module + (type $none_=>_none (func)) + (import "env" "table2" (table $1 1 1 funcref)) + (elem (i32.const 0) $f) + (func $f + (nop) + ) +) +(module +) +(module +) +(module (import "env" "memory" (memory $0 256)) (import "env" "table" (table $timport$0 1 funcref)) (export "mem" (memory $0)) - (export "tab" (table $0)) + (export "tab" (table $timport$0)) ) (module (type $none_=>_none (func)) @@ -110,7 +122,7 @@ (i32.const 0) ) ) - (call_indirect (type $none_=>_none) + (call_indirect $timport$0 (type $none_=>_none) (i32.const 0) ) ) diff --git a/test/passes/remove-unused-module-elements_all-features.wast b/test/passes/remove-unused-module-elements_all-features.wast index c70dc1495..8837f91a9 100644 --- a/test/passes/remove-unused-module-elements_all-features.wast +++ b/test/passes/remove-unused-module-elements_all-features.wast @@ -73,10 +73,31 @@ (import "env" "memory" (memory $0 256)) (import "env" "table" (table 0 funcref)) ) +(module ;; remove all tables and the memory + (import "env" "memory" (memory $0 256)) + (import "env" "table" (table 0 funcref)) + (import "env" "table2" (table $1 1 2 funcref)) + (elem (table $1) (offset (i32.const 0)) func) + (elem (table $1) (offset (i32.const 1)) func) +) +(module ;; remove the first table and memory, but not the second one + (import "env" "memory" (memory $0 256)) + (import "env" "table" (table 0 funcref)) + (import "env" "table2" (table $1 1 1 funcref)) + (elem (table $1) (offset (i32.const 0)) func) + (elem (table $1) (offset (i32.const 0)) func $f) + (func $f) +) (module ;; also when not imported (memory 256) (table 1 funcref) ) +(module ;; also with multiple tables + (memory 256) + (table $0 1 funcref) + (table $1 1 funcref) + (elem (table $1) (i32.const 0) func) +) (module ;; but not when exported (import "env" "memory" (memory $0 256)) (import "env" "table" (table 1 funcref)) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index 4efda13ca..774715e02 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -694,12 +694,12 @@ (drop (i32.const 50) ) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 20) (i32.const 40) (i32.const 60) ) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (unreachable) (block (result i32) (drop @@ -717,7 +717,7 @@ (drop (i32.const 31) ) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 41) (unreachable) (block (result i32) @@ -733,7 +733,7 @@ (drop (i32.const 52) ) - (call_indirect (type $i32_i32_=>_none) + (call_indirect $0 (type $i32_i32_=>_none) (i32.const 42) (i32.const 62) (unreachable) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index 5a5406f78..76d388b23 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -51,40 +51,40 @@ (call $remove3) ) (func $other1 (param $0 i32) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $none_=>_none) + (call_indirect $0 (type $none_=>_none) (i32.const 0) ) - (call_indirect (type $i32_=>_none) + (call_indirect $0 (type $i32_=>_none) (i32.const 0) (i32.const 0) ) - (call_indirect (type $i32_=>_none) + (call_indirect $0 (type $i32_=>_none) (i32.const 0) (i32.const 0) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) ) (drop - (call_indirect (type $i32_=>_i32) + (call_indirect $0 (type $i32_=>_i32) (i32.const 0) (i32.const 0) ) @@ -102,7 +102,7 @@ (import "env" "memory" (memory $0 256)) (import "env" "table" (table $timport$0 1 funcref)) (export "mem" (memory $0)) - (export "tab" (table $0)) + (export "tab" (table $timport$0)) ) (module (type $none_=>_none (func)) @@ -125,7 +125,7 @@ (i32.const 0) ) ) - (call_indirect (type $none_=>_none) + (call_indirect $timport$0 (type $none_=>_none) (i32.const 0) ) ) @@ -306,7 +306,7 @@ (f64.const 1) (f64.const 1) ) - (call_indirect (type $f64_=>_f64) + (call_indirect $0 (type $f64_=>_f64) (f64.const 1) (i32.const 0) ) diff --git a/test/passes/too_much_for_liveness.bin.txt b/test/passes/too_much_for_liveness.bin.txt index 1d0e2df2d..6a9afb9bd 100644 --- a/test/passes/too_much_for_liveness.bin.txt +++ b/test/passes/too_much_for_liveness.bin.txt @@ -4,6 +4,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 4 [vars] : 65536 Block : 1 @@ -16,6 +17,7 @@ total [funcs] : 1 [globals] : 0 [imports] : 0 + [tables] : 0 [total] : 4 [vars] : 65536 Block : 1 diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt index 158c9b49a..36ed6b87e 100644 --- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt +++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt @@ -6,6 +6,7 @@ total [imports] : 5 [memory-data] : 22 [table-data] : 1 + [tables] : 1 [total] : 850 [vars] : 29 AtomicFence : 1 diff --git a/test/polymorphic_stack.wast.from-wast b/test/polymorphic_stack.wast.from-wast index 18b991df3..be9cb82bd 100644 --- a/test/polymorphic_stack.wast.from-wast +++ b/test/polymorphic_stack.wast.from-wast @@ -36,7 +36,7 @@ ) (drop (i64.eqz - (call_indirect (type $i32_=>_i32) + (call_indirect $timport$0 (type $i32_=>_i32) (unreachable) (unreachable) ) diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast index 3d8e70c23..29aab9bea 100644 --- a/test/reference-types.wast.from-wast +++ b/test/reference-types.wast.from-wast @@ -191,71 +191,71 @@ (call $take_anyref (ref.func $foo) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (local.get $local_externref) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (global.get $global_externref) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (ref.null extern) (i32.const 0) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (local.get $local_funcref) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (global.get $global_funcref) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.null func) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.func $foo) (i32.const 1) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_anyref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_anyref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null any) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_externref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_externref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null extern) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_funcref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_funcref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null func) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.func $foo) (i32.const 3) ) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index ae54cfcd8..5e51309ec 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -191,71 +191,71 @@ (call $take_anyref (ref.func $foo) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (local.get $local_funcref) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (global.get $global_externref) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (ref.null extern) (i32.const 0) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (local.get $local_externref) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (global.get $global_funcref) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.null func) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.func $foo) (i32.const 1) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_anyref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_anyref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null any) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_funcref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_externref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null extern) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $local_externref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global_funcref) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null func) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.func $foo) (i32.const 3) ) diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo index 08186f32b..23c2bb03b 100644 --- a/test/reference-types.wast.fromBinary.noDebugInfo +++ b/test/reference-types.wast.fromBinary.noDebugInfo @@ -191,71 +191,71 @@ (call $2 (ref.func $3) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (local.get $1) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (global.get $global$0) (i32.const 0) ) - (call_indirect (type $externref_=>_none) + (call_indirect $0 (type $externref_=>_none) (ref.null extern) (i32.const 0) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (local.get $0) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (global.get $global$1) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.null func) (i32.const 1) ) - (call_indirect (type $funcref_=>_none) + (call_indirect $0 (type $funcref_=>_none) (ref.func $3) (i32.const 1) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $2) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global$3) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null any) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $1) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global$0) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null extern) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (local.get $0) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (global.get $global$1) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.null func) (i32.const 3) ) - (call_indirect (type $anyref_=>_none) + (call_indirect $0 (type $anyref_=>_none) (ref.func $3) (i32.const 3) ) diff --git a/test/spec/old_import.wast b/test/spec/old_import.wast index 36638a994..6c5e9dcdb 100644 --- a/test/spec/old_import.wast +++ b/test/spec/old_import.wast @@ -135,10 +135,6 @@ (module (import "" "" (table 10 funcref)) (table 10 funcref)) "multiple tables" ) -(assert_invalid - (module (table 10 funcref) (table 10 funcref)) - "multiple tables" -) (assert_unlinkable (module (import "spectest" "unknown" (table 10 funcref))) diff --git a/test/tail-call.wast.from-wast b/test/tail-call.wast.from-wast index 2a08be62e..480f47a4f 100644 --- a/test/tail-call.wast.from-wast +++ b/test/tail-call.wast.from-wast @@ -6,7 +6,7 @@ (return_call $bar) ) (func $bar - (return_call_indirect (type $none_=>_none) + (return_call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) diff --git a/test/tail-call.wast.fromBinary b/test/tail-call.wast.fromBinary index 70438c907..58fad5d61 100644 --- a/test/tail-call.wast.fromBinary +++ b/test/tail-call.wast.fromBinary @@ -6,7 +6,7 @@ (return_call $bar) ) (func $bar - (return_call_indirect (type $none_=>_none) + (return_call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) diff --git a/test/tail-call.wast.fromBinary.noDebugInfo b/test/tail-call.wast.fromBinary.noDebugInfo index e7a1ab752..919626330 100644 --- a/test/tail-call.wast.fromBinary.noDebugInfo +++ b/test/tail-call.wast.fromBinary.noDebugInfo @@ -6,7 +6,7 @@ (return_call $1) ) (func $1 - (return_call_indirect (type $none_=>_none) + (return_call_indirect $0 (type $none_=>_none) (i32.const 0) ) ) |