summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c-writer.cc6
-rwxr-xr-xtest/run-spec-wasm2c.py6
-rw-r--r--test/wasm2c/old-spec/README.md7
-rw-r--r--test/wasm2c/old-spec/br_table.txt1631
-rw-r--r--test/wasm2c/old-spec/call_indirect.txt975
-rw-r--r--test/wasm2c/old-spec/elem.txt447
-rw-r--r--test/wasm2c/old-spec/exports.txt234
-rw-r--r--test/wasm2c/old-spec/imports.txt658
-rw-r--r--test/wasm2c/old-spec/linking.txt392
-rw-r--r--test/wasm2c/old-spec/select.txt490
-rw-r--r--test/wasm2c/old-spec/table.txt58
11 files changed, 4897 insertions, 7 deletions
diff --git a/src/c-writer.cc b/src/c-writer.cc
index 04fdeca9..de34cb61 100644
--- a/src/c-writer.cc
+++ b/src/c-writer.cc
@@ -1026,12 +1026,6 @@ void CWriter::WriteTables() {
return;
}
- if (!module_->types.size()) {
- // If no types are defined then there is no way to use the table
- // for anything.
- return;
- }
-
Write(Newline());
assert(module_->tables.size() <= 1);
diff --git a/test/run-spec-wasm2c.py b/test/run-spec-wasm2c.py
index 834d7914..e8b3ea63 100755
--- a/test/run-spec-wasm2c.py
+++ b/test/run-spec-wasm2c.py
@@ -383,6 +383,8 @@ def main(args):
action='store_true')
parser.add_argument('file', help='wast file.')
parser.add_argument('--enable-multi-memory', action='store_true')
+ parser.add_argument('--disable-bulk-memory', action='store_true')
+ parser.add_argument('--disable-reference-types', action='store_true')
options = parser.parse_args(args)
with utils.TempDirectory(options.out_dir, 'run-spec-wasm2c-') as out_dir:
@@ -393,7 +395,9 @@ def main(args):
wast2json.verbose = options.print_cmd
wast2json.AppendOptionalArgs({
'-v': options.verbose,
- '--enable-multi-memory': options.enable_multi_memory})
+ '--enable-multi-memory': options.enable_multi_memory,
+ '--disable-bulk-memory': options.disable_bulk_memory,
+ '--disable-reference-types': options.disable_reference_types})
json_file_path = utils.ChangeDir(
utils.ChangeExt(options.file, '.json'), out_dir)
diff --git a/test/wasm2c/old-spec/README.md b/test/wasm2c/old-spec/README.md
new file mode 100644
index 00000000..b17a2953
--- /dev/null
+++ b/test/wasm2c/old-spec/README.md
@@ -0,0 +1,7 @@
+WebAssembly spec tests from before the bulk-memory and reference-types
+proposals were merged into the testsuite (as of commit a8bcbaf in
+testsuite repository). The missing tests are tracked at
+https://github.com/WebAssembly/wabt/issues/1737
+
+These files should be deleted once wasm2c supports bulk-memory
+operations and reference-types.
diff --git a/test/wasm2c/old-spec/br_table.txt b/test/wasm2c/old-spec/br_table.txt
new file mode 100644
index 00000000..32db1f19
--- /dev/null
+++ b/test/wasm2c/old-spec/br_table.txt
@@ -0,0 +1,1631 @@
+;;; TOOL: run-spec-wasm2c
+;; Test `br_table` operator
+
+(module
+ ;; Auxiliary definition
+ (func $dummy)
+
+ (func (export "type-i32")
+ (block (drop (i32.ctz (br_table 0 0 (i32.const 0)))))
+ )
+ (func (export "type-i64")
+ (block (drop (i64.ctz (br_table 0 0 (i32.const 0)))))
+ )
+ (func (export "type-f32")
+ (block (drop (f32.neg (br_table 0 0 (i32.const 0)))))
+ )
+ (func (export "type-f64")
+ (block (drop (f64.neg (br_table 0 0 (i32.const 0)))))
+ )
+
+ (func (export "type-i32-value") (result i32)
+ (block (result i32) (i32.ctz (br_table 0 0 (i32.const 1) (i32.const 0))))
+ )
+ (func (export "type-i64-value") (result i64)
+ (block (result i64) (i64.ctz (br_table 0 0 (i64.const 2) (i32.const 0))))
+ )
+ (func (export "type-f32-value") (result f32)
+ (block (result f32) (f32.neg (br_table 0 0 (f32.const 3) (i32.const 0))))
+ )
+ (func (export "type-f64-value") (result f64)
+ (block (result f64) (f64.neg (br_table 0 0 (f64.const 4) (i32.const 0))))
+ )
+
+ (func (export "empty") (param i32) (result i32)
+ (block (br_table 0 (local.get 0)) (return (i32.const 21)))
+ (i32.const 22)
+ )
+ (func (export "empty-value") (param i32) (result i32)
+ (block (result i32)
+ (br_table 0 (i32.const 33) (local.get 0)) (i32.const 31)
+ )
+ )
+
+ (func (export "singleton") (param i32) (result i32)
+ (block
+ (block
+ (br_table 1 0 (local.get 0))
+ (return (i32.const 21))
+ )
+ (return (i32.const 20))
+ )
+ (i32.const 22)
+ )
+
+ (func (export "singleton-value") (param i32) (result i32)
+ (block (result i32)
+ (drop
+ (block (result i32)
+ (br_table 0 1 (i32.const 33) (local.get 0))
+ (return (i32.const 31))
+ )
+ )
+ (i32.const 32)
+ )
+ )
+
+ (func (export "multiple") (param i32) (result i32)
+ (block
+ (block
+ (block
+ (block
+ (block
+ (br_table 3 2 1 0 4 (local.get 0))
+ (return (i32.const 99))
+ )
+ (return (i32.const 100))
+ )
+ (return (i32.const 101))
+ )
+ (return (i32.const 102))
+ )
+ (return (i32.const 103))
+ )
+ (i32.const 104)
+ )
+
+ (func (export "multiple-value") (param i32) (result i32)
+ (local i32)
+ (local.set 1 (block (result i32)
+ (local.set 1 (block (result i32)
+ (local.set 1 (block (result i32)
+ (local.set 1 (block (result i32)
+ (local.set 1 (block (result i32)
+ (br_table 3 2 1 0 4 (i32.const 200) (local.get 0))
+ (return (i32.add (local.get 1) (i32.const 99)))
+ ))
+ (return (i32.add (local.get 1) (i32.const 10)))
+ ))
+ (return (i32.add (local.get 1) (i32.const 11)))
+ ))
+ (return (i32.add (local.get 1) (i32.const 12)))
+ ))
+ (return (i32.add (local.get 1) (i32.const 13)))
+ ))
+ (i32.add (local.get 1) (i32.const 14))
+ )
+
+ (func (export "large") (param i32) (result i32)
+ (block
+ (block
+ (br_table
+ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
+ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
+ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
+ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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(i32.const 1))
+ )
+
+ (func (export "as-block-first")
+ (block (br_table 0 0 0 (i32.const 0)) (call $dummy))
+ )
+ (func (export "as-block-mid")
+ (block (call $dummy) (br_table 0 0 0 (i32.const 0)) (call $dummy))
+ )
+ (func (export "as-block-last")
+ (block (nop) (call $dummy) (br_table 0 0 0 (i32.const 0)))
+ )
+ (func (export "as-block-value") (result i32)
+ (block (result i32)
+ (nop) (call $dummy) (br_table 0 0 0 (i32.const 2) (i32.const 0))
+ )
+ )
+
+ (func (export "as-loop-first") (result i32)
+ (loop (result i32) (br_table 1 1 (i32.const 3) (i32.const 0)) (i32.const 1))
+ )
+ (func (export "as-loop-mid") (result i32)
+ (loop (result i32)
+ (call $dummy)
+ (br_table 1 1 1 (i32.const 4) (i32.const -1))
+ (i32.const 2)
+ )
+ )
+ (func (export "as-loop-last") (result i32)
+ (loop (result i32)
+ (nop) (call $dummy) (br_table 1 1 1 (i32.const 5) (i32.const 1))
+ )
+ )
+
+ (func (export "as-br-value") (result i32)
+ (block (result i32) (br 0 (br_table 0 (i32.const 9) (i32.const 0))))
+ )
+
+ (func (export "as-br_if-cond")
+ (block (br_if 0 (br_table 0 0 0 (i32.const 1))))
+ )
+ (func (export "as-br_if-value") (result i32)
+ (block (result i32)
+ (drop (br_if 0 (br_table 0 (i32.const 8) (i32.const 0)) (i32.const 1)))
+ (i32.const 7)
+ )
+ )
+ (func (export "as-br_if-value-cond") (result i32)
+ (block (result i32)
+ (drop (br_if 0 (i32.const 6) (br_table 0 0 (i32.const 9) (i32.const 0))))
+ (i32.const 7)
+ )
+ )
+
+ (func (export "as-br_table-index")
+ (block (br_table 0 0 0 (br_table 0 (i32.const 1))))
+ )
+ (func (export "as-br_table-value") (result i32)
+ (block (result i32)
+ (br_table 0 0 0 (br_table 0 (i32.const 10) (i32.const 0)) (i32.const 1))
+ (i32.const 7)
+ )
+ )
+ (func (export "as-br_table-value-index") (result i32)
+ (block (result i32)
+ (br_table 0 0 (i32.const 6) (br_table 0 (i32.const 11) (i32.const 1)))
+ (i32.const 7)
+ )
+ )
+
+ (func (export "as-return-value") (result i64)
+ (block (result i64) (return (br_table 0 (i64.const 7) (i32.const 0))))
+ )
+
+ (func (export "as-if-cond") (result i32)
+ (block (result i32)
+ (if (result i32)
+ (br_table 0 (i32.const 2) (i32.const 0))
+ (then (i32.const 0))
+ (else (i32.const 1))
+ )
+ )
+ )
+ (func (export "as-if-then") (param i32 i32) (result i32)
+ (block (result i32)
+ (if (result i32)
+ (local.get 0)
+ (then (br_table 1 (i32.const 3) (i32.const 0)))
+ (else (local.get 1))
+ )
+ )
+ )
+ (func (export "as-if-else") (param i32 i32) (result i32)
+ (block (result i32)
+ (if (result i32)
+ (local.get 0)
+ (then (local.get 1))
+ (else (br_table 1 0 (i32.const 4) (i32.const 0)))
+ )
+ )
+ )
+
+ (func (export "as-select-first") (param i32 i32) (result i32)
+ (block (result i32)
+ (select
+ (br_table 0 (i32.const 5) (i32.const 0)) (local.get 0) (local.get 1)
+ )
+ )
+ )
+ (func (export "as-select-second") (param i32 i32) (result i32)
+ (block (result i32)
+ (select
+ (local.get 0) (br_table 0 (i32.const 6) (i32.const 1)) (local.get 1)
+ )
+ )
+ )
+ (func (export "as-select-cond") (result i32)
+ (block (result i32)
+ (select
+ (i32.const 0) (i32.const 1) (br_table 0 (i32.const 7) (i32.const 1))
+ )
+ )
+ )
+
+ (func $f (param i32 i32 i32) (result i32) (i32.const -1))
+ (func (export "as-call-first") (result i32)
+ (block (result i32)
+ (call $f
+ (br_table 0 (i32.const 12) (i32.const 1)) (i32.const 2) (i32.const 3)
+ )
+ )
+ )
+ (func (export "as-call-mid") (result i32)
+ (block (result i32)
+ (call $f
+ (i32.const 1) (br_table 0 (i32.const 13) (i32.const 1)) (i32.const 3)
+ )
+ )
+ )
+ (func (export "as-call-last") (result i32)
+ (block (result i32)
+ (call $f
+ (i32.const 1) (i32.const 2) (br_table 0 (i32.const 14) (i32.const 1))
+ )
+ )
+ )
+
+ (type $sig (func (param i32 i32 i32) (result i32)))
+ (table funcref (elem $f))
+ (func (export "as-call_indirect-first") (result i32)
+ (block (result i32)
+ (call_indirect (type $sig)
+ (br_table 0 (i32.const 20) (i32.const 1)) (i32.const 1) (i32.const 2)
+ (i32.const 3)
+ )
+ )
+ )
+ (func (export "as-call_indirect-mid") (result i32)
+ (block (result i32)
+ (call_indirect (type $sig)
+ (i32.const 0) (br_table 0 (i32.const 21) (i32.const 1)) (i32.const 2)
+ (i32.const 3)
+ )
+ )
+ )
+ (func (export "as-call_indirect-last") (result i32)
+ (block (result i32)
+ (call_indirect (type $sig)
+ (i32.const 0) (i32.const 1) (br_table 0 (i32.const 22) (i32.const 1))
+ (i32.const 3)
+ )
+ )
+ )
+ (func (export "as-call_indirect-func") (result i32)
+ (block (result i32)
+ (call_indirect (type $sig)
+ (i32.const 0) (i32.const 1) (i32.const 2)
+ (br_table 0 (i32.const 23) (i32.const 1))
+ )
+ )
+ )
+
+ (func (export "as-local.set-value") (result i32)
+ (local f32)
+ (block (result i32)
+ (local.set 0 (br_table 0 (i32.const 17) (i32.const 1)))
+ (i32.const -1)
+ )
+ )
+ (func (export "as-local.tee-value") (result i32)
+ (local i32)
+ (block (result i32)
+ (local.set 0 (br_table 0 (i32.const 1) (i32.const 1)))
+ (i32.const -1)
+ )
+ )
+ (global $a (mut i32) (i32.const 10))
+ (func (export "as-global.set-value") (result i32)
+ (block (result i32)
+ (global.set $a (br_table 0 (i32.const 1) (i32.const 1)))
+ (i32.const -1)
+ )
+ )
+
+ (memory 1)
+ (func (export "as-load-address") (result f32)
+ (block (result f32) (f32.load (br_table 0 (f32.const 1.7) (i32.const 1))))
+ )
+ (func (export "as-loadN-address") (result i64)
+ (block (result i64) (i64.load8_s (br_table 0 (i64.const 30) (i32.const 1))))
+ )
+
+ (func (export "as-store-address") (result i32)
+ (block (result i32)
+ (f64.store (br_table 0 (i32.const 30) (i32.const 1)) (f64.const 7))
+ (i32.const -1)
+ )
+ )
+ (func (export "as-store-value") (result i32)
+ (block (result i32)
+ (i64.store (i32.const 2) (br_table 0 (i32.const 31) (i32.const 1)))
+ (i32.const -1)
+ )
+ )
+
+ (func (export "as-storeN-address") (result i32)
+ (block (result i32)
+ (i32.store8 (br_table 0 (i32.const 32) (i32.const 0)) (i32.const 7))
+ (i32.const -1)
+ )
+ )
+ (func (export "as-storeN-value") (result i32)
+ (block (result i32)
+ (i64.store16 (i32.const 2) (br_table 0 (i32.const 33) (i32.const 0)))
+ (i32.const -1)
+ )
+ )
+
+ (func (export "as-unary-operand") (result f32)
+ (block (result f32) (f32.neg (br_table 0 (f32.const 3.4) (i32.const 0))))
+ )
+
+ (func (export "as-binary-left") (result i32)
+ (block (result i32)
+ (i32.add (br_table 0 0 (i32.const 3) (i32.const 0)) (i32.const 10))
+ )
+ )
+ (func (export "as-binary-right") (result i64)
+ (block (result i64)
+ (i64.sub (i64.const 10) (br_table 0 (i64.const 45) (i32.const 0)))
+ )
+ )
+
+ (func (export "as-test-operand") (result i32)
+ (block (result i32) (i32.eqz (br_table 0 (i32.const 44) (i32.const 0))))
+ )
+
+ (func (export "as-compare-left") (result i32)
+ (block (result i32)
+ (f64.le (br_table 0 0 (i32.const 43) (i32.const 0)) (f64.const 10))
+ )
+ )
+ (func (export "as-compare-right") (result i32)
+ (block (result i32)
+ (f32.ne (f32.const 10) (br_table 0 (i32.const 42) (i32.const 0)))
+ )
+ )
+
+ (func (export "as-convert-operand") (result i32)
+ (block (result i32)
+ (i32.wrap_i64 (br_table 0 (i32.const 41) (i32.const 0)))
+ )
+ )
+
+ (func (export "as-memory.grow-size") (result i32)
+ (block (result i32) (memory.grow (br_table 0 (i32.const 40) (i32.const 0))))
+ )
+
+ (func (export "nested-block-value") (param i32) (result i32)
+ (block (result i32)
+ (drop (i32.const -1))
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (i32.add
+ (i32.const 2)
+ (block (result i32)
+ (drop (i32.const 4))
+ (i32.add
+ (i32.const 8)
+ (br_table 0 1 2 (i32.const 16) (local.get 0))
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br-value") (param i32) (result i32)
+ (block (result i32)
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (drop (i32.const 2))
+ (drop
+ (block (result i32)
+ (drop (i32.const 4))
+ (br 0 (br_table 2 1 0 (i32.const 8) (local.get 0)))
+ )
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br_if-value") (param i32) (result i32)
+ (block (result i32)
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (drop (i32.const 2))
+ (drop
+ (block (result i32)
+ (drop (i32.const 4))
+ (drop
+ (br_if 0
+ (br_table 0 1 2 (i32.const 8) (local.get 0))
+ (i32.const 1)
+ )
+ )
+ (i32.const 32)
+ )
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br_if-value-cond") (param i32) (result i32)
+ (block (result i32)
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (drop (i32.const 2))
+ (drop
+ (br_if 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (local.get 0)))
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br_table-value") (param i32) (result i32)
+ (block (result i32)
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (drop (i32.const 2))
+ (drop
+ (block (result i32)
+ (drop (i32.const 4))
+ (br_table 0 (br_table 0 1 2 (i32.const 8) (local.get 0)) (i32.const 1))
+ (i32.const 32)
+ )
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br_table-value-index") (param i32) (result i32)
+ (block (result i32)
+ (i32.add
+ (i32.const 1)
+ (block (result i32)
+ (drop (i32.const 2))
+ (br_table 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (local.get 0)))
+ (i32.const 16)
+ )
+ )
+ )
+ )
+
+ (func (export "nested-br_table-loop-block") (param i32) (result i32)
+ (local.set 0
+ (loop (result i32)
+ (block
+ (br_table 1 0 0 (local.get 0))
+ )
+ (i32.const 0)
+ )
+ )
+ (loop (result i32)
+ (block
+ (br_table 0 1 1 (local.get 0))
+ )
+ (i32.const 3)
+ )
+ )
+)
+
+(assert_return (invoke "type-i32"))
+(assert_return (invoke "type-i64"))
+(assert_return (invoke "type-f32"))
+(assert_return (invoke "type-f64"))
+
+(assert_return (invoke "type-i32-value") (i32.const 1))
+(assert_return (invoke "type-i64-value") (i64.const 2))
+(assert_return (invoke "type-f32-value") (f32.const 3))
+(assert_return (invoke "type-f64-value") (f64.const 4))
+
+(assert_return (invoke "empty" (i32.const 0)) (i32.const 22))
+(assert_return (invoke "empty" (i32.const 1)) (i32.const 22))
+(assert_return (invoke "empty" (i32.const 11)) (i32.const 22))
+(assert_return (invoke "empty" (i32.const -1)) (i32.const 22))
+(assert_return (invoke "empty" (i32.const -100)) (i32.const 22))
+(assert_return (invoke "empty" (i32.const 0xffffffff)) (i32.const 22))
+
+(assert_return (invoke "empty-value" (i32.const 0)) (i32.const 33))
+(assert_return (invoke "empty-value" (i32.const 1)) (i32.const 33))
+(assert_return (invoke "empty-value" (i32.const 11)) (i32.const 33))
+(assert_return (invoke "empty-value" (i32.const -1)) (i32.const 33))
+(assert_return (invoke "empty-value" (i32.const -100)) (i32.const 33))
+(assert_return (invoke "empty-value" (i32.const 0xffffffff)) (i32.const 33))
+
+(assert_return (invoke "singleton" (i32.const 0)) (i32.const 22))
+(assert_return (invoke "singleton" (i32.const 1)) (i32.const 20))
+(assert_return (invoke "singleton" (i32.const 11)) (i32.const 20))
+(assert_return (invoke "singleton" (i32.const -1)) (i32.const 20))
+(assert_return (invoke "singleton" (i32.const -100)) (i32.const 20))
+(assert_return (invoke "singleton" (i32.const 0xffffffff)) (i32.const 20))
+
+(assert_return (invoke "singleton-value" (i32.const 0)) (i32.const 32))
+(assert_return (invoke "singleton-value" (i32.const 1)) (i32.const 33))
+(assert_return (invoke "singleton-value" (i32.const 11)) (i32.const 33))
+(assert_return (invoke "singleton-value" (i32.const -1)) (i32.const 33))
+(assert_return (invoke "singleton-value" (i32.const -100)) (i32.const 33))
+(assert_return (invoke "singleton-value" (i32.const 0xffffffff)) (i32.const 33))
+
+(assert_return (invoke "multiple" (i32.const 0)) (i32.const 103))
+(assert_return (invoke "multiple" (i32.const 1)) (i32.const 102))
+(assert_return (invoke "multiple" (i32.const 2)) (i32.const 101))
+(assert_return (invoke "multiple" (i32.const 3)) (i32.const 100))
+(assert_return (invoke "multiple" (i32.const 4)) (i32.const 104))
+(assert_return (invoke "multiple" (i32.const 5)) (i32.const 104))
+(assert_return (invoke "multiple" (i32.const 6)) (i32.const 104))
+(assert_return (invoke "multiple" (i32.const 10)) (i32.const 104))
+(assert_return (invoke "multiple" (i32.const -1)) (i32.const 104))
+(assert_return (invoke "multiple" (i32.const 0xffffffff)) (i32.const 104))
+
+(assert_return (invoke "multiple-value" (i32.const 0)) (i32.const 213))
+(assert_return (invoke "multiple-value" (i32.const 1)) (i32.const 212))
+(assert_return (invoke "multiple-value" (i32.const 2)) (i32.const 211))
+(assert_return (invoke "multiple-value" (i32.const 3)) (i32.const 210))
+(assert_return (invoke "multiple-value" (i32.const 4)) (i32.const 214))
+(assert_return (invoke "multiple-value" (i32.const 5)) (i32.const 214))
+(assert_return (invoke "multiple-value" (i32.const 6)) (i32.const 214))
+(assert_return (invoke "multiple-value" (i32.const 10)) (i32.const 214))
+(assert_return (invoke "multiple-value" (i32.const -1)) (i32.const 214))
+(assert_return (invoke "multiple-value" (i32.const 0xffffffff)) (i32.const 214))
+
+(assert_return (invoke "large" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "large" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "large" (i32.const 100)) (i32.const 0))
+(assert_return (invoke "large" (i32.const 101)) (i32.const 1))
+(assert_return (invoke "large" (i32.const 10000)) (i32.const 0))
+(assert_return (invoke "large" (i32.const 10001)) (i32.const 1))
+(assert_return (invoke "large" (i32.const 1000000)) (i32.const 1))
+(assert_return (invoke "large" (i32.const 1000001)) (i32.const 1))
+
+(assert_return (invoke "as-block-first"))
+(assert_return (invoke "as-block-mid"))
+(assert_return (invoke "as-block-last"))
+(assert_return (invoke "as-block-value") (i32.const 2))
+
+(assert_return (invoke "as-loop-first") (i32.const 3))
+(assert_return (invoke "as-loop-mid") (i32.const 4))
+(assert_return (invoke "as-loop-last") (i32.const 5))
+
+(assert_return (invoke "as-br-value") (i32.const 9))
+
+(assert_return (invoke "as-br_if-cond"))
+(assert_return (invoke "as-br_if-value") (i32.const 8))
+(assert_return (invoke "as-br_if-value-cond") (i32.const 9))
+
+(assert_return (invoke "as-br_table-index"))
+(assert_return (invoke "as-br_table-value") (i32.const 10))
+(assert_return (invoke "as-br_table-value-index") (i32.const 11))
+
+(assert_return (invoke "as-return-value") (i64.const 7))
+
+(assert_return (invoke "as-if-cond") (i32.const 2))
+(assert_return (invoke "as-if-then" (i32.const 1) (i32.const 6)) (i32.const 3))
+(assert_return (invoke "as-if-then" (i32.const 0) (i32.const 6)) (i32.const 6))
+(assert_return (invoke "as-if-else" (i32.const 0) (i32.const 6)) (i32.const 4))
+(assert_return (invoke "as-if-else" (i32.const 1) (i32.const 6)) (i32.const 6))
+
+(assert_return (invoke "as-select-first" (i32.const 0) (i32.const 6)) (i32.const 5))
+(assert_return (invoke "as-select-first" (i32.const 1) (i32.const 6)) (i32.const 5))
+(assert_return (invoke "as-select-second" (i32.const 0) (i32.const 6)) (i32.const 6))
+(assert_return (invoke "as-select-second" (i32.const 1) (i32.const 6)) (i32.const 6))
+(assert_return (invoke "as-select-cond") (i32.const 7))
+
+(assert_return (invoke "as-call-first") (i32.const 12))
+(assert_return (invoke "as-call-mid") (i32.const 13))
+(assert_return (invoke "as-call-last") (i32.const 14))
+
+(assert_return (invoke "as-call_indirect-first") (i32.const 20))
+(assert_return (invoke "as-call_indirect-mid") (i32.const 21))
+(assert_return (invoke "as-call_indirect-last") (i32.const 22))
+(assert_return (invoke "as-call_indirect-func") (i32.const 23))
+
+(assert_return (invoke "as-local.set-value") (i32.const 17))
+(assert_return (invoke "as-local.tee-value") (i32.const 1))
+(assert_return (invoke "as-global.set-value") (i32.const 1))
+
+(assert_return (invoke "as-load-address") (f32.const 1.7))
+(assert_return (invoke "as-loadN-address") (i64.const 30))
+
+(assert_return (invoke "as-store-address") (i32.const 30))
+(assert_return (invoke "as-store-value") (i32.const 31))
+(assert_return (invoke "as-storeN-address") (i32.const 32))
+(assert_return (invoke "as-storeN-value") (i32.const 33))
+
+(assert_return (invoke "as-unary-operand") (f32.const 3.4))
+
+(assert_return (invoke "as-binary-left") (i32.const 3))
+(assert_return (invoke "as-binary-right") (i64.const 45))
+
+(assert_return (invoke "as-test-operand") (i32.const 44))
+
+(assert_return (invoke "as-compare-left") (i32.const 43))
+(assert_return (invoke "as-compare-right") (i32.const 42))
+
+(assert_return (invoke "as-convert-operand") (i32.const 41))
+
+(assert_return (invoke "as-memory.grow-size") (i32.const 40))
+
+(assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 19))
+(assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 17))
+(assert_return (invoke "nested-block-value" (i32.const 2)) (i32.const 16))
+(assert_return (invoke "nested-block-value" (i32.const 10)) (i32.const 16))
+(assert_return (invoke "nested-block-value" (i32.const -1)) (i32.const 16))
+(assert_return (invoke "nested-block-value" (i32.const 100000)) (i32.const 16))
+
+(assert_return (invoke "nested-br-value" (i32.const 0)) (i32.const 8))
+(assert_return (invoke "nested-br-value" (i32.const 1)) (i32.const 9))
+(assert_return (invoke "nested-br-value" (i32.const 2)) (i32.const 17))
+(assert_return (invoke "nested-br-value" (i32.const 11)) (i32.const 17))
+(assert_return (invoke "nested-br-value" (i32.const -4)) (i32.const 17))
+(assert_return (invoke "nested-br-value" (i32.const 10213210)) (i32.const 17))
+
+(assert_return (invoke "nested-br_if-value" (i32.const 0)) (i32.const 17))
+(assert_return (invoke "nested-br_if-value" (i32.const 1)) (i32.const 9))
+(assert_return (invoke "nested-br_if-value" (i32.const 2)) (i32.const 8))
+(assert_return (invoke "nested-br_if-value" (i32.const 9)) (i32.const 8))
+(assert_return (invoke "nested-br_if-value" (i32.const -9)) (i32.const 8))
+(assert_return (invoke "nested-br_if-value" (i32.const 999999)) (i32.const 8))
+
+(assert_return (invoke "nested-br_if-value-cond" (i32.const 0)) (i32.const 9))
+(assert_return (invoke "nested-br_if-value-cond" (i32.const 1)) (i32.const 8))
+(assert_return (invoke "nested-br_if-value-cond" (i32.const 2)) (i32.const 9))
+(assert_return (invoke "nested-br_if-value-cond" (i32.const 3)) (i32.const 9))
+(assert_return (invoke "nested-br_if-value-cond" (i32.const -1000000)) (i32.const 9))
+(assert_return (invoke "nested-br_if-value-cond" (i32.const 9423975)) (i32.const 9))
+
+(assert_return (invoke "nested-br_table-value" (i32.const 0)) (i32.const 17))
+(assert_return (invoke "nested-br_table-value" (i32.const 1)) (i32.const 9))
+(assert_return (invoke "nested-br_table-value" (i32.const 2)) (i32.const 8))
+(assert_return (invoke "nested-br_table-value" (i32.const 9)) (i32.const 8))
+(assert_return (invoke "nested-br_table-value" (i32.const -9)) (i32.const 8))
+(assert_return (invoke "nested-br_table-value" (i32.const 999999)) (i32.const 8))
+
+(assert_return (invoke "nested-br_table-value-index" (i32.const 0)) (i32.const 9))
+(assert_return (invoke "nested-br_table-value-index" (i32.const 1)) (i32.const 8))
+(assert_return (invoke "nested-br_table-value-index" (i32.const 2)) (i32.const 9))
+(assert_return (invoke "nested-br_table-value-index" (i32.const 3)) (i32.const 9))
+(assert_return (invoke "nested-br_table-value-index" (i32.const -1000000)) (i32.const 9))
+(assert_return (invoke "nested-br_table-value-index" (i32.const 9423975)) (i32.const 9))
+
+(assert_return (invoke "nested-br_table-loop-block" (i32.const 1)) (i32.const 3))
+
+(assert_invalid
+ (module (func $type-arg-void-vs-num (result i32)
+ (block (br_table 0 (i32.const 1)) (i32.const 1))
+ ))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func $type-arg-empty-vs-num (result i32)
+ (block (br_table 0) (i32.const 1))
+ ))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func $type-arg-void-vs-num (result i32)
+ (block (result i32) (br_table 0 (nop) (i32.const 1)) (i32.const 1))
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-arg-num-vs-num (result i32)
+ (block (result i32)
+ (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1)
+ )
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-arg-num-vs-arg-num
+ (block
+ (block (result f32)
+ (br_table 0 1 (f32.const 0) (i32.const 0))
+ )
+ (drop)
+ )
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func
+ (block (result i32)
+ (block (result i64)
+ (br_table 0 1 (i32.const 0) (i32.const 0))
+ )
+ )
+ ))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func $type-index-void-vs-i32
+ (block (br_table 0 0 0 (nop)))
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-index-num-vs-i32
+ (block (br_table 0 (i64.const 0)))
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-arg-index-void-vs-i32 (result i32)
+ (block (result i32) (br_table 0 0 (i32.const 0) (nop)) (i32.const 1))
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-arg-void-vs-num-nested (result i32)
+ (block (result i32) (i32.const 0) (block (br_table 1 (i32.const 0))))
+ ))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-arg-index-num-vs-i32 (result i32)
+ (block (result i32)
+ (br_table 0 0 (i32.const 0) (i64.const 0)) (i32.const 1)
+ )
+ ))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func $type-arg-void-vs-num (result i32)
+ (block (br_table 0 (i32.const 1)) (i32.const 1))
+ ))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (func $type-arg-index-empty-in-then
+ (block
+ (i32.const 0) (i32.const 0)
+ (if (result i32) (then (br_table 0)))
+ )
+ (i32.eqz) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-arg-value-empty-in-then
+ (block
+ (i32.const 0) (i32.const 0)
+ (if (result i32) (then (br_table 0 (i32.const 1))))
+ )
+ (i32.eqz) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-arg-index-empty-in-return
+ (block (result i32)
+ (return (br_table 0))
+ )
+ (i32.eqz) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-arg-value-empty-in-return
+ (block (result i32)
+ (return (br_table 0 (i32.const 1)))
+ )
+ (i32.eqz) (drop)
+ )
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (func (param i32) (result i32)
+ (loop (result i32)
+ (block (result i32)
+ (br_table 0 1 (i32.const 1) (local.get 0))
+ )
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func (param i32) (result i32)
+ (block (result i32)
+ (loop (result i32)
+ (br_table 0 1 (i32.const 1) (local.get 0))
+ )
+ )
+ )
+ )
+ "type mismatch"
+)
+
+
+(assert_invalid
+ (module (func $unbound-label
+ (block (br_table 2 1 (i32.const 1)))
+ ))
+ "unknown label"
+)
+(assert_invalid
+ (module (func $unbound-nested-label
+ (block (block (br_table 0 5 (i32.const 1))))
+ ))
+ "unknown label"
+)
+(assert_invalid
+ (module (func $large-label
+ (block (br_table 0 0x10000001 0 (i32.const 1)))
+ ))
+ "unknown label"
+)
+
+(assert_invalid
+ (module (func $unbound-label-default
+ (block (br_table 1 2 (i32.const 1)))
+ ))
+ "unknown label"
+)
+(assert_invalid
+ (module (func $unbound-nested-label-default
+ (block (block (br_table 0 5 (i32.const 1))))
+ ))
+ "unknown label"
+)
+(assert_invalid
+ (module (func $large-label-default
+ (block (br_table 0 0 0x10000001 (i32.const 1)))
+ ))
+ "unknown label"
+)
+(;; STDOUT ;;;
+146/146 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/call_indirect.txt b/test/wasm2c/old-spec/call_indirect.txt
new file mode 100644
index 00000000..b9e2b39c
--- /dev/null
+++ b/test/wasm2c/old-spec/call_indirect.txt
@@ -0,0 +1,975 @@
+;;; TOOL: run-spec-wasm2c
+;; Test `call_indirect` operator
+
+(module
+ ;; Auxiliary definitions
+ (type $proc (func))
+ (type $out-i32 (func (result i32)))
+ (type $out-i64 (func (result i64)))
+ (type $out-f32 (func (result f32)))
+ (type $out-f64 (func (result f64)))
+ (type $out-f64-i32 (func (result f64 i32)))
+ (type $over-i32 (func (param i32) (result i32)))
+ (type $over-i64 (func (param i64) (result i64)))
+ (type $over-f32 (func (param f32) (result f32)))
+ (type $over-f64 (func (param f64) (result f64)))
+ (type $over-i32-f64 (func (param i32 f64) (result i32 f64)))
+ (type $swap-i32-i64 (func (param i32 i64) (result i64 i32)))
+ (type $f32-i32 (func (param f32 i32) (result i32)))
+ (type $i32-i64 (func (param i32 i64) (result i64)))
+ (type $f64-f32 (func (param f64 f32) (result f32)))
+ (type $i64-f64 (func (param i64 f64) (result f64)))
+ (type $over-i32-duplicate (func (param i32) (result i32)))
+ (type $over-i64-duplicate (func (param i64) (result i64)))
+ (type $over-f32-duplicate (func (param f32) (result f32)))
+ (type $over-f64-duplicate (func (param f64) (result f64)))
+
+ (func $const-i32 (type $out-i32) (i32.const 0x132))
+ (func $const-i64 (type $out-i64) (i64.const 0x164))
+ (func $const-f32 (type $out-f32) (f32.const 0xf32))
+ (func $const-f64 (type $out-f64) (f64.const 0xf64))
+ (func $const-f64-i32 (type $out-f64-i32) (f64.const 0xf64) (i32.const 32))
+
+ (func $id-i32 (type $over-i32) (local.get 0))
+ (func $id-i64 (type $over-i64) (local.get 0))
+ (func $id-f32 (type $over-f32) (local.get 0))
+ (func $id-f64 (type $over-f64) (local.get 0))
+ (func $id-i32-f64 (type $over-i32-f64) (local.get 0) (local.get 1))
+ (func $swap-i32-i64 (type $swap-i32-i64) (local.get 1) (local.get 0))
+
+ (func $i32-i64 (type $i32-i64) (local.get 1))
+ (func $i64-f64 (type $i64-f64) (local.get 1))
+ (func $f32-i32 (type $f32-i32) (local.get 1))
+ (func $f64-f32 (type $f64-f32) (local.get 1))
+
+ (func $over-i32-duplicate (type $over-i32-duplicate) (local.get 0))
+ (func $over-i64-duplicate (type $over-i64-duplicate) (local.get 0))
+ (func $over-f32-duplicate (type $over-f32-duplicate) (local.get 0))
+ (func $over-f64-duplicate (type $over-f64-duplicate) (local.get 0))
+
+ (table funcref
+ (elem
+ $const-i32 $const-i64 $const-f32 $const-f64 ;; 0..3
+ $id-i32 $id-i64 $id-f32 $id-f64 ;; 4..7
+ $f32-i32 $i32-i64 $f64-f32 $i64-f64 ;; 9..11
+ $fac-i64 $fib-i64 $even $odd ;; 12..15
+ $runaway $mutual-runaway1 $mutual-runaway2 ;; 16..18
+ $over-i32-duplicate $over-i64-duplicate ;; 19..20
+ $over-f32-duplicate $over-f64-duplicate ;; 21..22
+ $fac-i32 $fac-f32 $fac-f64 ;; 23..25
+ $fib-i32 $fib-f32 $fib-f64 ;; 26..28
+ $const-f64-i32 $id-i32-f64 $swap-i32-i64 ;; 29..31
+ )
+ )
+
+ ;; Syntax
+
+ (func
+ (call_indirect (i32.const 0))
+ (call_indirect (param i64) (i64.const 0) (i32.const 0))
+ (call_indirect (param i64) (param) (param f64 i32 i64)
+ (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (i32.const 0)
+ )
+ (call_indirect (result) (i32.const 0))
+ (drop (i32.eqz (call_indirect (result i32) (i32.const 0))))
+ (drop (i32.eqz (call_indirect (result i32) (result) (i32.const 0))))
+ (drop (i32.eqz
+ (call_indirect (param i64) (result i32) (i64.const 0) (i32.const 0))
+ ))
+ (drop (i32.eqz
+ (call_indirect
+ (param) (param i64) (param) (param f64 i32 i64) (param) (param)
+ (result) (result i32) (result) (result)
+ (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (i32.const 0)
+ )
+ ))
+ (drop (i64.eqz
+ (call_indirect (type $over-i64) (param i64) (result i64)
+ (i64.const 0) (i32.const 0)
+ )
+ ))
+ )
+
+ ;; Typing
+
+ (func (export "type-i32") (result i32)
+ (call_indirect (type $out-i32) (i32.const 0))
+ )
+ (func (export "type-i64") (result i64)
+ (call_indirect (type $out-i64) (i32.const 1))
+ )
+ (func (export "type-f32") (result f32)
+ (call_indirect (type $out-f32) (i32.const 2))
+ )
+ (func (export "type-f64") (result f64)
+ (call_indirect (type $out-f64) (i32.const 3))
+ )
+ (func (export "type-f64-i32") (result f64 i32)
+ (call_indirect (type $out-f64-i32) (i32.const 29))
+ )
+
+ (func (export "type-index") (result i64)
+ (call_indirect (type $over-i64) (i64.const 100) (i32.const 5))
+ )
+
+ (func (export "type-first-i32") (result i32)
+ (call_indirect (type $over-i32) (i32.const 32) (i32.const 4))
+ )
+ (func (export "type-first-i64") (result i64)
+ (call_indirect (type $over-i64) (i64.const 64) (i32.const 5))
+ )
+ (func (export "type-first-f32") (result f32)
+ (call_indirect (type $over-f32) (f32.const 1.32) (i32.const 6))
+ )
+ (func (export "type-first-f64") (result f64)
+ (call_indirect (type $over-f64) (f64.const 1.64) (i32.const 7))
+ )
+
+ (func (export "type-second-i32") (result i32)
+ (call_indirect (type $f32-i32) (f32.const 32.1) (i32.const 32) (i32.const 8))
+ )
+ (func (export "type-second-i64") (result i64)
+ (call_indirect (type $i32-i64) (i32.const 32) (i64.const 64) (i32.const 9))
+ )
+ (func (export "type-second-f32") (result f32)
+ (call_indirect (type $f64-f32) (f64.const 64) (f32.const 32) (i32.const 10))
+ )
+ (func (export "type-second-f64") (result f64)
+ (call_indirect (type $i64-f64) (i64.const 64) (f64.const 64.1) (i32.const 11))
+ )
+
+ (func (export "type-all-f64-i32") (result f64 i32)
+ (call_indirect (type $out-f64-i32) (i32.const 29))
+ )
+ (func (export "type-all-i32-f64") (result i32 f64)
+ (call_indirect (type $over-i32-f64)
+ (i32.const 1) (f64.const 2) (i32.const 30)
+ )
+ )
+ (func (export "type-all-i32-i64") (result i64 i32)
+ (call_indirect (type $swap-i32-i64)
+ (i32.const 1) (i64.const 2) (i32.const 31)
+ )
+ )
+
+ ;; Dispatch
+
+ (func (export "dispatch") (param i32 i64) (result i64)
+ (call_indirect (type $over-i64) (local.get 1) (local.get 0))
+ )
+
+ (func (export "dispatch-structural-i64") (param i32) (result i64)
+ (call_indirect (type $over-i64-duplicate) (i64.const 9) (local.get 0))
+ )
+ (func (export "dispatch-structural-i32") (param i32) (result i32)
+ (call_indirect (type $over-i32-duplicate) (i32.const 9) (local.get 0))
+ )
+ (func (export "dispatch-structural-f32") (param i32) (result f32)
+ (call_indirect (type $over-f32-duplicate) (f32.const 9.0) (local.get 0))
+ )
+ (func (export "dispatch-structural-f64") (param i32) (result f64)
+ (call_indirect (type $over-f64-duplicate) (f64.const 9.0) (local.get 0))
+ )
+
+ ;; Recursion
+
+ (func $fac-i64 (export "fac-i64") (type $over-i64)
+ (if (result i64) (i64.eqz (local.get 0))
+ (then (i64.const 1))
+ (else
+ (i64.mul
+ (local.get 0)
+ (call_indirect (type $over-i64)
+ (i64.sub (local.get 0) (i64.const 1))
+ (i32.const 12)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fib-i64 (export "fib-i64") (type $over-i64)
+ (if (result i64) (i64.le_u (local.get 0) (i64.const 1))
+ (then (i64.const 1))
+ (else
+ (i64.add
+ (call_indirect (type $over-i64)
+ (i64.sub (local.get 0) (i64.const 2))
+ (i32.const 13)
+ )
+ (call_indirect (type $over-i64)
+ (i64.sub (local.get 0) (i64.const 1))
+ (i32.const 13)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fac-i32 (export "fac-i32") (type $over-i32)
+ (if (result i32) (i32.eqz (local.get 0))
+ (then (i32.const 1))
+ (else
+ (i32.mul
+ (local.get 0)
+ (call_indirect (type $over-i32)
+ (i32.sub (local.get 0) (i32.const 1))
+ (i32.const 23)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fac-f32 (export "fac-f32") (type $over-f32)
+ (if (result f32) (f32.eq (local.get 0) (f32.const 0.0))
+ (then (f32.const 1.0))
+ (else
+ (f32.mul
+ (local.get 0)
+ (call_indirect (type $over-f32)
+ (f32.sub (local.get 0) (f32.const 1.0))
+ (i32.const 24)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fac-f64 (export "fac-f64") (type $over-f64)
+ (if (result f64) (f64.eq (local.get 0) (f64.const 0.0))
+ (then (f64.const 1.0))
+ (else
+ (f64.mul
+ (local.get 0)
+ (call_indirect (type $over-f64)
+ (f64.sub (local.get 0) (f64.const 1.0))
+ (i32.const 25)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fib-i32 (export "fib-i32") (type $over-i32)
+ (if (result i32) (i32.le_u (local.get 0) (i32.const 1))
+ (then (i32.const 1))
+ (else
+ (i32.add
+ (call_indirect (type $over-i32)
+ (i32.sub (local.get 0) (i32.const 2))
+ (i32.const 26)
+ )
+ (call_indirect (type $over-i32)
+ (i32.sub (local.get 0) (i32.const 1))
+ (i32.const 26)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fib-f32 (export "fib-f32") (type $over-f32)
+ (if (result f32) (f32.le (local.get 0) (f32.const 1.0))
+ (then (f32.const 1.0))
+ (else
+ (f32.add
+ (call_indirect (type $over-f32)
+ (f32.sub (local.get 0) (f32.const 2.0))
+ (i32.const 27)
+ )
+ (call_indirect (type $over-f32)
+ (f32.sub (local.get 0) (f32.const 1.0))
+ (i32.const 27)
+ )
+ )
+ )
+ )
+ )
+
+ (func $fib-f64 (export "fib-f64") (type $over-f64)
+ (if (result f64) (f64.le (local.get 0) (f64.const 1.0))
+ (then (f64.const 1.0))
+ (else
+ (f64.add
+ (call_indirect (type $over-f64)
+ (f64.sub (local.get 0) (f64.const 2.0))
+ (i32.const 28)
+ )
+ (call_indirect (type $over-f64)
+ (f64.sub (local.get 0) (f64.const 1.0))
+ (i32.const 28)
+ )
+ )
+ )
+ )
+ )
+
+ (func $even (export "even") (param i32) (result i32)
+ (if (result i32) (i32.eqz (local.get 0))
+ (then (i32.const 44))
+ (else
+ (call_indirect (type $over-i32)
+ (i32.sub (local.get 0) (i32.const 1))
+ (i32.const 15)
+ )
+ )
+ )
+ )
+ (func $odd (export "odd") (param i32) (result i32)
+ (if (result i32) (i32.eqz (local.get 0))
+ (then (i32.const 99))
+ (else
+ (call_indirect (type $over-i32)
+ (i32.sub (local.get 0) (i32.const 1))
+ (i32.const 14)
+ )
+ )
+ )
+ )
+
+ ;; Stack exhaustion
+
+ ;; Implementations are required to have every call consume some abstract
+ ;; resource towards exhausting some abstract finite limit, such that
+ ;; infinitely recursive test cases reliably trap in finite time. This is
+ ;; because otherwise applications could come to depend on it on those
+ ;; implementations and be incompatible with implementations that don't do
+ ;; it (or don't do it under the same circumstances).
+
+ (func $runaway (export "runaway") (call_indirect (type $proc) (i32.const 16)))
+
+ (func $mutual-runaway1 (export "mutual-runaway") (call_indirect (type $proc) (i32.const 18)))
+ (func $mutual-runaway2 (call_indirect (type $proc) (i32.const 17)))
+
+ ;; As parameter of control constructs and instructions
+
+ (memory 1)
+
+ (func (export "as-select-first") (result i32)
+ (select (call_indirect (type $out-i32) (i32.const 0)) (i32.const 2) (i32.const 3))
+ )
+ (func (export "as-select-mid") (result i32)
+ (select (i32.const 2) (call_indirect (type $out-i32) (i32.const 0)) (i32.const 3))
+ )
+ (func (export "as-select-last") (result i32)
+ (select (i32.const 2) (i32.const 3) (call_indirect (type $out-i32) (i32.const 0)))
+ )
+
+ (func (export "as-if-condition") (result i32)
+ (if (result i32) (call_indirect (type $out-i32) (i32.const 0)) (then (i32.const 1)) (else (i32.const 2)))
+ )
+
+ (func (export "as-br_if-first") (result i64)
+ (block (result i64) (br_if 0 (call_indirect (type $out-i64) (i32.const 1)) (i32.const 2)))
+ )
+ (func (export "as-br_if-last") (result i32)
+ (block (result i32) (br_if 0 (i32.const 2) (call_indirect (type $out-i32) (i32.const 0))))
+ )
+
+ (func (export "as-br_table-first") (result f32)
+ (block (result f32) (call_indirect (type $out-f32) (i32.const 2)) (i32.const 2) (br_table 0 0))
+ )
+ (func (export "as-br_table-last") (result i32)
+ (block (result i32) (i32.const 2) (call_indirect (type $out-i32) (i32.const 0)) (br_table 0 0))
+ )
+
+ (func (export "as-store-first")
+ (call_indirect (type $out-i32) (i32.const 0)) (i32.const 1) (i32.store)
+ )
+ (func (export "as-store-last")
+ (i32.const 10) (call_indirect (type $out-f64) (i32.const 3)) (f64.store)
+ )
+
+ (func (export "as-memory.grow-value") (result i32)
+ (memory.grow (call_indirect (type $out-i32) (i32.const 0)))
+ )
+ (func (export "as-return-value") (result i32)
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) (return)
+ )
+ (func (export "as-drop-operand")
+ (call_indirect (type $over-i64) (i64.const 1) (i32.const 5)) (drop)
+ )
+ (func (export "as-br-value") (result f32)
+ (block (result f32) (br 0 (call_indirect (type $over-f32) (f32.const 1) (i32.const 6))))
+ )
+ (func (export "as-local.set-value") (result f64)
+ (local f64) (local.set 0 (call_indirect (type $over-f64) (f64.const 1) (i32.const 7))) (local.get 0)
+ )
+ (func (export "as-local.tee-value") (result f64)
+ (local f64) (local.tee 0 (call_indirect (type $over-f64) (f64.const 1) (i32.const 7)))
+ )
+ (global $a (mut f64) (f64.const 10.0))
+ (func (export "as-global.set-value") (result f64)
+ (global.set $a (call_indirect (type $over-f64) (f64.const 1.0) (i32.const 7)))
+ (global.get $a)
+ )
+
+ (func (export "as-load-operand") (result i32)
+ (i32.load (call_indirect (type $out-i32) (i32.const 0)))
+ )
+
+ (func (export "as-unary-operand") (result f32)
+ (block (result f32)
+ (f32.sqrt
+ (call_indirect (type $over-f32) (f32.const 0x0p+0) (i32.const 6))
+ )
+ )
+ )
+
+ (func (export "as-binary-left") (result i32)
+ (block (result i32)
+ (i32.add
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ (i32.const 10)
+ )
+ )
+ )
+ (func (export "as-binary-right") (result i32)
+ (block (result i32)
+ (i32.sub
+ (i32.const 10)
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ )
+ )
+ )
+
+ (func (export "as-test-operand") (result i32)
+ (block (result i32)
+ (i32.eqz
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ )
+ )
+ )
+
+ (func (export "as-compare-left") (result i32)
+ (block (result i32)
+ (i32.le_u
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ (i32.const 10)
+ )
+ )
+ )
+ (func (export "as-compare-right") (result i32)
+ (block (result i32)
+ (i32.ne
+ (i32.const 10)
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ )
+ )
+ )
+
+ (func (export "as-convert-operand") (result i64)
+ (block (result i64)
+ (i64.extend_i32_s
+ (call_indirect (type $over-i32) (i32.const 1) (i32.const 4))
+ )
+ )
+ )
+
+)
+
+(assert_return (invoke "type-i32") (i32.const 0x132))
+(assert_return (invoke "type-i64") (i64.const 0x164))
+(assert_return (invoke "type-f32") (f32.const 0xf32))
+(assert_return (invoke "type-f64") (f64.const 0xf64))
+(assert_return (invoke "type-f64-i32") (f64.const 0xf64) (i32.const 32))
+
+(assert_return (invoke "type-index") (i64.const 100))
+
+(assert_return (invoke "type-first-i32") (i32.const 32))
+(assert_return (invoke "type-first-i64") (i64.const 64))
+(assert_return (invoke "type-first-f32") (f32.const 1.32))
+(assert_return (invoke "type-first-f64") (f64.const 1.64))
+
+(assert_return (invoke "type-second-i32") (i32.const 32))
+(assert_return (invoke "type-second-i64") (i64.const 64))
+(assert_return (invoke "type-second-f32") (f32.const 32))
+(assert_return (invoke "type-second-f64") (f64.const 64.1))
+
+(assert_return (invoke "type-all-f64-i32") (f64.const 0xf64) (i32.const 32))
+(assert_return (invoke "type-all-i32-f64") (i32.const 1) (f64.const 2))
+(assert_return (invoke "type-all-i32-i64") (i64.const 2) (i32.const 1))
+
+(assert_return (invoke "dispatch" (i32.const 5) (i64.const 2)) (i64.const 2))
+(assert_return (invoke "dispatch" (i32.const 5) (i64.const 5)) (i64.const 5))
+(assert_return (invoke "dispatch" (i32.const 12) (i64.const 5)) (i64.const 120))
+(assert_return (invoke "dispatch" (i32.const 13) (i64.const 5)) (i64.const 8))
+(assert_return (invoke "dispatch" (i32.const 20) (i64.const 2)) (i64.const 2))
+(assert_trap (invoke "dispatch" (i32.const 0) (i64.const 2)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch" (i32.const 15) (i64.const 2)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch" (i32.const 32) (i64.const 2)) "undefined element")
+(assert_trap (invoke "dispatch" (i32.const -1) (i64.const 2)) "undefined element")
+(assert_trap (invoke "dispatch" (i32.const 1213432423) (i64.const 2)) "undefined element")
+
+(assert_return (invoke "dispatch-structural-i64" (i32.const 5)) (i64.const 9))
+(assert_return (invoke "dispatch-structural-i64" (i32.const 12)) (i64.const 362880))
+(assert_return (invoke "dispatch-structural-i64" (i32.const 13)) (i64.const 55))
+(assert_return (invoke "dispatch-structural-i64" (i32.const 20)) (i64.const 9))
+(assert_trap (invoke "dispatch-structural-i64" (i32.const 11)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch-structural-i64" (i32.const 22)) "indirect call type mismatch")
+
+(assert_return (invoke "dispatch-structural-i32" (i32.const 4)) (i32.const 9))
+(assert_return (invoke "dispatch-structural-i32" (i32.const 23)) (i32.const 362880))
+(assert_return (invoke "dispatch-structural-i32" (i32.const 26)) (i32.const 55))
+(assert_return (invoke "dispatch-structural-i32" (i32.const 19)) (i32.const 9))
+(assert_trap (invoke "dispatch-structural-i32" (i32.const 9)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch-structural-i32" (i32.const 21)) "indirect call type mismatch")
+
+(assert_return (invoke "dispatch-structural-f32" (i32.const 6)) (f32.const 9.0))
+(assert_return (invoke "dispatch-structural-f32" (i32.const 24)) (f32.const 362880.0))
+(assert_return (invoke "dispatch-structural-f32" (i32.const 27)) (f32.const 55.0))
+(assert_return (invoke "dispatch-structural-f32" (i32.const 21)) (f32.const 9.0))
+(assert_trap (invoke "dispatch-structural-f32" (i32.const 8)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch-structural-f32" (i32.const 19)) "indirect call type mismatch")
+
+(assert_return (invoke "dispatch-structural-f64" (i32.const 7)) (f64.const 9.0))
+(assert_return (invoke "dispatch-structural-f64" (i32.const 25)) (f64.const 362880.0))
+(assert_return (invoke "dispatch-structural-f64" (i32.const 28)) (f64.const 55.0))
+(assert_return (invoke "dispatch-structural-f64" (i32.const 22)) (f64.const 9.0))
+(assert_trap (invoke "dispatch-structural-f64" (i32.const 10)) "indirect call type mismatch")
+(assert_trap (invoke "dispatch-structural-f64" (i32.const 18)) "indirect call type mismatch")
+
+(assert_return (invoke "fac-i64" (i64.const 0)) (i64.const 1))
+(assert_return (invoke "fac-i64" (i64.const 1)) (i64.const 1))
+(assert_return (invoke "fac-i64" (i64.const 5)) (i64.const 120))
+(assert_return (invoke "fac-i64" (i64.const 25)) (i64.const 7034535277573963776))
+
+(assert_return (invoke "fac-i32" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "fac-i32" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "fac-i32" (i32.const 5)) (i32.const 120))
+(assert_return (invoke "fac-i32" (i32.const 10)) (i32.const 3628800))
+
+(assert_return (invoke "fac-f32" (f32.const 0.0)) (f32.const 1.0))
+(assert_return (invoke "fac-f32" (f32.const 1.0)) (f32.const 1.0))
+(assert_return (invoke "fac-f32" (f32.const 5.0)) (f32.const 120.0))
+(assert_return (invoke "fac-f32" (f32.const 10.0)) (f32.const 3628800.0))
+
+(assert_return (invoke "fac-f64" (f64.const 0.0)) (f64.const 1.0))
+(assert_return (invoke "fac-f64" (f64.const 1.0)) (f64.const 1.0))
+(assert_return (invoke "fac-f64" (f64.const 5.0)) (f64.const 120.0))
+(assert_return (invoke "fac-f64" (f64.const 10.0)) (f64.const 3628800.0))
+
+(assert_return (invoke "fib-i64" (i64.const 0)) (i64.const 1))
+(assert_return (invoke "fib-i64" (i64.const 1)) (i64.const 1))
+(assert_return (invoke "fib-i64" (i64.const 2)) (i64.const 2))
+(assert_return (invoke "fib-i64" (i64.const 5)) (i64.const 8))
+(assert_return (invoke "fib-i64" (i64.const 20)) (i64.const 10946))
+
+(assert_return (invoke "fib-i32" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "fib-i32" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "fib-i32" (i32.const 2)) (i32.const 2))
+(assert_return (invoke "fib-i32" (i32.const 5)) (i32.const 8))
+(assert_return (invoke "fib-i32" (i32.const 20)) (i32.const 10946))
+
+(assert_return (invoke "fib-f32" (f32.const 0.0)) (f32.const 1.0))
+(assert_return (invoke "fib-f32" (f32.const 1.0)) (f32.const 1.0))
+(assert_return (invoke "fib-f32" (f32.const 2.0)) (f32.const 2.0))
+(assert_return (invoke "fib-f32" (f32.const 5.0)) (f32.const 8.0))
+(assert_return (invoke "fib-f32" (f32.const 20.0)) (f32.const 10946.0))
+
+(assert_return (invoke "fib-f64" (f64.const 0.0)) (f64.const 1.0))
+(assert_return (invoke "fib-f64" (f64.const 1.0)) (f64.const 1.0))
+(assert_return (invoke "fib-f64" (f64.const 2.0)) (f64.const 2.0))
+(assert_return (invoke "fib-f64" (f64.const 5.0)) (f64.const 8.0))
+(assert_return (invoke "fib-f64" (f64.const 20.0)) (f64.const 10946.0))
+
+(assert_return (invoke "even" (i32.const 0)) (i32.const 44))
+(assert_return (invoke "even" (i32.const 1)) (i32.const 99))
+(assert_return (invoke "even" (i32.const 100)) (i32.const 44))
+(assert_return (invoke "even" (i32.const 77)) (i32.const 99))
+(assert_return (invoke "odd" (i32.const 0)) (i32.const 99))
+(assert_return (invoke "odd" (i32.const 1)) (i32.const 44))
+(assert_return (invoke "odd" (i32.const 200)) (i32.const 99))
+(assert_return (invoke "odd" (i32.const 77)) (i32.const 44))
+
+(assert_exhaustion (invoke "runaway") "call stack exhausted")
+(assert_exhaustion (invoke "mutual-runaway") "call stack exhausted")
+
+(assert_return (invoke "as-select-first") (i32.const 0x132))
+(assert_return (invoke "as-select-mid") (i32.const 2))
+(assert_return (invoke "as-select-last") (i32.const 2))
+
+(assert_return (invoke "as-if-condition") (i32.const 1))
+
+(assert_return (invoke "as-br_if-first") (i64.const 0x164))
+(assert_return (invoke "as-br_if-last") (i32.const 2))
+
+(assert_return (invoke "as-br_table-first") (f32.const 0xf32))
+(assert_return (invoke "as-br_table-last") (i32.const 2))
+
+(assert_return (invoke "as-store-first"))
+(assert_return (invoke "as-store-last"))
+
+(assert_return (invoke "as-memory.grow-value") (i32.const 1))
+(assert_return (invoke "as-return-value") (i32.const 1))
+(assert_return (invoke "as-drop-operand"))
+(assert_return (invoke "as-br-value") (f32.const 1))
+(assert_return (invoke "as-local.set-value") (f64.const 1))
+(assert_return (invoke "as-local.tee-value") (f64.const 1))
+(assert_return (invoke "as-global.set-value") (f64.const 1.0))
+(assert_return (invoke "as-load-operand") (i32.const 1))
+
+(assert_return (invoke "as-unary-operand") (f32.const 0x0p+0))
+(assert_return (invoke "as-binary-left") (i32.const 11))
+(assert_return (invoke "as-binary-right") (i32.const 9))
+(assert_return (invoke "as-test-operand") (i32.const 0))
+(assert_return (invoke "as-compare-left") (i32.const 1))
+(assert_return (invoke "as-compare-right") (i32.const 1))
+(assert_return (invoke "as-convert-operand") (i64.const 1))
+
+;; Invalid syntax
+
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (type $sig) (result i32) (param i32)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (param i32) (type $sig) (result i32)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (param i32) (result i32) (type $sig)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (result i32) (type $sig) (param i32)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (result i32) (param i32) (type $sig)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (result i32) (param i32) (i32.const 0) (i32.const 0))"
+ ")"
+ )
+ "unexpected token"
+)
+
+(assert_malformed
+ (module quote
+ "(table 0 funcref)"
+ "(func (call_indirect (param $x i32) (i32.const 0) (i32.const 0)))"
+ )
+ "unexpected token"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (type $sig) (result i32) (i32.const 0))"
+ ")"
+ )
+ "inline function type"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (type $sig) (result i32) (i32.const 0))"
+ ")"
+ )
+ "inline function type"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func"
+ " (call_indirect (type $sig) (param i32) (i32.const 0) (i32.const 0))"
+ ")"
+ )
+ "inline function type"
+)
+(assert_malformed
+ (module quote
+ "(type $sig (func (param i32 i32) (result i32)))"
+ "(table 0 funcref)"
+ "(func (result i32)"
+ " (call_indirect (type $sig) (param i32) (result i32)"
+ " (i32.const 0) (i32.const 0)"
+ " )"
+ ")"
+ )
+ "inline function type"
+)
+
+;; Invalid typing
+
+(assert_invalid
+ (module
+ (type (func))
+ (func $no-table (call_indirect (type 0) (i32.const 0)))
+ )
+ "unknown table"
+)
+
+(assert_invalid
+ (module
+ (type (func))
+ (table 0 funcref)
+ (func $type-void-vs-num (i32.eqz (call_indirect (type 0) (i32.const 0))))
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (result i64)))
+ (table 0 funcref)
+ (func $type-num-vs-num (i32.eqz (call_indirect (type 0) (i32.const 0))))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (type (func (param i32)))
+ (table 0 funcref)
+ (func $arity-0-vs-1 (call_indirect (type 0) (i32.const 0)))
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (param f64 i32)))
+ (table 0 funcref)
+ (func $arity-0-vs-2 (call_indirect (type 0) (i32.const 0)))
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func))
+ (table 0 funcref)
+ (func $arity-1-vs-0 (call_indirect (type 0) (i32.const 1) (i32.const 0)))
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func))
+ (table 0 funcref)
+ (func $arity-2-vs-0
+ (call_indirect (type 0) (f64.const 2) (i32.const 1) (i32.const 0))
+ )
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (type (func (param i32)))
+ (table 0 funcref)
+ (func $type-func-void-vs-i32 (call_indirect (type 0) (i32.const 1) (nop)))
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (param i32)))
+ (table 0 funcref)
+ (func $type-func-num-vs-i32 (call_indirect (type 0) (i32.const 0) (i64.const 1)))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (type (func (param i32 i32)))
+ (table 0 funcref)
+ (func $type-first-void-vs-num
+ (call_indirect (type 0) (nop) (i32.const 1) (i32.const 0))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (param i32 i32)))
+ (table 0 funcref)
+ (func $type-second-void-vs-num
+ (call_indirect (type 0) (i32.const 1) (nop) (i32.const 0))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (param i32 f64)))
+ (table 0 funcref)
+ (func $type-first-num-vs-num
+ (call_indirect (type 0) (f64.const 1) (i32.const 1) (i32.const 0))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (type (func (param f64 i32)))
+ (table 0 funcref)
+ (func $type-second-num-vs-num
+ (call_indirect (type 0) (i32.const 1) (f64.const 1) (i32.const 0))
+ )
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (func $f (param i32))
+ (type $sig (func (param i32)))
+ (table funcref (elem $f))
+ (func $type-first-empty-in-block
+ (block
+ (call_indirect (type $sig) (i32.const 0))
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $f (param i32 i32))
+ (type $sig (func (param i32 i32)))
+ (table funcref (elem $f))
+ (func $type-second-empty-in-block
+ (block
+ (call_indirect (type $sig) (i32.const 0) (i32.const 0))
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $f (param i32))
+ (type $sig (func (param i32)))
+ (table funcref (elem $f))
+ (func $type-first-empty-in-loop
+ (loop
+ (call_indirect (type $sig) (i32.const 0))
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $f (param i32 i32))
+ (type $sig (func (param i32 i32)))
+ (table funcref (elem $f))
+ (func $type-second-empty-in-loop
+ (loop
+ (call_indirect (type $sig) (i32.const 0) (i32.const 0))
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $f (param i32))
+ (type $sig (func (param i32)))
+ (table funcref (elem $f))
+ (func $type-first-empty-in-then
+ (i32.const 0) (i32.const 0)
+ (if
+ (then
+ (call_indirect (type $sig) (i32.const 0))
+ )
+ )
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $f (param i32 i32))
+ (type $sig (func (param i32 i32)))
+ (table funcref (elem $f))
+ (func $type-second-empty-in-then
+ (i32.const 0) (i32.const 0)
+ (if
+ (then
+ (call_indirect (type $sig) (i32.const 0) (i32.const 0))
+ )
+ )
+ )
+ )
+ "type mismatch"
+)
+
+
+;; Unbound type
+
+(assert_invalid
+ (module
+ (table 0 funcref)
+ (func $unbound-type (call_indirect (type 1) (i32.const 0)))
+ )
+ "unknown type"
+)
+(assert_invalid
+ (module
+ (table 0 funcref)
+ (func $large-type (call_indirect (type 1012321300) (i32.const 0)))
+ )
+ "unknown type"
+)
+
+
+;; Unbound function in table
+
+(assert_invalid
+ (module (table funcref (elem 0 0)))
+ "unknown function"
+)
+(;; STDOUT ;;;
+122/122 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/elem.txt b/test/wasm2c/old-spec/elem.txt
new file mode 100644
index 00000000..982f0747
--- /dev/null
+++ b/test/wasm2c/old-spec/elem.txt
@@ -0,0 +1,447 @@
+;;; TOOL: run-spec-wasm2c
+;;; ARGS*: --disable-bulk-memory --disable-reference-types
+;; Test the element section
+
+;; Syntax
+(module
+ (table $t 10 funcref)
+ (func $f)
+ (elem (i32.const 0))
+ (elem (i32.const 0) $f $f)
+ (elem (offset (i32.const 0)))
+ (elem (offset (i32.const 0)) $f $f)
+ (elem 0 (i32.const 0))
+ (elem 0x0 (i32.const 0) $f $f)
+ (elem 0x000 (offset (i32.const 0)))
+ (elem 0 (offset (i32.const 0)) $f $f)
+ (elem $t (i32.const 0))
+ (elem $t (i32.const 0) $f $f)
+ (elem $t (offset (i32.const 0)))
+ (elem $t (offset (i32.const 0)) $f $f)
+)
+
+;; Basic use
+
+(module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const 0) $f)
+)
+(module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const 0) $f)
+)
+
+(module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const 0) $f)
+ (elem (i32.const 3) $f)
+ (elem (i32.const 7) $f)
+ (elem (i32.const 5) $f)
+ (elem (i32.const 3) $f)
+)
+(module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const 9) $f)
+ (elem (i32.const 3) $f)
+ (elem (i32.const 7) $f)
+ (elem (i32.const 3) $f)
+ (elem (i32.const 5) $f)
+)
+
+(module
+ (global (import "spectest" "global_i32") i32)
+ (table 1000 funcref)
+ (func $f)
+ (elem (global.get 0) $f)
+)
+
+(module
+ (global $g (import "spectest" "global_i32") i32)
+ (table 1000 funcref)
+ (func $f)
+ (elem (global.get $g) $f)
+)
+
+(module
+ (type $out-i32 (func (result i32)))
+ (table 10 funcref)
+ (elem (i32.const 7) $const-i32-a)
+ (elem (i32.const 9) $const-i32-b)
+ (func $const-i32-a (type $out-i32) (i32.const 65))
+ (func $const-i32-b (type $out-i32) (i32.const 66))
+ (func (export "call-7") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 7))
+ )
+ (func (export "call-9") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 9))
+ )
+)
+(assert_return (invoke "call-7") (i32.const 65))
+(assert_return (invoke "call-9") (i32.const 66))
+
+;; Corner cases
+
+(module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const 9) $f)
+)
+(module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const 9) $f)
+)
+
+(module
+ (table 0 funcref)
+ (elem (i32.const 0))
+)
+(module
+ (import "spectest" "table" (table 0 funcref))
+ (elem (i32.const 0))
+)
+
+(module
+ (table 0 0 funcref)
+ (elem (i32.const 0))
+)
+
+(module
+ (table 20 funcref)
+ (elem (i32.const 20))
+)
+
+(module
+ (import "spectest" "table" (table 0 funcref))
+ (func $f)
+ (elem (i32.const 0) $f)
+)
+
+(module
+ (import "spectest" "table" (table 0 100 funcref))
+ (func $f)
+ (elem (i32.const 0) $f)
+)
+
+(module
+ (import "spectest" "table" (table 0 funcref))
+ (func $f)
+ (elem (i32.const 1) $f)
+)
+
+(module
+ (import "spectest" "table" (table 0 30 funcref))
+ (func $f)
+ (elem (i32.const 1) $f)
+)
+
+;; Invalid bounds for elements
+
+(assert_unlinkable
+ (module
+ (table 0 funcref)
+ (func $f)
+ (elem (i32.const 0) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 0 0 funcref)
+ (func $f)
+ (elem (i32.const 0) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 0 1 funcref)
+ (func $f)
+ (elem (i32.const 0) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 0 funcref)
+ (elem (i32.const 1))
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const 10) $f)
+ )
+ "elements segment does not fit"
+)
+(assert_unlinkable
+ (module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const 10) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 10 20 funcref)
+ (func $f)
+ (elem (i32.const 10) $f)
+ )
+ "elements segment does not fit"
+)
+(assert_unlinkable
+ (module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const 10) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const -1) $f)
+ )
+ "elements segment does not fit"
+)
+(assert_unlinkable
+ (module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const -1) $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table 10 funcref)
+ (func $f)
+ (elem (i32.const -10) $f)
+ )
+ "elements segment does not fit"
+)
+(assert_unlinkable
+ (module
+ (import "spectest" "table" (table 10 funcref))
+ (func $f)
+ (elem (i32.const -10) $f)
+ )
+ "elements segment does not fit"
+)
+
+;; Element without table
+
+(assert_invalid
+ (module
+ (func $f)
+ (elem (i32.const 0) $f)
+ )
+ "unknown table"
+)
+
+;; Invalid offsets
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (i64.const 0))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (offset (;empty instruction sequence;)))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (offset (i32.const 0) (i32.const 0)))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (global (import "test" "global-i32") i32)
+ (table 1 funcref)
+ (elem (offset (global.get 0) (global.get 0)))
+ )
+ "type mismatch"
+)
+
+(assert_invalid
+ (module
+ (global (import "test" "global-i32") i32)
+ (table 1 funcref)
+ (elem (offset (global.get 0) (i32.const 0)))
+ )
+ "type mismatch"
+)
+
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (i32.ctz (i32.const 0)))
+ )
+ "constant expression required"
+)
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (nop))
+ )
+ "constant expression required"
+)
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (offset (nop) (i32.const 0)))
+ )
+ "constant expression required"
+)
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (offset (i32.const 0) (nop)))
+ )
+ "constant expression required"
+)
+
+;; Use of internal globals in constant expressions is not allowed in MVP.
+;; (assert_invalid
+;; (module (memory 1) (data (global.get $g)) (global $g (mut i32) (i32.const 0)))
+;; "constant expression required"
+;; )
+
+(assert_invalid
+ (module
+ (table 1 funcref)
+ (elem (global.get 0))
+ )
+ "unknown global 0"
+)
+
+(assert_invalid
+ (module
+ (global (import "test" "global-i32") i32)
+ (table 1 funcref)
+ (elem (global.get 1))
+ )
+ "unknown global 1"
+)
+
+(assert_invalid
+ (module
+ (global (import "test" "global-mut-i32") (mut i32))
+ (table 1 funcref)
+ (elem (global.get 0))
+ )
+ "constant expression required"
+)
+
+;; Two elements target the same slot
+
+(module
+ (type $out-i32 (func (result i32)))
+ (table 10 funcref)
+ (elem (i32.const 9) $const-i32-a)
+ (elem (i32.const 9) $const-i32-b)
+ (func $const-i32-a (type $out-i32) (i32.const 65))
+ (func $const-i32-b (type $out-i32) (i32.const 66))
+ (func (export "call-overwritten") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 9))
+ )
+)
+(assert_return (invoke "call-overwritten") (i32.const 66))
+
+(module
+ (type $out-i32 (func (result i32)))
+ (import "spectest" "table" (table 10 funcref))
+ (elem (i32.const 9) $const-i32-a)
+ (elem (i32.const 9) $const-i32-b)
+ (func $const-i32-a (type $out-i32) (i32.const 65))
+ (func $const-i32-b (type $out-i32) (i32.const 66))
+ (func (export "call-overwritten-element") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 9))
+ )
+)
+(assert_return (invoke "call-overwritten-element") (i32.const 66))
+
+;; Element sections across multiple modules change the same table
+
+(module $module1
+ (type $out-i32 (func (result i32)))
+ (table (export "shared-table") 10 funcref)
+ (elem (i32.const 8) $const-i32-a)
+ (elem (i32.const 9) $const-i32-b)
+ (func $const-i32-a (type $out-i32) (i32.const 65))
+ (func $const-i32-b (type $out-i32) (i32.const 66))
+ (func (export "call-7") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 7))
+ )
+ (func (export "call-8") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 8))
+ )
+ (func (export "call-9") (type $out-i32)
+ (call_indirect (type $out-i32) (i32.const 9))
+ )
+)
+
+(register "module1" $module1)
+
+(assert_trap (invoke $module1 "call-7") "uninitialized element")
+(assert_return (invoke $module1 "call-8") (i32.const 65))
+(assert_return (invoke $module1 "call-9") (i32.const 66))
+
+(module $module2
+ (type $out-i32 (func (result i32)))
+ (import "module1" "shared-table" (table 10 funcref))
+ (elem (i32.const 7) $const-i32-c)
+ (elem (i32.const 8) $const-i32-d)
+ (func $const-i32-c (type $out-i32) (i32.const 67))
+ (func $const-i32-d (type $out-i32) (i32.const 68))
+)
+
+(assert_return (invoke $module1 "call-7") (i32.const 67))
+(assert_return (invoke $module1 "call-8") (i32.const 68))
+(assert_return (invoke $module1 "call-9") (i32.const 66))
+
+(module $module3
+ (type $out-i32 (func (result i32)))
+ (import "module1" "shared-table" (table 10 funcref))
+ (elem (i32.const 8) $const-i32-e)
+ (elem (i32.const 9) $const-i32-f)
+ (func $const-i32-e (type $out-i32) (i32.const 69))
+ (func $const-i32-f (type $out-i32) (i32.const 70))
+)
+
+(assert_return (invoke $module1 "call-7") (i32.const 67))
+(assert_return (invoke $module1 "call-8") (i32.const 69))
+(assert_return (invoke $module1 "call-9") (i32.const 70))
+(;; STDOUT ;;;
+13/13 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/exports.txt b/test/wasm2c/old-spec/exports.txt
new file mode 100644
index 00000000..e91db4fc
--- /dev/null
+++ b/test/wasm2c/old-spec/exports.txt
@@ -0,0 +1,234 @@
+;;; TOOL: run-spec-wasm2c
+;; Functions
+
+(module (func) (export "a" (func 0)))
+(module (func) (export "a" (func 0)) (export "b" (func 0)))
+(module (func) (func) (export "a" (func 0)) (export "b" (func 1)))
+
+(module (func (export "a")))
+(module (func (export "a") (export "b") (export "c")))
+(module (func (export "a") (export "b") (param i32)))
+(module (func) (export "a" (func 0)))
+(module (func $a (export "a")))
+(module (func $a) (export "a" (func $a)))
+(module (export "a" (func 0)) (func))
+(module (export "a" (func $a)) (func $a))
+
+(module $Func
+ (export "e" (func $f))
+ (func $f (param $n i32) (result i32)
+ (return (i32.add (local.get $n) (i32.const 1)))
+ )
+)
+(assert_return (invoke "e" (i32.const 42)) (i32.const 43))
+(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))
+(module)
+(module $Other1)
+(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))
+
+(assert_invalid
+ (module (export "a" (func 0)))
+ "unknown function"
+)
+(assert_invalid
+ (module (func) (export "a" (func 1)))
+ "unknown function"
+)
+(assert_invalid
+ (module (import "spectest" "print_i32" (func (param i32))) (export "a" (func 1)))
+ "unknown function"
+)
+(assert_invalid
+ (module (func) (export "a" (func 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (func) (export "a" (func 0)) (export "a" (func 1)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (global i32 (i32.const 0)) (export "a" (func 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (table 0 funcref) (export "a" (func 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Globals
+
+(module (global i32 (i32.const 0)) (export "a" (global 0)))
+(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 0)))
+(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 1)))
+
+(module (global (export "a") i32 (i32.const 0)))
+(module (global i32 (i32.const 0)) (export "a" (global 0)))
+(module (global $a (export "a") i32 (i32.const 0)))
+(module (global $a i32 (i32.const 0)) (export "a" (global $a)))
+(module (export "a" (global 0)) (global i32 (i32.const 0)))
+(module (export "a" (global $a)) (global $a i32 (i32.const 0)))
+
+(module $Global
+ (export "e" (global $g))
+ (global $g i32 (i32.const 42))
+)
+(assert_return (get "e") (i32.const 42))
+(assert_return (get $Global "e") (i32.const 42))
+(module)
+(module $Other2)
+(assert_return (get $Global "e") (i32.const 42))
+
+(assert_invalid
+ (module (export "a" (global 0)))
+ "unknown global"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (export "a" (global 1)))
+ "unknown global"
+)
+(assert_invalid
+ (module (import "spectest" "global_i32" (global i32)) (export "a" (global 1)))
+ "unknown global"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 1)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (func) (export "a" (global 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (table 0 funcref) (export "a" (global 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Tables
+
+(module (table 0 funcref) (export "a" (table 0)))
+(module (table 0 funcref) (export "a" (table 0)) (export "b" (table 0)))
+;; No multiple tables yet.
+;; (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "b" (table 1)))
+
+(module (table (export "a") 0 funcref))
+(module (table (export "a") 0 1 funcref))
+(module (table 0 funcref) (export "a" (table 0)))
+(module (table 0 1 funcref) (export "a" (table 0)))
+(module (table $a (export "a") 0 funcref))
+(module (table $a (export "a") 0 1 funcref))
+(module (table $a 0 funcref) (export "a" (table $a)))
+(module (table $a 0 1 funcref) (export "a" (table $a)))
+(module (export "a" (table 0)) (table 0 funcref))
+(module (export "a" (table 0)) (table 0 1 funcref))
+(module (export "a" (table $a)) (table $a 0 funcref))
+(module (export "a" (table $a)) (table $a 0 1 funcref))
+
+(; TODO: access table ;)
+
+(assert_invalid
+ (module (export "a" (table 0)))
+ "unknown table"
+)
+(assert_invalid
+ (module (table 0 funcref) (export "a" (table 1)))
+ "unknown table"
+)
+(assert_invalid
+ (module (import "spectest" "table" (table 10 20 funcref)) (export "a" (table 1)))
+ "unknown table"
+)
+(assert_invalid
+ (module (table 0 funcref) (export "a" (table 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+;; No multiple tables yet.
+;; (assert_invalid
+;; (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "a" (table 1)))
+;; "duplicate export name"
+;; )
+(assert_invalid
+ (module (table 0 funcref) (func) (export "a" (table 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (table 0 funcref) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (table 0 funcref) (memory 0) (export "a" (table 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Memories
+
+(module (memory 0) (export "a" (memory 0)))
+(module (memory 0) (export "a" (memory 0)) (export "b" (memory 0)))
+;; No multiple memories yet.
+;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1)))
+
+(module (memory (export "a") 0))
+(module (memory (export "a") 0 1))
+(module (memory 0) (export "a" (memory 0)))
+(module (memory 0 1) (export "a" (memory 0)))
+(module (memory $a (export "a") 0))
+(module (memory $a (export "a") 0 1))
+(module (memory $a 0) (export "a" (memory $a)))
+(module (memory $a 0 1) (export "a" (memory $a)))
+(module (export "a" (memory 0)) (memory 0))
+(module (export "a" (memory 0)) (memory 0 1))
+(module (export "a" (memory $a)) (memory $a 0))
+(module (export "a" (memory $a)) (memory $a 0 1))
+
+(; TODO: access memory ;)
+
+(assert_invalid
+ (module (export "a" (memory 0)))
+ "unknown memory"
+)
+(assert_invalid
+ (module (memory 0) (export "a" (memory 1)))
+ "unknown memory"
+)
+(assert_invalid
+ (module (import "spectest" "memory" (memory 1 2)) (export "a" (memory 1)))
+ "unknown memory"
+)
+(assert_invalid
+ (module (memory 0) (export "a" (memory 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+;; No multiple memories yet.
+;; (assert_invalid
+;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1)))
+;; "duplicate export name"
+;; )
+(assert_invalid
+ (module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (memory 0) (table 0 funcref) (export "a" (memory 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+(;; STDOUT ;;;
+6/6 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/imports.txt b/test/wasm2c/old-spec/imports.txt
new file mode 100644
index 00000000..56aa363d
--- /dev/null
+++ b/test/wasm2c/old-spec/imports.txt
@@ -0,0 +1,658 @@
+;;; TOOL: run-spec-wasm2c
+;; Auxiliary module to import from
+
+(module
+ (func (export "func"))
+ (func (export "func-i32") (param i32))
+ (func (export "func-f32") (param f32))
+ (func (export "func->i32") (result i32) (i32.const 22))
+ (func (export "func->f32") (result f32) (f32.const 11))
+ (func (export "func-i32->i32") (param i32) (result i32) (local.get 0))
+ (func (export "func-i64->i64") (param i64) (result i64) (local.get 0))
+ (global (export "global-i32") i32 (i32.const 55))
+ (global (export "global-f32") f32 (f32.const 44))
+ (global (export "global-mut-i64") (mut i64) (i64.const 66))
+ (table (export "table-10-inf") 10 funcref)
+ ;; (table (export "table-10-20") 10 20 funcref)
+ (memory (export "memory-2-inf") 2)
+ ;; (memory (export "memory-2-4") 2 4)
+)
+
+(register "test")
+
+
+;; Functions
+
+(module
+ (type $func_i32 (func (param i32)))
+ (type $func_i64 (func (param i64)))
+ (type $func_f32 (func (param f32)))
+ (type $func_f64 (func (param f64)))
+
+ (import "spectest" "print_i32" (func (param i32)))
+ ;; JavaScript can't handle i64 yet.
+ ;; (func (import "spectest" "print_i64") (param i64))
+ (import "spectest" "print_i32" (func $print_i32 (param i32)))
+ ;; JavaScript can't handle i64 yet.
+ ;; (import "spectest" "print_i64" (func $print_i64 (param i64)))
+ (import "spectest" "print_f32" (func $print_f32 (param f32)))
+ (import "spectest" "print_f64" (func $print_f64 (param f64)))
+ (import "spectest" "print_i32_f32" (func $print_i32_f32 (param i32 f32)))
+ (import "spectest" "print_f64_f64" (func $print_f64_f64 (param f64 f64)))
+ (func $print_i32-2 (import "spectest" "print_i32") (param i32))
+ (func $print_f64-2 (import "spectest" "print_f64") (param f64))
+ (import "test" "func-i64->i64" (func $i64->i64 (param i64) (result i64)))
+
+ (func (export "p1") (import "spectest" "print_i32") (param i32))
+ (func $p (export "p2") (import "spectest" "print_i32") (param i32))
+ (func (export "p3") (export "p4") (import "spectest" "print_i32") (param i32))
+ (func (export "p5") (import "spectest" "print_i32") (type 0))
+ (func (export "p6") (import "spectest" "print_i32") (type 0) (param i32) (result))
+
+ (import "spectest" "print_i32" (func (type $forward)))
+ (func (import "spectest" "print_i32") (type $forward))
+ (type $forward (func (param i32)))
+
+ (table funcref (elem $print_i32 $print_f64))
+
+ (func (export "print32") (param $i i32)
+ (local $x f32)
+ (local.set $x (f32.convert_i32_s (local.get $i)))
+ (call 0 (local.get $i))
+ (call $print_i32_f32
+ (i32.add (local.get $i) (i32.const 1))
+ (f32.const 42)
+ )
+ (call $print_i32 (local.get $i))
+ (call $print_i32-2 (local.get $i))
+ (call $print_f32 (local.get $x))
+ (call_indirect (type $func_i32) (local.get $i) (i32.const 0))
+ )
+
+ (func (export "print64") (param $i i64)
+ (local $x f64)
+ (local.set $x (f64.convert_i64_s (call $i64->i64 (local.get $i))))
+ ;; JavaScript can't handle i64 yet.
+ ;; (call 1 (local.get $i))
+ (call $print_f64_f64
+ (f64.add (local.get $x) (f64.const 1))
+ (f64.const 53)
+ )
+ ;; JavaScript can't handle i64 yet.
+ ;; (call $print_i64 (local.get $i))
+ (call $print_f64 (local.get $x))
+ (call $print_f64-2 (local.get $x))
+ (call_indirect (type $func_f64) (local.get $x) (i32.const 1))
+ )
+)
+
+(assert_return (invoke "print32" (i32.const 13)))
+(assert_return (invoke "print64" (i64.const 24)))
+
+(assert_invalid
+ (module
+ (type (func (result i32)))
+ (import "test" "func" (func (type 1)))
+ )
+ "unknown type"
+)
+
+(module (import "test" "func" (func)))
+(module (import "test" "func-i32" (func (param i32))))
+(module (import "test" "func-f32" (func (param f32))))
+(module (import "test" "func->i32" (func (result i32))))
+(module (import "test" "func->f32" (func (result f32))))
+(module (import "test" "func-i32->i32" (func (param i32) (result i32))))
+(module (import "test" "func-i64->i64" (func (param i64) (result i64))))
+
+(assert_unlinkable
+ (module (import "test" "unknown" (func)))
+ "unknown import"
+)
+(assert_unlinkable
+ (module (import "spectest" "unknown" (func)))
+ "unknown import"
+)
+
+(assert_unlinkable
+ (module (import "test" "func" (func (param i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func" (func (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func" (func (param i32) (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32" (func (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32" (func (param f32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32" (func (param i64))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32" (func (param i32) (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func->i32" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func->i32" (func (param i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func->i32" (func (result f32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func->i32" (func (result i64))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func->i32" (func (param i32) (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32->i32" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32->i32" (func (param i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "func-i32->i32" (func (result i32))))
+ "incompatible import type"
+)
+
+(assert_unlinkable
+ (module (import "test" "global-i32" (func (result i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "table-10-inf" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "memory-2-inf" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "global_i32" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "table" (func)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "memory" (func)))
+ "incompatible import type"
+)
+
+
+;; Globals
+
+(module
+ (import "spectest" "global_i32" (global i32))
+ (global (import "spectest" "global_i32") i32)
+
+ (import "spectest" "global_i32" (global $x i32))
+ (global $y (import "spectest" "global_i32") i32)
+
+ ;; JavaScript can't handle i64 yet.
+ ;; (import "spectest" "global_i64" (global i64))
+ (import "spectest" "global_f32" (global f32))
+ (import "spectest" "global_f64" (global f64))
+
+ (func (export "get-0") (result i32) (global.get 0))
+ (func (export "get-1") (result i32) (global.get 1))
+ (func (export "get-x") (result i32) (global.get $x))
+ (func (export "get-y") (result i32) (global.get $y))
+)
+
+(assert_return (invoke "get-0") (i32.const 666))
+(assert_return (invoke "get-1") (i32.const 666))
+(assert_return (invoke "get-x") (i32.const 666))
+(assert_return (invoke "get-y") (i32.const 666))
+
+(module (import "test" "global-i32" (global i32)))
+(module (import "test" "global-f32" (global f32)))
+(module (import "test" "global-mut-i64" (global (mut i64))))
+
+(assert_unlinkable
+ (module (import "test" "unknown" (global i32)))
+ "unknown import"
+)
+(assert_unlinkable
+ (module (import "spectest" "unknown" (global i32)))
+ "unknown import"
+)
+
+(assert_unlinkable
+ (module (import "test" "global-i32" (global i64)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-i32" (global f32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-i32" (global f64)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-i32" (global (mut i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-f32" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-f32" (global i64)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-f32" (global f64)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-f32" (global (mut f32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-mut-i64" (global (mut i32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-mut-i64" (global (mut f32))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-mut-i64" (global (mut f64))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-mut-i64" (global i64)))
+ "incompatible import type"
+)
+
+(assert_unlinkable
+ (module (import "test" "func" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "table-10-inf" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "memory-2-inf" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "print_i32" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "table" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "memory" (global i32)))
+ "incompatible import type"
+)
+
+
+;; Tables
+
+(module
+ (type (func (result i32)))
+ (import "spectest" "table" (table 10 20 funcref))
+ (elem 0 (i32.const 1) $f $g)
+
+ (func (export "call") (param i32) (result i32)
+ (call_indirect (type 0) (local.get 0))
+ )
+ (func $f (result i32) (i32.const 11))
+ (func $g (result i32) (i32.const 22))
+)
+
+(assert_trap (invoke "call" (i32.const 0)) "uninitialized element")
+(assert_return (invoke "call" (i32.const 1)) (i32.const 11))
+(assert_return (invoke "call" (i32.const 2)) (i32.const 22))
+(assert_trap (invoke "call" (i32.const 3)) "uninitialized element")
+(assert_trap (invoke "call" (i32.const 100)) "undefined element")
+
+
+(module
+ (type (func (result i32)))
+ (table (import "spectest" "table") 10 20 funcref)
+ (elem 0 (i32.const 1) $f $g)
+
+ (func (export "call") (param i32) (result i32)
+ (call_indirect (type 0) (local.get 0))
+ )
+ (func $f (result i32) (i32.const 11))
+ (func $g (result i32) (i32.const 22))
+)
+
+(assert_trap (invoke "call" (i32.const 0)) "uninitialized element")
+(assert_return (invoke "call" (i32.const 1)) (i32.const 11))
+(assert_return (invoke "call" (i32.const 2)) (i32.const 22))
+(assert_trap (invoke "call" (i32.const 3)) "uninitialized element")
+(assert_trap (invoke "call" (i32.const 100)) "undefined element")
+
+
+(assert_invalid
+ (module (import "" "" (table 10 funcref)) (import "" "" (table 10 funcref)))
+ "multiple tables"
+)
+(assert_invalid
+ (module (import "" "" (table 10 funcref)) (table 10 funcref))
+ "multiple tables"
+)
+(assert_invalid
+ (module (table 10 funcref) (table 10 funcref))
+ "multiple tables"
+)
+
+(module (import "test" "table-10-inf" (table 10 funcref)))
+(module (import "test" "table-10-inf" (table 5 funcref)))
+(module (import "test" "table-10-inf" (table 0 funcref)))
+(module (import "spectest" "table" (table 10 funcref)))
+(module (import "spectest" "table" (table 5 funcref)))
+(module (import "spectest" "table" (table 0 funcref)))
+(module (import "spectest" "table" (table 10 20 funcref)))
+(module (import "spectest" "table" (table 5 20 funcref)))
+(module (import "spectest" "table" (table 0 20 funcref)))
+(module (import "spectest" "table" (table 10 25 funcref)))
+(module (import "spectest" "table" (table 5 25 funcref)))
+
+(assert_unlinkable
+ (module (import "test" "unknown" (table 10 funcref)))
+ "unknown import"
+)
+(assert_unlinkable
+ (module (import "spectest" "unknown" (table 10 funcref)))
+ "unknown import"
+)
+
+(assert_unlinkable
+ (module (import "test" "table-10-inf" (table 12 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "table-10-inf" (table 10 20 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "table" (table 12 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "table" (table 10 15 funcref)))
+ "incompatible import type"
+)
+
+(assert_unlinkable
+ (module (import "test" "func" (table 10 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-i32" (table 10 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "memory-2-inf" (table 10 funcref)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "print_i32" (table 10 funcref)))
+ "incompatible import type"
+)
+
+
+
+;; Memories
+
+(module
+ (import "spectest" "memory" (memory 1 2))
+ (data 0 (i32.const 10) "\10")
+
+ (func (export "load") (param i32) (result i32) (i32.load (local.get 0)))
+)
+
+(assert_return (invoke "load" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "load" (i32.const 10)) (i32.const 16))
+(assert_return (invoke "load" (i32.const 8)) (i32.const 0x100000))
+(assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access")
+
+(module
+ (memory (import "spectest" "memory") 1 2)
+ (data 0 (i32.const 10) "\10")
+
+ (func (export "load") (param i32) (result i32) (i32.load (local.get 0)))
+)
+(assert_return (invoke "load" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "load" (i32.const 10)) (i32.const 16))
+(assert_return (invoke "load" (i32.const 8)) (i32.const 0x100000))
+(assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access")
+
+(assert_invalid
+ (module (import "" "" (memory 1)) (import "" "" (memory 1)))
+ "multiple memories"
+)
+(assert_invalid
+ (module (import "" "" (memory 1)) (memory 0))
+ "multiple memories"
+)
+(assert_invalid
+ (module (memory 0) (memory 0))
+ "multiple memories"
+)
+
+(module (import "test" "memory-2-inf" (memory 2)))
+(module (import "test" "memory-2-inf" (memory 1)))
+(module (import "test" "memory-2-inf" (memory 0)))
+(module (import "spectest" "memory" (memory 1)))
+(module (import "spectest" "memory" (memory 0)))
+(module (import "spectest" "memory" (memory 1 2)))
+(module (import "spectest" "memory" (memory 0 2)))
+(module (import "spectest" "memory" (memory 1 3)))
+(module (import "spectest" "memory" (memory 0 3)))
+
+(assert_unlinkable
+ (module (import "test" "unknown" (memory 1)))
+ "unknown import"
+)
+(assert_unlinkable
+ (module (import "spectest" "unknown" (memory 1)))
+ "unknown import"
+)
+
+(assert_unlinkable
+ (module (import "test" "memory-2-inf" (memory 3)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "memory-2-inf" (memory 2 3)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "memory" (memory 2)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "memory" (memory 1 1)))
+ "incompatible import type"
+)
+
+(assert_unlinkable
+ (module (import "test" "func-i32" (memory 1)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "global-i32" (memory 1)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "test" "table-10-inf" (memory 1)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "print_i32" (memory 1)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "global_i32" (memory 1)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "table" (memory 1)))
+ "incompatible import type"
+)
+
+(assert_unlinkable
+ (module (import "spectest" "memory" (memory 2)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "spectest" "memory" (memory 1 1)))
+ "incompatible import type"
+)
+
+(module
+ (import "spectest" "memory" (memory 0 3)) ;; actual has max size 2
+ (func (export "grow") (param i32) (result i32) (memory.grow (local.get 0)))
+)
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "grow" (i32.const 1)) (i32.const -1))
+(assert_return (invoke "grow" (i32.const 0)) (i32.const 2))
+
+
+;; Syntax errors
+
+(assert_malformed
+ (module quote "(func) (import \"\" \"\" (func))")
+ "import after function"
+)
+(assert_malformed
+ (module quote "(func) (import \"\" \"\" (global i64))")
+ "import after function"
+)
+(assert_malformed
+ (module quote "(func) (import \"\" \"\" (table 0 funcref))")
+ "import after function"
+)
+(assert_malformed
+ (module quote "(func) (import \"\" \"\" (memory 0))")
+ "import after function"
+)
+
+(assert_malformed
+ (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (func))")
+ "import after global"
+)
+(assert_malformed
+ (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (global f32))")
+ "import after global"
+)
+(assert_malformed
+ (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (table 0 funcref))")
+ "import after global"
+)
+(assert_malformed
+ (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (memory 0))")
+ "import after global"
+)
+
+(assert_malformed
+ (module quote "(table 0 funcref) (import \"\" \"\" (func))")
+ "import after table"
+)
+(assert_malformed
+ (module quote "(table 0 funcref) (import \"\" \"\" (global i32))")
+ "import after table"
+)
+(assert_malformed
+ (module quote "(table 0 funcref) (import \"\" \"\" (table 0 funcref))")
+ "import after table"
+)
+(assert_malformed
+ (module quote "(table 0 funcref) (import \"\" \"\" (memory 0))")
+ "import after table"
+)
+
+(assert_malformed
+ (module quote "(memory 0) (import \"\" \"\" (func))")
+ "import after memory"
+)
+(assert_malformed
+ (module quote "(memory 0) (import \"\" \"\" (global i32))")
+ "import after memory"
+)
+(assert_malformed
+ (module quote "(memory 0) (import \"\" \"\" (table 1 3 funcref))")
+ "import after memory"
+)
+(assert_malformed
+ (module quote "(memory 0) (import \"\" \"\" (memory 1 2))")
+ "import after memory"
+)
+
+;; This module is required to validate, regardless of whether it can be
+;; linked. Overloading is not possible in wasm itself, but it is possible
+;; in modules from which wasm can import.
+(module)
+(register "not wasm")
+(assert_unlinkable
+ (module
+ (import "not wasm" "overloaded" (func))
+ (import "not wasm" "overloaded" (func (param i32)))
+ (import "not wasm" "overloaded" (func (param i32 i32)))
+ (import "not wasm" "overloaded" (func (param i64)))
+ (import "not wasm" "overloaded" (func (param f32)))
+ (import "not wasm" "overloaded" (func (param f64)))
+ (import "not wasm" "overloaded" (func (result i32)))
+ (import "not wasm" "overloaded" (func (result i64)))
+ (import "not wasm" "overloaded" (func (result f32)))
+ (import "not wasm" "overloaded" (func (result f64)))
+ (import "not wasm" "overloaded" (global i32))
+ (import "not wasm" "overloaded" (global i64))
+ (import "not wasm" "overloaded" (global f32))
+ (import "not wasm" "overloaded" (global f64))
+ (import "not wasm" "overloaded" (table 0 funcref))
+ (import "not wasm" "overloaded" (memory 0))
+ )
+ "unknown import"
+)
+(;; STDOUT ;;;
+spectest.print_i32(13)
+spectest.print_i32_f32(14 42)
+spectest.print_i32(13)
+spectest.print_i32(13)
+spectest.print_f32(13)
+spectest.print_i32(13)
+spectest.print_f64_f64(25 53)
+spectest.print_f64(24)
+spectest.print_f64(24)
+spectest.print_f64(24)
+29/29 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/linking.txt b/test/wasm2c/old-spec/linking.txt
new file mode 100644
index 00000000..8efdbbcf
--- /dev/null
+++ b/test/wasm2c/old-spec/linking.txt
@@ -0,0 +1,392 @@
+;;; TOOL: run-spec-wasm2c
+;; Functions
+
+(module $Mf
+ (func (export "call") (result i32) (call $g))
+ (func $g (result i32) (i32.const 2))
+)
+(register "Mf" $Mf)
+
+(module $Nf
+ (func $f (import "Mf" "call") (result i32))
+ (export "Mf.call" (func $f))
+ (func (export "call Mf.call") (result i32) (call $f))
+ (func (export "call") (result i32) (call $g))
+ (func $g (result i32) (i32.const 3))
+)
+
+(assert_return (invoke $Mf "call") (i32.const 2))
+(assert_return (invoke $Nf "Mf.call") (i32.const 2))
+(assert_return (invoke $Nf "call") (i32.const 3))
+(assert_return (invoke $Nf "call Mf.call") (i32.const 2))
+
+(module
+ (import "spectest" "print_i32" (func $f (param i32)))
+ (export "print" (func $f))
+)
+(register "reexport_f")
+(assert_unlinkable
+ (module (import "reexport_f" "print" (func (param i64))))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "reexport_f" "print" (func (param i32) (result i32))))
+ "incompatible import type"
+)
+
+
+;; Globals
+
+(module $Mg
+ (global $glob (export "glob") i32 (i32.const 42))
+ (func (export "get") (result i32) (global.get $glob))
+
+ ;; export mutable globals
+ (global $mut_glob (export "mut_glob") (mut i32) (i32.const 142))
+ (func (export "get_mut") (result i32) (global.get $mut_glob))
+ (func (export "set_mut") (param i32) (global.set $mut_glob (local.get 0)))
+)
+(register "Mg" $Mg)
+
+(module $Ng
+ (global $x (import "Mg" "glob") i32)
+ (global $mut_glob (import "Mg" "mut_glob") (mut i32))
+ (func $f (import "Mg" "get") (result i32))
+ (func $get_mut (import "Mg" "get_mut") (result i32))
+ (func $set_mut (import "Mg" "set_mut") (param i32))
+
+ (export "Mg.glob" (global $x))
+ (export "Mg.get" (func $f))
+ (global $glob (export "glob") i32 (i32.const 43))
+ (func (export "get") (result i32) (global.get $glob))
+
+ (export "Mg.mut_glob" (global $mut_glob))
+ (export "Mg.get_mut" (func $get_mut))
+ (export "Mg.set_mut" (func $set_mut))
+)
+
+(assert_return (get $Mg "glob") (i32.const 42))
+(assert_return (get $Ng "Mg.glob") (i32.const 42))
+(assert_return (get $Ng "glob") (i32.const 43))
+(assert_return (invoke $Mg "get") (i32.const 42))
+(assert_return (invoke $Ng "Mg.get") (i32.const 42))
+(assert_return (invoke $Ng "get") (i32.const 43))
+
+(assert_return (get $Mg "mut_glob") (i32.const 142))
+(assert_return (get $Ng "Mg.mut_glob") (i32.const 142))
+(assert_return (invoke $Mg "get_mut") (i32.const 142))
+(assert_return (invoke $Ng "Mg.get_mut") (i32.const 142))
+
+(assert_return (invoke $Mg "set_mut" (i32.const 241)))
+(assert_return (get $Mg "mut_glob") (i32.const 241))
+(assert_return (get $Ng "Mg.mut_glob") (i32.const 241))
+(assert_return (invoke $Mg "get_mut") (i32.const 241))
+(assert_return (invoke $Ng "Mg.get_mut") (i32.const 241))
+
+
+(assert_unlinkable
+ (module (import "Mg" "mut_glob" (global i32)))
+ "incompatible import type"
+)
+(assert_unlinkable
+ (module (import "Mg" "glob" (global (mut i32))))
+ "incompatible import type"
+)
+
+;; Tables
+
+(module $Mt
+ (type (func (result i32)))
+ (type (func))
+
+ (table (export "tab") 10 funcref)
+ (elem (i32.const 2) $g $g $g $g)
+ (func $g (result i32) (i32.const 4))
+ (func (export "h") (result i32) (i32.const -4))
+
+ (func (export "call") (param i32) (result i32)
+ (call_indirect (type 0) (local.get 0))
+ )
+)
+(register "Mt" $Mt)
+
+(module $Nt
+ (type (func))
+ (type (func (result i32)))
+
+ (func $f (import "Mt" "call") (param i32) (result i32))
+ (func $h (import "Mt" "h") (result i32))
+
+ (table funcref (elem $g $g $g $h $f))
+ (func $g (result i32) (i32.const 5))
+
+ (export "Mt.call" (func $f))
+ (func (export "call Mt.call") (param i32) (result i32)
+ (call $f (local.get 0))
+ )
+ (func (export "call") (param i32) (result i32)
+ (call_indirect (type 1) (local.get 0))
+ )
+)
+
+(assert_return (invoke $Mt "call" (i32.const 2)) (i32.const 4))
+(assert_return (invoke $Nt "Mt.call" (i32.const 2)) (i32.const 4))
+(assert_return (invoke $Nt "call" (i32.const 2)) (i32.const 5))
+(assert_return (invoke $Nt "call Mt.call" (i32.const 2)) (i32.const 4))
+
+(assert_trap (invoke $Mt "call" (i32.const 1)) "uninitialized")
+(assert_trap (invoke $Nt "Mt.call" (i32.const 1)) "uninitialized")
+(assert_return (invoke $Nt "call" (i32.const 1)) (i32.const 5))
+(assert_trap (invoke $Nt "call Mt.call" (i32.const 1)) "uninitialized")
+
+(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized")
+(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized")
+(assert_return (invoke $Nt "call" (i32.const 0)) (i32.const 5))
+(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized")
+
+(assert_trap (invoke $Mt "call" (i32.const 20)) "undefined")
+(assert_trap (invoke $Nt "Mt.call" (i32.const 20)) "undefined")
+(assert_trap (invoke $Nt "call" (i32.const 7)) "undefined")
+(assert_trap (invoke $Nt "call Mt.call" (i32.const 20)) "undefined")
+
+(assert_return (invoke $Nt "call" (i32.const 3)) (i32.const -4))
+(assert_trap (invoke $Nt "call" (i32.const 4)) "indirect call")
+
+(module $Ot
+ (type (func (result i32)))
+
+ (func $h (import "Mt" "h") (result i32))
+ (table (import "Mt" "tab") 5 funcref)
+ (elem (i32.const 1) $i $h)
+ (func $i (result i32) (i32.const 6))
+
+ (func (export "call") (param i32) (result i32)
+ (call_indirect (type 0) (local.get 0))
+ )
+)
+
+(assert_return (invoke $Mt "call" (i32.const 3)) (i32.const 4))
+(assert_return (invoke $Nt "Mt.call" (i32.const 3)) (i32.const 4))
+(assert_return (invoke $Nt "call Mt.call" (i32.const 3)) (i32.const 4))
+(assert_return (invoke $Ot "call" (i32.const 3)) (i32.const 4))
+
+(assert_return (invoke $Mt "call" (i32.const 2)) (i32.const -4))
+(assert_return (invoke $Nt "Mt.call" (i32.const 2)) (i32.const -4))
+(assert_return (invoke $Nt "call" (i32.const 2)) (i32.const 5))
+(assert_return (invoke $Nt "call Mt.call" (i32.const 2)) (i32.const -4))
+(assert_return (invoke $Ot "call" (i32.const 2)) (i32.const -4))
+
+(assert_return (invoke $Mt "call" (i32.const 1)) (i32.const 6))
+(assert_return (invoke $Nt "Mt.call" (i32.const 1)) (i32.const 6))
+(assert_return (invoke $Nt "call" (i32.const 1)) (i32.const 5))
+(assert_return (invoke $Nt "call Mt.call" (i32.const 1)) (i32.const 6))
+(assert_return (invoke $Ot "call" (i32.const 1)) (i32.const 6))
+
+(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized")
+(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized")
+(assert_return (invoke $Nt "call" (i32.const 0)) (i32.const 5))
+(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized")
+(assert_trap (invoke $Ot "call" (i32.const 0)) "uninitialized")
+
+(assert_trap (invoke $Ot "call" (i32.const 20)) "undefined")
+
+(module
+ (table (import "Mt" "tab") 0 funcref)
+ (elem (i32.const 9) $f)
+ (func $f)
+)
+
+(module $G1 (global (export "g") i32 (i32.const 5)))
+(register "G1" $G1)
+(module $G2
+ (global (import "G1" "g") i32)
+ (global (export "g") i32 (global.get 0))
+)
+(assert_return (get $G2 "g") (i32.const 5))
+
+(assert_unlinkable
+ (module
+ (table (import "Mt" "tab") 0 funcref)
+ (elem (i32.const 10) $f)
+ (func $f)
+ )
+ "elements segment does not fit"
+)
+
+(assert_unlinkable
+ (module
+ (table (import "Mt" "tab") 10 funcref)
+ (memory (import "Mt" "mem") 1) ;; does not exist
+ (func $f (result i32) (i32.const 0))
+ (elem (i32.const 7) $f)
+ (elem (i32.const 9) $f)
+ )
+ "unknown import"
+)
+(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
+
+(assert_unlinkable
+ (module
+ (table (import "Mt" "tab") 10 funcref)
+ (func $f (result i32) (i32.const 0))
+ (elem (i32.const 7) $f)
+ (elem (i32.const 12) $f) ;; out of bounds
+ )
+ "elements segment does not fit"
+)
+(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
+
+(assert_unlinkable
+ (module
+ (table (import "Mt" "tab") 10 funcref)
+ (func $f (result i32) (i32.const 0))
+ (elem (i32.const 7) $f)
+ (memory 1)
+ (data (i32.const 0x10000) "d") ;; out of bounds
+ )
+ "data segment does not fit"
+)
+(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
+
+
+;; Memories
+
+(module $Mm
+ (memory (export "mem") 1 5)
+ (data (i32.const 10) "\00\01\02\03\04\05\06\07\08\09")
+
+ (func (export "load") (param $a i32) (result i32)
+ (i32.load8_u (local.get 0))
+ )
+)
+(register "Mm" $Mm)
+
+(module $Nm
+ (func $loadM (import "Mm" "load") (param i32) (result i32))
+
+ (memory 1)
+ (data (i32.const 10) "\f0\f1\f2\f3\f4\f5")
+
+ (export "Mm.load" (func $loadM))
+ (func (export "load") (param $a i32) (result i32)
+ (i32.load8_u (local.get 0))
+ )
+)
+
+(assert_return (invoke $Mm "load" (i32.const 12)) (i32.const 2))
+(assert_return (invoke $Nm "Mm.load" (i32.const 12)) (i32.const 2))
+(assert_return (invoke $Nm "load" (i32.const 12)) (i32.const 0xf2))
+
+(module $Om
+ (memory (import "Mm" "mem") 1)
+ (data (i32.const 5) "\a0\a1\a2\a3\a4\a5\a6\a7")
+
+ (func (export "load") (param $a i32) (result i32)
+ (i32.load8_u (local.get 0))
+ )
+)
+
+(assert_return (invoke $Mm "load" (i32.const 12)) (i32.const 0xa7))
+(assert_return (invoke $Nm "Mm.load" (i32.const 12)) (i32.const 0xa7))
+(assert_return (invoke $Nm "load" (i32.const 12)) (i32.const 0xf2))
+(assert_return (invoke $Om "load" (i32.const 12)) (i32.const 0xa7))
+
+(module
+ (memory (import "Mm" "mem") 0)
+ (data (i32.const 0xffff) "a")
+)
+
+(assert_unlinkable
+ (module
+ (memory (import "Mm" "mem") 0)
+ (data (i32.const 0x10000) "a")
+ )
+ "data segment does not fit"
+)
+
+(module $Pm
+ (memory (import "Mm" "mem") 1 8)
+
+ (func (export "grow") (param $a i32) (result i32)
+ (memory.grow (local.get 0))
+ )
+)
+
+(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 1))
+(assert_return (invoke $Pm "grow" (i32.const 2)) (i32.const 1))
+(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 3))
+(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const 3))
+(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const 4))
+(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 5))
+(assert_return (invoke $Pm "grow" (i32.const 1)) (i32.const -1))
+(assert_return (invoke $Pm "grow" (i32.const 0)) (i32.const 5))
+
+(assert_unlinkable
+ (module
+ (func $host (import "spectest" "print"))
+ (memory (import "Mm" "mem") 1)
+ (table (import "Mm" "tab") 0 funcref) ;; does not exist
+ (data (i32.const 0) "abc")
+ )
+ "unknown import"
+)
+(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))
+
+(assert_unlinkable
+ (module
+ (memory (import "Mm" "mem") 1)
+ (data (i32.const 0) "abc")
+ (data (i32.const 0x50000) "d") ;; out of bounds
+ )
+ "data segment does not fit"
+)
+(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))
+
+(assert_unlinkable
+ (module
+ (memory (import "Mm" "mem") 1)
+ (data (i32.const 0) "abc")
+ (table 0 funcref)
+ (func)
+ (elem (i32.const 0) 0) ;; out of bounds
+ )
+ "elements segment does not fit"
+)
+(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))
+
+;; Store is modified if the start function traps.
+(module $Ms
+ (type $t (func (result i32)))
+ (memory (export "memory") 1)
+ (table (export "table") 1 funcref)
+ (func (export "get memory[0]") (type $t)
+ (i32.load8_u (i32.const 0))
+ )
+ (func (export "get table[0]") (type $t)
+ (call_indirect (type $t) (i32.const 0))
+ )
+)
+(register "Ms" $Ms)
+
+(assert_trap
+ (module
+ (import "Ms" "memory" (memory 1))
+ (import "Ms" "table" (table 1 funcref))
+ (data (i32.const 0) "hello")
+ (elem (i32.const 0) $f)
+ (func $f (result i32)
+ (i32.const 0xdead)
+ )
+ (func $main
+ (unreachable)
+ )
+ (start $main)
+ )
+ "unreachable"
+)
+
+(assert_return (invoke $Ms "get memory[0]") (i32.const 104)) ;; 'h'
+(assert_return (invoke $Ms "get table[0]") (i32.const 0xdead))
+(;; STDOUT ;;;
+82/82 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/select.txt b/test/wasm2c/old-spec/select.txt
new file mode 100644
index 00000000..3235ac88
--- /dev/null
+++ b/test/wasm2c/old-spec/select.txt
@@ -0,0 +1,490 @@
+;;; TOOL: run-spec-wasm2c
+(module
+
+ (memory 1)
+
+ (func $dummy)
+
+ (func (export "select_i32") (param $lhs i32) (param $rhs i32) (param $cond i32) (result i32)
+ (select (local.get $lhs) (local.get $rhs) (local.get $cond)))
+
+ (func (export "select_i64") (param $lhs i64) (param $rhs i64) (param $cond i32) (result i64)
+ (select (local.get $lhs) (local.get $rhs) (local.get $cond)))
+
+ (func (export "select_f32") (param $lhs f32) (param $rhs f32) (param $cond i32) (result f32)
+ (select (local.get $lhs) (local.get $rhs) (local.get $cond)))
+
+ (func (export "select_f64") (param $lhs f64) (param $rhs f64) (param $cond i32) (result f64)
+ (select (local.get $lhs) (local.get $rhs) (local.get $cond)))
+
+ ;; Check that both sides of the select are evaluated
+ (func (export "select_trap_l") (param $cond i32) (result i32)
+ (select (unreachable) (i32.const 0) (local.get $cond))
+ )
+ (func (export "select_trap_r") (param $cond i32) (result i32)
+ (select (i32.const 0) (unreachable) (local.get $cond))
+ )
+
+ (func (export "select_unreached")
+ (unreachable) (select)
+ (unreachable) (i32.const 0) (select)
+ (unreachable) (i32.const 0) (i32.const 0) (select)
+ (unreachable) (i32.const 0) (i32.const 0) (i32.const 0) (select)
+ (unreachable) (f32.const 0) (i32.const 0) (select)
+ (unreachable)
+ )
+
+ (func (export "select_unreached_result_1") (result i32)
+ (unreachable) (i32.add (select))
+ )
+
+ (func (export "select_unreached_result_2") (result i64)
+ (unreachable) (i64.add (select (i64.const 0) (i32.const 0)))
+ )
+
+ ;; As the argument of control constructs and instructions
+
+ (func (export "as-select-first") (param i32) (result i32)
+ (select (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 2) (i32.const 3))
+ )
+ (func (export "as-select-mid") (param i32) (result i32)
+ (select (i32.const 2) (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 3))
+ )
+ (func (export "as-select-last") (param i32) (result i32)
+ (select (i32.const 2) (i32.const 3) (select (i32.const 0) (i32.const 1) (local.get 0)))
+ )
+
+ (func (export "as-loop-first") (param i32) (result i32)
+ (loop (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy) (call $dummy))
+ )
+ (func (export "as-loop-mid") (param i32) (result i32)
+ (loop (result i32) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy))
+ )
+ (func (export "as-loop-last") (param i32) (result i32)
+ (loop (result i32) (call $dummy) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0)))
+ )
+
+ (func (export "as-if-condition") (param i32)
+ (select (i32.const 2) (i32.const 3) (local.get 0)) (if (then (call $dummy)))
+ )
+ (func (export "as-if-then") (param i32) (result i32)
+ (if (result i32) (i32.const 1) (then (select (i32.const 2) (i32.const 3) (local.get 0))) (else (i32.const 4)))
+ )
+ (func (export "as-if-else") (param i32) (result i32)
+ (if (result i32) (i32.const 0) (then (i32.const 2)) (else (select (i32.const 2) (i32.const 3) (local.get 0))))
+ )
+
+ (func (export "as-br_if-first") (param i32) (result i32)
+ (block (result i32) (br_if 0 (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 4)))
+ )
+ (func (export "as-br_if-last") (param i32) (result i32)
+ (block (result i32) (br_if 0 (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0))))
+ )
+
+ (func (export "as-br_table-first") (param i32) (result i32)
+ (block (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 2) (br_table 0 0))
+ )
+ (func (export "as-br_table-last") (param i32) (result i32)
+ (block (result i32) (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)) (br_table 0 0))
+ )
+
+ (func $func (param i32 i32) (result i32) (local.get 0))
+ (type $check (func (param i32 i32) (result i32)))
+ (table funcref (elem $func))
+ (func (export "as-call_indirect-first") (param i32) (result i32)
+ (block (result i32)
+ (call_indirect (type $check)
+ (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 1) (i32.const 0)
+ )
+ )
+ )
+ (func (export "as-call_indirect-mid") (param i32) (result i32)
+ (block (result i32)
+ (call_indirect (type $check)
+ (i32.const 1) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 0)
+ )
+ )
+ )
+ (func (export "as-call_indirect-last") (param i32) (result i32)
+ (block (result i32)
+ (call_indirect (type $check)
+ (i32.const 1) (i32.const 4) (select (i32.const 2) (i32.const 3) (local.get 0))
+ )
+ )
+ )
+
+ (func (export "as-store-first") (param i32)
+ (select (i32.const 0) (i32.const 4) (local.get 0)) (i32.const 1) (i32.store)
+ )
+ (func (export "as-store-last") (param i32)
+ (i32.const 8) (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.store)
+ )
+
+ (func (export "as-memory.grow-value") (param i32) (result i32)
+ (memory.grow (select (i32.const 1) (i32.const 2) (local.get 0)))
+ )
+
+ (func $f (param i32) (result i32) (local.get 0))
+
+ (func (export "as-call-value") (param i32) (result i32)
+ (call $f (select (i32.const 1) (i32.const 2) (local.get 0)))
+ )
+ (func (export "as-return-value") (param i32) (result i32)
+ (select (i32.const 1) (i32.const 2) (local.get 0)) (return)
+ )
+ (func (export "as-drop-operand") (param i32)
+ (drop (select (i32.const 1) (i32.const 2) (local.get 0)))
+ )
+ (func (export "as-br-value") (param i32) (result i32)
+ (block (result i32) (br 0 (select (i32.const 1) (i32.const 2) (local.get 0))))
+ )
+ (func (export "as-local.set-value") (param i32) (result i32)
+ (local i32) (local.set 0 (select (i32.const 1) (i32.const 2) (local.get 0))) (local.get 0)
+ )
+ (func (export "as-local.tee-value") (param i32) (result i32)
+ (local.tee 0 (select (i32.const 1) (i32.const 2) (local.get 0)))
+ )
+ (global $a (mut i32) (i32.const 10))
+ (func (export "as-global.set-value") (param i32) (result i32)
+ (global.set $a (select (i32.const 1) (i32.const 2) (local.get 0)))
+ (global.get $a)
+ )
+ (func (export "as-load-operand") (param i32) (result i32)
+ (i32.load (select (i32.const 0) (i32.const 4) (local.get 0)))
+ )
+
+ (func (export "as-unary-operand") (param i32) (result i32)
+ (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0)))
+ )
+ (func (export "as-binary-operand") (param i32) (result i32)
+ (i32.mul
+ (select (i32.const 1) (i32.const 2) (local.get 0))
+ (select (i32.const 1) (i32.const 2) (local.get 0))
+ )
+ )
+ (func (export "as-test-operand") (param i32) (result i32)
+ (block (result i32)
+ (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0)))
+ )
+ )
+
+ (func (export "as-compare-left") (param i32) (result i32)
+ (block (result i32)
+ (i32.le_s (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.const 1))
+ )
+ )
+ (func (export "as-compare-right") (param i32) (result i32)
+ (block (result i32)
+ (i32.ne (i32.const 1) (select (i32.const 0) (i32.const 1) (local.get 0)))
+ )
+ )
+
+ (func (export "as-convert-operand") (param i32) (result i32)
+ (block (result i32)
+ (i32.wrap_i64 (select (i64.const 1) (i64.const 0) (local.get 0)))
+ )
+ )
+
+)
+
+(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2))
+(assert_return (invoke "select_f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1))
+(assert_return (invoke "select_f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1))
+
+(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2))
+(assert_return (invoke "select_i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2))
+(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2))
+
+(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan))
+(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304))
+(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1))
+(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan))
+(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304))
+
+(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan))
+(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304))
+(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1))
+(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan))
+(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304))
+
+(assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable")
+(assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable")
+(assert_trap (invoke "select_trap_r" (i32.const 1)) "unreachable")
+(assert_trap (invoke "select_trap_r" (i32.const 0)) "unreachable")
+
+(assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 0))
+(assert_return (invoke "as-select-mid" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-select-mid" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-select-last" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-select-last" (i32.const 1)) (i32.const 3))
+
+(assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-loop-last" (i32.const 1)) (i32.const 2))
+
+(assert_return (invoke "as-if-condition" (i32.const 0)))
+(assert_return (invoke "as-if-condition" (i32.const 1)))
+(assert_return (invoke "as-if-then" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-if-else" (i32.const 1)) (i32.const 2))
+
+(assert_return (invoke "as-br_if-first" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-br_if-first" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-br_if-last" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-br_if-last" (i32.const 1)) (i32.const 2))
+
+(assert_return (invoke "as-br_table-first" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-br_table-first" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-br_table-last" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-br_table-last" (i32.const 1)) (i32.const 2))
+
+(assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const 3))
+(assert_return (invoke "as-call_indirect-first" (i32.const 1)) (i32.const 2))
+(assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "as-call_indirect-mid" (i32.const 1)) (i32.const 1))
+(assert_trap (invoke "as-call_indirect-last" (i32.const 0)) "undefined element")
+(assert_trap (invoke "as-call_indirect-last" (i32.const 1)) "undefined element")
+
+(assert_return (invoke "as-store-first" (i32.const 0)))
+(assert_return (invoke "as-store-first" (i32.const 1)))
+(assert_return (invoke "as-store-last" (i32.const 0)))
+(assert_return (invoke "as-store-last" (i32.const 1)))
+
+(assert_return (invoke "as-memory.grow-value" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "as-memory.grow-value" (i32.const 1)) (i32.const 3))
+
+(assert_return (invoke "as-call-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-call-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-return-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-drop-operand" (i32.const 0)))
+(assert_return (invoke "as-drop-operand" (i32.const 1)))
+(assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-br-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const 2))
+(assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-load-operand" (i32.const 0)) (i32.const 1))
+(assert_return (invoke "as-load-operand" (i32.const 1)) (i32.const 1))
+
+(assert_return (invoke "as-unary-operand" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "as-unary-operand" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-binary-operand" (i32.const 0)) (i32.const 4))
+(assert_return (invoke "as-binary-operand" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-test-operand" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "as-test-operand" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-compare-left" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "as-compare-left" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-compare-right" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "as-compare-right" (i32.const 1)) (i32.const 1))
+(assert_return (invoke "as-convert-operand" (i32.const 0)) (i32.const 0))
+(assert_return (invoke "as-convert-operand" (i32.const 1)) (i32.const 1))
+
+(assert_invalid
+ (module (func $arity-0 (select (nop) (nop) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+
+;; The first two operands should have the same type as each other
+
+(assert_invalid
+ (module (func $type-num-vs-num (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-num-vs-num (select (i32.const 1) (f32.const 1.0) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func $type-num-vs-num (select (i32.const 1) (f64.const 1.0) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+
+
+(assert_invalid
+ (module
+ (func $type-1st-operand-empty
+ (select) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-2nd-operand-empty
+ (i32.const 0) (select) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-3rd-operand-empty
+ (i32.const 0) (i32.const 0) (select) (drop)
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-1st-operand-empty-in-block
+ (i32.const 0) (i32.const 0) (i32.const 0)
+ (block (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-2nd-operand-empty-in-block
+ (i32.const 0) (i32.const 0)
+ (block (i32.const 0) (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-3rd-operand-empty-in-block
+ (i32.const 0)
+ (block (i32.const 0) (i32.const 0) (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-1st-operand-empty-in-loop
+ (i32.const 0) (i32.const 0) (i32.const 0)
+ (loop (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-2nd-operand-empty-in-loop
+ (i32.const 0) (i32.const 0)
+ (loop (i32.const 0) (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-3rd-operand-empty-in-loop
+ (i32.const 0)
+ (loop (i32.const 0) (i32.const 0) (select) (drop))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-1st-operand-empty-in-then
+ (i32.const 0) (i32.const 0) (i32.const 0)
+ (if (then (select) (drop)))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-2nd-operand-empty-in-then
+ (i32.const 0) (i32.const 0)
+ (if (then (i32.const 0) (select) (drop)))
+ )
+ )
+ "type mismatch"
+)
+(assert_invalid
+ (module
+ (func $type-3rd-operand-empty-in-then
+ (i32.const 0)
+ (if (then (i32.const 0) (i32.const 0) (select) (drop)))
+ )
+ )
+ "type mismatch"
+)
+
+;; Third operand must be i32
+
+(assert_invalid
+ (module (func (select (i32.const 1) (i32.const 1) (i64.const 1)) (drop)))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func (select (i32.const 1) (i32.const 1) (f32.const 1)) (drop)))
+ "type mismatch"
+)
+(assert_invalid
+ (module (func (select (i32.const 1) (i32.const 1) (f64.const 1)) (drop)))
+ "type mismatch"
+)
+
+;; Result of select has type of first two operands
+
+(assert_invalid
+ (module (func (result i32) (select (i64.const 1) (i64.const 1) (i32.const 1))))
+ "type mismatch"
+)
+
+;; Validation after unreachable
+
+;; The first two operands should have the same type as each other
+(assert_invalid
+ (module (func (unreachable) (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func (unreachable) (select (i64.const 1) (i32.const 1) (i32.const 1)) (drop)))
+ "type mismatch"
+)
+
+;; Third operand must be i32
+(assert_invalid
+ (module (func (unreachable) (select (i32.const 1) (i32.const 1) (i64.const 1)) (drop)))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func (unreachable) (select (i32.const 1) (i64.const 1)) (drop)))
+ "type mismatch"
+)
+
+(assert_invalid
+ (module (func (unreachable) (select (i64.const 1)) (drop)))
+ "type mismatch"
+)
+
+;; Result of select has type of first two operands (type of second operand when first one is omitted)
+(assert_invalid
+ (module (func (result i32) (unreachable) (select (i64.const 1) (i32.const 1))))
+ "type mismatch"
+)
+
+;; select always has non-empty result
+(assert_invalid
+ (module (func (unreachable) (select)))
+ "type mismatch"
+)
+(;; STDOUT ;;;
+94/94 tests passed.
+;;; STDOUT ;;)
diff --git a/test/wasm2c/old-spec/table.txt b/test/wasm2c/old-spec/table.txt
new file mode 100644
index 00000000..f7ef54be
--- /dev/null
+++ b/test/wasm2c/old-spec/table.txt
@@ -0,0 +1,58 @@
+;;; TOOL: run-spec-wasm2c
+;; Test table section structure
+
+(module (table 0 funcref))
+(module (table 1 funcref))
+(module (table 0 0 funcref))
+(module (table 0 1 funcref))
+(module (table 1 256 funcref))
+(module (table 0 65536 funcref))
+(module (table 0 0xffff_ffff funcref))
+
+(assert_invalid (module (table 0 funcref) (table 0 funcref)) "multiple tables")
+(assert_invalid (module (table (import "spectest" "table") 0 funcref) (table 0 funcref)) "multiple tables")
+
+(assert_invalid (module (elem (i32.const 0))) "unknown table")
+(assert_invalid (module (elem (i32.const 0) $f) (func $f)) "unknown table")
+
+
+(assert_invalid
+ (module (table 1 0 funcref))
+ "size minimum must not be greater than maximum"
+)
+(assert_invalid
+ (module (table 0xffff_ffff 0 funcref))
+ "size minimum must not be greater than maximum"
+)
+
+(assert_malformed
+ (module quote "(table 0x1_0000_0000 funcref)")
+ "i32 constant out of range"
+)
+(assert_malformed
+ (module quote "(table 0x1_0000_0000 0x1_0000_0000 funcref)")
+ "i32 constant out of range"
+)
+(assert_malformed
+ (module quote "(table 0 0x1_0000_0000 funcref)")
+ "i32 constant out of range"
+)
+
+
+;; Duplicate table identifiers
+
+(assert_malformed (module quote
+ "(table $foo 1 funcref)"
+ "(table $foo 1 funcref)")
+ "duplicate table")
+(assert_malformed (module quote
+ "(import \"\" \"\" (table $foo 1 funcref))"
+ "(table $foo 1 funcref)")
+ "duplicate table")
+(assert_malformed (module quote
+ "(import \"\" \"\" (table $foo 1 funcref))"
+ "(import \"\" \"\" (table $foo 1 funcref))")
+ "duplicate table")
+(;; STDOUT ;;;
+0/0 tests passed.
+;;; STDOUT ;;)