diff options
Diffstat (limited to 'test')
43 files changed, 383 insertions, 379 deletions
diff --git a/test/anyref.wast.from-wast b/test/anyref.wast.from-wast deleted file mode 100644 index 121a4616a..000000000 --- a/test/anyref.wast.from-wast +++ /dev/null @@ -1,19 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $test2 anyref)) - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $test1)) - (export "test2" (global $test2)) - (func $anyref_test (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $test1 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) diff --git a/test/anyref.wast.fromBinary b/test/anyref.wast.fromBinary deleted file mode 100644 index 374a308e7..000000000 --- a/test/anyref.wast.fromBinary +++ /dev/null @@ -1,20 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $gimport$1 anyref)) - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $test1)) - (export "test2" (global $gimport$1)) - (func $anyref_test (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $test1 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) - diff --git a/test/anyref.wast.fromBinary.noDebugInfo b/test/anyref.wast.fromBinary.noDebugInfo deleted file mode 100644 index 2f532e6f1..000000000 --- a/test/anyref.wast.fromBinary.noDebugInfo +++ /dev/null @@ -1,20 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $gimport$1 anyref)) - (import "env" "test1" (func $fimport$0 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $fimport$0)) - (export "test2" (global $gimport$1)) - (func $0 (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $fimport$0 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) - diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index cd3af6750..93ed27334 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -68,8 +68,8 @@ function test_types() { console.log(" // BinaryenTypeVec128: " + binaryen.v128); console.log(" //", binaryen.expandType(binaryen.v128)); - console.log(" // BinaryenTypeAnyref: " + binaryen.anyref); - console.log(" //", binaryen.expandType(binaryen.anyref)); + console.log(" // BinaryenTypeExternref: " + binaryen.externref); + console.log(" //", binaryen.expandType(binaryen.externref)); console.log(" // BinaryenTypeExnref: " + binaryen.exnref); console.log(" //", binaryen.expandType(binaryen.exnref)); @@ -561,7 +561,7 @@ function test_core() { module.f32.pop(), module.f64.pop(), module.v128.pop(), - module.anyref.pop(), + module.externref.pop(), module.funcref.pop(), module.nullref.pop(), module.exnref.pop(), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index d81ea5312..c58f1f563 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -12,7 +12,7 @@ // [ 5 ] // BinaryenTypeVec128: 6 // [ 6 ] - // BinaryenTypeAnyref: 8 + // BinaryenTypeExternref: 8 // [ 8 ] // BinaryenTypeExnref: 10 // [ 10 ] @@ -1901,7 +1901,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (funcref.pop) @@ -3739,7 +3739,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (funcref.pop) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 1f6ffc9fc..b1dbae7d5 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -199,11 +199,11 @@ void test_types() { BinaryenTypeExpand(funcref, &valueType); assert(valueType == funcref); - BinaryenType anyref = BinaryenTypeAnyref(); - printf(" // BinaryenTypeAnyref: %d\n", anyref); - assert(BinaryenTypeArity(anyref) == 1); - BinaryenTypeExpand(anyref, &valueType); - assert(valueType == anyref); + BinaryenType externref = BinaryenTypeExternref(); + printf(" // BinaryenTypeExternref: %d\n", externref); + assert(BinaryenTypeArity(externref) == 1); + BinaryenTypeExpand(externref, &valueType); + assert(valueType == externref); BinaryenType nullref = BinaryenTypeNullref(); printf(" // BinaryenTypeNullref: %d\n", nullref); @@ -747,7 +747,7 @@ void test_core() { BinaryenPop(module, BinaryenTypeFloat32()), BinaryenPop(module, BinaryenTypeFloat64()), BinaryenPop(module, BinaryenTypeFuncref()), - BinaryenPop(module, BinaryenTypeAnyref()), + BinaryenPop(module, BinaryenTypeExternref()), BinaryenPop(module, BinaryenTypeNullref()), BinaryenPop(module, BinaryenTypeExnref()), BinaryenPop(module, BinaryenTypeFuncref()), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index ff9256fda..b0aae7f3b 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -6,7 +6,7 @@ // BinaryenTypeFloat64: 5 // BinaryenTypeVec128: 6 // BinaryenTypeFuncref: 7 - // BinaryenTypeAnyref: 8 + // BinaryenTypeExternref: 8 // BinaryenTypeNullref: 9 // BinaryenTypeExnref: 10 // BinaryenTypeAuto: -1 @@ -1843,7 +1843,7 @@ BinaryenFeatureAll: 1023 (funcref.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (nullref.pop) diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 44ac3320a..d3cc32e8d 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -1739,7 +1739,7 @@ (funcref.pop) ) (push - (anyref.pop) + (externref.pop) ) (push (nullref.pop) diff --git a/test/exception-handling.wast b/test/exception-handling.wast index 57766c2d3..7f16a237b 100644 --- a/test/exception-handling.wast +++ b/test/exception-handling.wast @@ -1,6 +1,6 @@ (module (event $e0 (attr 0) (param i32)) - (event $e1 (attr 0) (param anyref)) + (event $e1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast index 05993022c..4430bf0f0 100644 --- a/test/exception-handling.wast.from-wast +++ b/test/exception-handling.wast.from-wast @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $e0 (attr 0) (param i32)) - (event $e1 (attr 0) (param anyref)) + (event $e1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary index 9c4ebad3b..fc3dc3804 100644 --- a/test/exception-handling.wast.fromBinary +++ b/test/exception-handling.wast.fromBinary @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $event$0 (attr 0) (param i32)) - (event $event$1 (attr 0) (param anyref)) + (event $event$1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo index 97bda57c4..96cc9c4c6 100644 --- a/test/exception-handling.wast.fromBinary.noDebugInfo +++ b/test/exception-handling.wast.fromBinary.noDebugInfo @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $event$0 (attr 0) (param i32)) - (event $event$1 (attr 0) (param anyref)) + (event $event$1 (attr 0) (param externref)) (func $0 (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/externref.wast.from-wast b/test/externref.wast.from-wast new file mode 100644 index 000000000..514123aab --- /dev/null +++ b/test/externref.wast.from-wast @@ -0,0 +1,19 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $test2 externref)) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $test1)) + (export "test2" (global $test2)) + (func $externref_test (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $test1 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) diff --git a/test/externref.wast.fromBinary b/test/externref.wast.fromBinary new file mode 100644 index 000000000..ab2d2f963 --- /dev/null +++ b/test/externref.wast.fromBinary @@ -0,0 +1,20 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $gimport$1 externref)) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $test1)) + (export "test2" (global $gimport$1)) + (func $externref_test (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $test1 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) + diff --git a/test/externref.wast.fromBinary.noDebugInfo b/test/externref.wast.fromBinary.noDebugInfo new file mode 100644 index 000000000..44d9029be --- /dev/null +++ b/test/externref.wast.fromBinary.noDebugInfo @@ -0,0 +1,20 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $gimport$1 externref)) + (import "env" "test1" (func $fimport$0 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $fimport$0)) + (export "test2" (global $gimport$1)) + (func $0 (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $fimport$0 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) + diff --git a/test/multivalue.wast b/test/multivalue.wast index d740d384f..01e1237f3 100644 --- a/test/multivalue.wast +++ b/test/multivalue.wast @@ -128,7 +128,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (if (result i32 i64 nullref) (i32.const 1) (tuple.make diff --git a/test/multivalue.wast.from-wast b/test/multivalue.wast.from-wast index 480bf775f..db0a4b2d0 100644 --- a/test/multivalue.wast.from-wast +++ b/test/multivalue.wast.from-wast @@ -5,7 +5,7 @@ (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_i32_i64_f32 (func (result i32 i64 f32))) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i32_i64_nullref (func (result i32 i64 nullref))) (type $none_=>_f32 (func (result f32))) (import "env" "pair" (func $pair (result i32 i64))) @@ -136,7 +136,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (if (result i32 i64 nullref) (i32.const 1) (tuple.make diff --git a/test/multivalue.wast.fromBinary b/test/multivalue.wast.fromBinary index b18c403c8..190194fcf 100644 --- a/test/multivalue.wast.fromBinary +++ b/test/multivalue.wast.fromBinary @@ -1,7 +1,7 @@ (module (type $none_=>_i32_i64 (func (result i32 i64))) (type $none_=>_none (func)) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) @@ -390,7 +390,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (local $0 (i32 i64 nullref)) (local.set $0 (if (result i32 i64 nullref) diff --git a/test/multivalue.wast.fromBinary.noDebugInfo b/test/multivalue.wast.fromBinary.noDebugInfo index 3b696393d..226490f26 100644 --- a/test/multivalue.wast.fromBinary.noDebugInfo +++ b/test/multivalue.wast.fromBinary.noDebugInfo @@ -1,7 +1,7 @@ (module (type $none_=>_i32_i64 (func (result i32 i64))) (type $none_=>_none (func)) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) @@ -390,7 +390,7 @@ ) ) ) - (func $14 (result i32 i64 anyref) + (func $14 (result i32 i64 externref) (local $0 (i32 i64 nullref)) (local.set $0 (if (result i32 i64 nullref) diff --git a/test/passes/flatten_all-features.txt b/test/passes/flatten_all-features.txt index c633eccc8..e52f9e826 100644 --- a/test/passes/flatten_all-features.txt +++ b/test/passes/flatten_all-features.txt @@ -5,7 +5,7 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_f32 (func (result f32))) (type $i64_i64_=>_i64 (func (param i64 i64) (result i64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (memory $0 10) (table $0 1 1 funcref) (elem (i32.const 0) $call-me) @@ -2376,15 +2376,15 @@ ) (unreachable) ) - (func $subtype (result anyref) + (func $subtype (result externref) (local $0 nullref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 nullref) (local $4 nullref) (local $5 nullref) (local $6 nullref) - (local $7 anyref) + (local $7 externref) (block $label0 (block $block (local.set $1 diff --git a/test/passes/flatten_all-features.wast b/test/passes/flatten_all-features.wast index 461ce6170..f07175bd2 100644 --- a/test/passes/flatten_all-features.wast +++ b/test/passes/flatten_all-features.wast @@ -1027,8 +1027,8 @@ ;; targets an outer branch whose return type is a supertype of the br_if's ;; value type, we need the value to be set into two locals: one with the outer ;; block's type, and one with its value type. - (func $subtype (result anyref) (local $0 nullref) - (block $label0 (result anyref) + (func $subtype (result externref) (local $0 nullref) + (block $label0 (result externref) (block (result nullref) (local.tee $0 (br_if $label0 diff --git a/test/passes/flatten_local-cse_all-features.txt b/test/passes/flatten_local-cse_all-features.txt index c80611abe..5f3adace7 100644 --- a/test/passes/flatten_local-cse_all-features.txt +++ b/test/passes/flatten_local-cse_all-features.txt @@ -794,7 +794,7 @@ ) ) (func $test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (block $label$1 diff --git a/test/passes/flatten_local-cse_all-features.wast b/test/passes/flatten_local-cse_all-features.wast index 112dfe647..1b4dc37c2 100644 --- a/test/passes/flatten_local-cse_all-features.wast +++ b/test/passes/flatten_local-cse_all-features.wast @@ -300,7 +300,7 @@ ) (func $test - (local $0 anyref) + (local $0 externref) (drop (block $label$1 (result nullref) (local.set $0 @@ -308,7 +308,7 @@ ) ;; After --flatten, this will be assigned to a local of nullref type. After ;; --local-cse, even if we set (ref.null) to local $0 above, this should not - ;; be replaced with $0, because it is of type anyref. + ;; be replaced with $0, because it is of type externref. (ref.null) ) ) diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index 2627c9cde..0676924da 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -4,7 +4,7 @@ (type $i32_i32_f32_=>_f32 (func (param i32 i32 f32) (result f32))) (type $i32_i32_f64_=>_f64 (func (param i32 i32 f64) (result f64))) (type $i32_i32_funcref_=>_funcref (func (param i32 i32 funcref) (result funcref))) - (type $i32_i32_anyref_=>_anyref (func (param i32 i32 anyref) (result anyref))) + (type $i32_i32_externref_=>_externref (func (param i32 i32 externref) (result externref))) (type $i32_i32_nullref_=>_nullref (func (param i32 i32 nullref) (result nullref))) (type $i32_i32_exnref_=>_exnref (func (param i32 i32 exnref) (result exnref))) (type $none_=>_none (func)) @@ -18,8 +18,8 @@ (import "env" "set_f64" (func $set_f64 (param i32 i32 f64) (result f64))) (import "env" "get_funcref" (func $get_funcref (param i32 i32 funcref) (result funcref))) (import "env" "set_funcref" (func $set_funcref (param i32 i32 funcref) (result funcref))) - (import "env" "get_anyref" (func $get_anyref (param i32 i32 anyref) (result anyref))) - (import "env" "set_anyref" (func $set_anyref (param i32 i32 anyref) (result anyref))) + (import "env" "get_externref" (func $get_externref (param i32 i32 externref) (result externref))) + (import "env" "set_externref" (func $set_externref (param i32 i32 externref) (result externref))) (import "env" "get_nullref" (func $get_nullref (param i32 i32 nullref) (result nullref))) (import "env" "set_nullref" (func $set_nullref (param i32 i32 nullref) (result nullref))) (import "env" "get_exnref" (func $get_exnref (param i32 i32 exnref) (result exnref))) @@ -30,7 +30,7 @@ (local $z f32) (local $w f64) (local $F funcref) - (local $A anyref) + (local $X externref) (local $N nullref) (local $E exnref) (drop @@ -65,10 +65,10 @@ ) ) (drop - (call $get_anyref + (call $get_externref (i32.const 4) (i32.const 5) - (local.get $A) + (local.get $X) ) ) (drop @@ -117,10 +117,10 @@ ) ) (drop - (call $get_anyref + (call $get_externref (i32.const 11) (i32.const 5) - (local.get $A) + (local.get $X) ) ) (drop @@ -168,14 +168,14 @@ (ref.func $test) ) ) - (local.set $A - (call $set_anyref + (local.set $X + (call $set_externref (i32.const 19) (i32.const 5) - (call $get_anyref + (call $get_externref (i32.const 18) (i32.const 5) - (local.get $A) + (local.get $X) ) ) ) @@ -232,14 +232,14 @@ ) ) ) - (local.set $A - (call $set_anyref + (local.set $X + (call $set_externref (i32.const 29) (i32.const 5) - (call $get_anyref + (call $get_externref (i32.const 28) (i32.const 5) - (local.get $A) + (local.get $X) ) ) ) @@ -268,8 +268,8 @@ (local.set $F (funcref.pop) ) - (local.set $A - (anyref.pop) + (local.set $X + (externref.pop) ) (local.set $N (nullref.pop) diff --git a/test/passes/instrument-locals_all-features.wast b/test/passes/instrument-locals_all-features.wast index ccf64d5a2..1739fc352 100644 --- a/test/passes/instrument-locals_all-features.wast +++ b/test/passes/instrument-locals_all-features.wast @@ -5,7 +5,7 @@ (local $z f32) (local $w f64) (local $F funcref) - (local $A anyref) + (local $X externref) (local $N nullref) (local $E exnref) @@ -14,7 +14,7 @@ (drop (local.get $z)) (drop (local.get $w)) (drop (local.get $F)) - (drop (local.get $A)) + (drop (local.get $X)) (drop (local.get $N)) (drop (local.get $E)) @@ -23,7 +23,7 @@ (drop (local.get $z)) (drop (local.get $w)) (drop (local.get $F)) - (drop (local.get $A)) + (drop (local.get $X)) (drop (local.get $N)) (drop (local.get $E)) @@ -32,7 +32,7 @@ (local.set $z (f32.const 3.21)) (local.set $w (f64.const 4.321)) (local.set $F (ref.func $test)) - (local.set $A (local.get $A)) + (local.set $X (local.get $X)) (local.set $N (ref.null)) (local.set $E (local.get $E)) @@ -41,13 +41,13 @@ (local.set $z (f32.const 33.21)) (local.set $w (f64.const 44.321)) (local.set $F (local.get $F)) - (local.set $A (local.get $A)) + (local.set $X (local.get $X)) (local.set $N (local.get $N)) (local.set $E (local.get $E)) ;; Pop instructions should not be instrumented (local.set $F (funcref.pop)) - (local.set $A (anyref.pop)) + (local.set $X (externref.pop)) (local.set $N (nullref.pop)) (local.set $E (exnref.pop)) ) diff --git a/test/passes/merge-locals_all-features.txt b/test/passes/merge-locals_all-features.txt index c87a952d5..e4d325695 100644 --- a/test/passes/merge-locals_all-features.txt +++ b/test/passes/merge-locals_all-features.txt @@ -458,7 +458,7 @@ ) ) (func $subtype-test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (local.set $0 diff --git a/test/passes/merge-locals_all-features.wast b/test/passes/merge-locals_all-features.wast index a7f61796a..2a0a3d292 100644 --- a/test/passes/merge-locals_all-features.wast +++ b/test/passes/merge-locals_all-features.wast @@ -376,7 +376,7 @@ ) ) (func $subtype-test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (local.set $0 diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index d84095b89..e04bc4eb4 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -13,7 +13,7 @@ (type $i32_i64_f32_f64_=>_none (func (param i32 i64 f32 f64))) (type $i32_i64_f64_i32_=>_none (func (param i32 i64 f64 i32))) (type $none_=>_f64 (func (result f64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (memory $0 0) (export "load-off-2" (func $load-off-2)) (func $f (param $i1 i32) (param $i2 i64) @@ -3334,7 +3334,7 @@ (unreachable) ) ) - (func $if-arms-subtype (result anyref) + (func $if-arms-subtype (result externref) (ref.null) ) ) diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index 9694d9b28..8de7d4819 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -3789,8 +3789,8 @@ ) ) ;; Tests when if arms are subtype of if's type - (func $if-arms-subtype (result anyref) - (if (result anyref) + (func $if-arms-subtype (result externref) + (if (result externref) (i32.const 0) (ref.null) (ref.null) diff --git a/test/passes/simplify-globals_all-features.txt b/test/passes/simplify-globals_all-features.txt index 9c1663b0a..dc766683e 100644 --- a/test/passes/simplify-globals_all-features.txt +++ b/test/passes/simplify-globals_all-features.txt @@ -213,9 +213,9 @@ ) (module (type $none_=>_none (func)) - (import "env" "global-1" (global $g1 anyref)) - (global $g2 anyref (global.get $g1)) - (global $g3 anyref (ref.null)) + (import "env" "global-1" (global $g1 externref)) + (global $g2 externref (global.get $g1)) + (global $g3 externref (ref.null)) (func $test1 (drop (global.get $g1) diff --git a/test/passes/simplify-globals_all-features.wast b/test/passes/simplify-globals_all-features.wast index 8c93d1390..3c7c61a9f 100644 --- a/test/passes/simplify-globals_all-features.wast +++ b/test/passes/simplify-globals_all-features.wast @@ -128,9 +128,9 @@ ) ;; Reference type tests (module - (import "env" "global-1" (global $g1 anyref)) - (global $g2 (mut anyref) (global.get $g1)) - (global $g3 anyref (ref.null)) + (import "env" "global-1" (global $g1 externref)) + (global $g2 (mut externref) (global.get $g1)) + (global $g3 externref (ref.null)) (func $test1 (drop (global.get $g1)) (drop (global.get $g2)) diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt index c8d989c93..e6ff57ce1 100644 --- a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt +++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt @@ -9,14 +9,14 @@ --enable-reference-types --enable-multivalue (module - (type $none_=>_v128_anyref (func (result v128 anyref))) - (func $foo (result v128 anyref) + (type $none_=>_v128_externref (func (result v128 externref))) + (func $foo (result v128 externref) (tuple.make (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) (ref.null) ) ) - (func $bar (result v128 anyref) + (func $bar (result v128 externref) (return_call $foo) ) ) diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.wast b/test/passes/strip-target-features_roundtrip_print-features_all-features.wast index 214289904..614804f9d 100644 --- a/test/passes/strip-target-features_roundtrip_print-features_all-features.wast +++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.wast @@ -2,13 +2,13 @@ ;; even if the target features section is stripped first (module - (func $foo (result v128 anyref ) + (func $foo (result v128 externref ) (tuple.make (v128.const i32x4 0 0 0 0) (ref.null) ) ) - (func $bar (result v128 anyref) + (func $bar (result v128 externref) (return_call $foo) ) ) diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt index 9662c118a..216798375 100644 --- a/test/passes/translate-to-fuzz_all-features.txt +++ b/test/passes/translate-to-fuzz_all-features.txt @@ -11,7 +11,7 @@ (type $none_=>_i32 (func (result i32))) (type $i64_v128_=>_f32 (func (param i64 v128) (result f32))) (type $f32_=>_f64 (func (param f32) (result f64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (type $f64_=>_nullref (func (param f64) (result nullref))) (import "fuzzing-support" "log-i32" (func $log-i32 (param i32))) (import "fuzzing-support" "log-i64" (func $log-i64 (param i64))) @@ -271,12 +271,12 @@ ) (local.get $0) ) - (func $func_8 (result anyref) + (func $func_8 (result externref) (local $0 i64) (local $1 exnref) (local $2 nullref) (local $3 i32) - (local $4 anyref) + (local $4 externref) (local $5 nullref) (local $6 f32) (block @@ -295,7 +295,7 @@ ) ) ) - (block $label$0 (result anyref) + (block $label$0 (result externref) (loop $label$1 (block (if @@ -389,7 +389,7 @@ ) (local.tee $3 (ref.is_null - (loop $label$13 (result anyref) + (loop $label$13 (result externref) (block (if (i32.eqz @@ -407,7 +407,7 @@ ) ) (local.tee $4 - (loop $label$14 (result anyref) + (loop $label$14 (result externref) (block (if (i32.eqz @@ -595,7 +595,7 @@ (func $func_9 (param $0 f64) (result nullref) (local $1 nullref) (local $2 f32) - (local $3 anyref) + (local $3 externref) (local $4 exnref) (block (if @@ -616,7 +616,7 @@ (local.get $1) ) (func $func_10 (param $0 f32) (result f64) - (local $1 anyref) + (local $1 externref) (local $2 v128) (local $3 i32) (local $4 v128) @@ -627,7 +627,7 @@ (local $9 nullref) (local $10 exnref) (local $11 exnref) - (local $12 anyref) + (local $12 externref) (local $13 nullref) (local $14 (v128 i32 exnref v128)) (local $15 i64) diff --git a/test/reference-types.wast b/test/reference-types.wast index b5c1f9c41..8bea4e8e4 100644 --- a/test/reference-types.wast +++ b/test/reference-types.wast @@ -1,44 +1,48 @@ -;; reftype :: anyref | funcref | exnref | nullref +;; reftype :: externref | funcref | exnref | nullref -;; t <: anyref for all reftypes t -;; nullref <: anyref, nullref <: funcref and nullref <: exnref +;; t <: externref for all reftypes t +;; nullref <: externref, nullref <: funcref and nullref <: exnref +;; TODO: the subtyping relationship has been removed from the current proposal +;; so it also needs to be removed from Binaryen still both in the tests but +;; also inside the validation, fuzzing, etc. +;; https://github.com/WebAssembly/reference-types/pull/87 (module - (type $sig_anyref (func (param anyref))) + (type $sig_externref (func (param externref))) (type $sig_funcref (func (param funcref))) (type $sig_exnref (func (param exnref))) (type $sig_nullref (func (param nullref))) - (func $take_anyref (param anyref)) + (func $take_externref (param externref)) (func $take_funcref (param funcref)) (func $take_exnref (param exnref)) (func $take_nullref (param nullref)) (func $foo) - (table funcref (elem $take_anyref $take_funcref $take_exnref $take_nullref)) + (table funcref (elem $take_externref $take_funcref $take_exnref $take_nullref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) - (import "env" "import_global" (global $import_global anyref)) - (export "export_func" (func $import_func (param anyref) (result funcref))) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) + (import "env" "import_global" (global $import_global externref)) + (export "export_func" (func $import_func (param externref) (result funcref))) (export "export_global" (global $import_global)) ;; Test subtype relationship in global initializer expressions - (global $global_anyref (mut anyref) (ref.null)) + (global $global_externref (mut externref) (ref.null)) (global $global_funcref (mut funcref) (ref.null)) (global $global_exnref (mut exnref) (ref.null)) (global $global_nullref (mut nullref) (ref.null)) - (global $global_anyref2 (mut anyref) (ref.func $foo)) + (global $global_externref2 (mut externref) (ref.func $foo)) (global $global_funcref2 (mut funcref) (ref.func $foo)) - (func $test (local $local_anyref anyref) (local $local_funcref funcref) + (func $test (local $local_externref externref) (local $local_funcref funcref) (local $local_exnref exnref) (local $local_nullref nullref) ;; Test subtype relationship for local.set & Test types for local.get - (local.set $local_anyref (local.get $local_anyref)) - (local.set $local_anyref (local.get $local_funcref)) - (local.set $local_anyref (local.get $local_exnref)) - (local.set $local_anyref (local.get $local_nullref)) - (local.set $local_anyref (ref.null)) - (local.set $local_anyref (ref.func $foo)) + (local.set $local_externref (local.get $local_externref)) + (local.set $local_externref (local.get $local_funcref)) + (local.set $local_externref (local.get $local_exnref)) + (local.set $local_externref (local.get $local_nullref)) + (local.set $local_externref (ref.null)) + (local.set $local_externref (ref.func $foo)) (local.set $local_funcref (local.get $local_funcref)) (local.set $local_funcref (ref.null)) (local.set $local_funcref (ref.func $foo)) @@ -48,12 +52,12 @@ (local.set $local_nullref (ref.null)) ;; Test subtype relationship for global.set & Test types for global.get - (global.set $global_anyref (global.get $global_anyref)) - (global.set $global_anyref (global.get $global_funcref)) - (global.set $global_anyref (global.get $global_exnref)) - (global.set $global_anyref (global.get $global_nullref)) - (global.set $global_anyref (ref.null)) - (global.set $global_anyref (ref.func $foo)) + (global.set $global_externref (global.get $global_externref)) + (global.set $global_externref (global.get $global_funcref)) + (global.set $global_externref (global.get $global_exnref)) + (global.set $global_externref (global.get $global_nullref)) + (global.set $global_externref (ref.null)) + (global.set $global_externref (ref.func $foo)) (global.set $global_funcref (global.get $global_funcref)) (global.set $global_funcref (ref.null)) (global.set $global_funcref (ref.func $foo)) @@ -63,14 +67,14 @@ (global.set $global_nullref (ref.null)) ;; Test subtype relationship for function call / call_indirect params - (call $take_anyref (local.get $local_anyref)) - (call $take_anyref (local.get $local_funcref)) - (call $take_anyref (local.get $local_exnref)) - (call $take_anyref (ref.null)) - (call_indirect (type $sig_anyref) (local.get $local_anyref) (i32.const 0)) - (call_indirect (type $sig_anyref) (local.get $local_funcref) (i32.const 0)) - (call_indirect (type $sig_anyref) (local.get $local_exnref) (i32.const 0)) - (call_indirect (type $sig_anyref) (ref.null) (i32.const 0)) + (call $take_externref (local.get $local_externref)) + (call $take_externref (local.get $local_funcref)) + (call $take_externref (local.get $local_exnref)) + (call $take_externref (ref.null)) + (call_indirect (type $sig_externref) (local.get $local_externref) (i32.const 0)) + (call_indirect (type $sig_externref) (local.get $local_funcref) (i32.const 0)) + (call_indirect (type $sig_externref) (local.get $local_exnref) (i32.const 0)) + (call_indirect (type $sig_externref) (ref.null) (i32.const 0)) (call_indirect (type $sig_funcref) (local.get $local_funcref) (i32.const 1)) (call_indirect (type $sig_funcref) (ref.null) (i32.const 1)) (call_indirect (type $sig_exnref) (local.get $local_exnref) (i32.const 2)) @@ -80,22 +84,22 @@ ;; Test subtype relationship for block return type (drop - (block (result anyref) - (br_if 0 (local.get $local_anyref) (i32.const 1)) + (block (result externref) + (br_if 0 (local.get $local_externref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (local.get $local_funcref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (local.get $local_exnref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (ref.null) (i32.const 1)) ) ) @@ -117,22 +121,22 @@ ;; Test subtype relationship for loop return type (drop - (loop (result anyref) - (local.get $local_anyref) + (loop (result externref) + (local.get $local_externref) ) ) (drop - (loop (result anyref) + (loop (result externref) (local.get $local_funcref) ) ) (drop - (loop (result anyref) + (loop (result externref) (local.get $local_exnref) ) ) (drop - (loop (result anyref) + (loop (result externref) (ref.null) ) ) @@ -164,14 +168,14 @@ ;; Test subtype relationship for if return type (drop - (if (result anyref) + (if (result externref) (i32.const 1) - (local.get $local_anyref) + (local.get $local_externref) (local.get $local_exnref) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -201,9 +205,9 @@ ;; Test subtype relationship for try return type (drop - (try (result anyref) + (try (result externref) (do - (local.get $local_anyref) + (local.get $local_externref) ) (catch (exnref.pop) @@ -211,7 +215,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -256,28 +260,28 @@ ;; Test subtype relationship for typed select (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $local_exnref) - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -313,23 +317,23 @@ ) ;; ref.is_null takes any reference types - (drop (ref.is_null (local.get $local_anyref))) + (drop (ref.is_null (local.get $local_externref))) (drop (ref.is_null (local.get $local_exnref))) (drop (ref.is_null (ref.func $foo))) (drop (ref.is_null (ref.null))) ) ;; Test subtype relationship in function return type - (func $return_anyref (result anyref) (local $local_anyref anyref) - (local.get $local_anyref) + (func $return_externref (result externref) (local $local_externref externref) + (local.get $local_externref) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) (local $local_exnref exnref) + (func $return_externref3 (result externref) (local $local_exnref exnref) (local.get $local_exnref) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -349,9 +353,9 @@ ) ;; Test subtype relationship in returns - (func $return_anyref_returns (result anyref) (local $local_anyref anyref) + (func $return_externref_returns (result externref) (local $local_externref externref) (local $local_exnref exnref) - (return (local.get $local_anyref)) + (return (local.get $local_externref)) (return (local.get $local_exnref)) (return (ref.func $foo)) (return (ref.null)) diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast index db33afb17..3916606c0 100644 --- a/test/reference-types.wast.from-wast +++ b/test/reference-types.wast.from-wast @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $import_global anyref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $import_global externref)) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) (table $0 4 4 funcref) - (elem (i32.const 0) $take_anyref $take_funcref $take_exnref $take_nullref) - (global $global_anyref (mut anyref) (ref.null)) + (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_nullref) + (global $global_externref (mut externref) (ref.null)) (global $global_funcref (mut funcref) (ref.null)) (global $global_exnref (mut exnref) (ref.null)) (global $global_nullref (mut nullref) (ref.null)) - (global $global_anyref2 (mut anyref) (ref.func $foo)) + (global $global_externref2 (mut externref) (ref.func $foo)) (global $global_funcref2 (mut funcref) (ref.func $foo)) (export "export_func" (func $import_func)) (export "export_global" (global $import_global)) - (func $take_anyref (param $0 anyref) + (func $take_externref (param $0 externref) (nop) ) (func $take_funcref (param $0 funcref) @@ -37,26 +37,26 @@ (nop) ) (func $test - (local $local_anyref anyref) + (local $local_externref externref) (local $local_funcref funcref) (local $local_exnref exnref) (local $local_nullref nullref) - (local.set $local_anyref - (local.get $local_anyref) + (local.set $local_externref + (local.get $local_externref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_funcref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_exnref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_nullref) ) - (local.set $local_anyref + (local.set $local_externref (ref.null) ) - (local.set $local_anyref + (local.set $local_externref (ref.func $foo) ) (local.set $local_funcref @@ -80,22 +80,22 @@ (local.set $local_nullref (ref.null) ) - (global.set $global_anyref - (global.get $global_anyref) + (global.set $global_externref + (global.get $global_externref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_funcref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_exnref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_nullref) ) - (global.set $global_anyref + (global.set $global_externref (ref.null) ) - (global.set $global_anyref + (global.set $global_externref (ref.func $foo) ) (global.set $global_funcref @@ -119,31 +119,31 @@ (global.set $global_nullref (ref.null) ) - (call $take_anyref - (local.get $local_anyref) + (call $take_externref + (local.get $local_externref) ) - (call $take_anyref + (call $take_externref (local.get $local_funcref) ) - (call $take_anyref + (call $take_externref (local.get $local_exnref) ) - (call $take_anyref + (call $take_externref (ref.null) ) - (call_indirect (type $anyref_=>_none) - (local.get $local_anyref) + (call_indirect (type $externref_=>_none) + (local.get $local_externref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $local_funcref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $local_exnref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,15 +172,15 @@ (i32.const 3) ) (drop - (block $block (result anyref) + (block $block (result externref) (br_if $block - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) ) (drop - (block $block0 (result anyref) + (block $block0 (result externref) (br_if $block0 (local.get $local_funcref) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $block1 (result anyref) + (block $block1 (result externref) (br_if $block1 (local.get $local_exnref) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $block2 (result anyref) + (block $block2 (result externref) (br_if $block2 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $loop-in (result anyref) - (local.get $local_anyref) + (loop $loop-in (result externref) + (local.get $local_externref) ) ) (drop - (loop $loop-in6 (result anyref) + (loop $loop-in6 (result externref) (local.get $local_funcref) ) ) (drop - (loop $loop-in7 (result anyref) + (loop $loop-in7 (result externref) (local.get $local_exnref) ) ) (drop - (loop $loop-in8 (result anyref) + (loop $loop-in8 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) - (local.get $local_anyref) + (local.get $local_externref) (local.get $local_exnref) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -308,9 +308,9 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do - (local.get $local_anyref) + (local.get $local_externref) ) (catch (exnref.pop) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $local_exnref) - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -424,7 +424,7 @@ ) (drop (ref.is_null - (local.get $local_anyref) + (local.get $local_externref) ) ) (drop @@ -443,18 +443,18 @@ ) ) ) - (func $return_anyref (result anyref) - (local $local_anyref anyref) - (local.get $local_anyref) + (func $return_externref (result externref) + (local $local_externref externref) + (local.get $local_externref) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) + (func $return_externref3 (result externref) (local $local_exnref exnref) (local.get $local_exnref) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -474,11 +474,11 @@ (local $local_nullref nullref) (local.get $local_nullref) ) - (func $return_anyref_returns (result anyref) - (local $local_anyref anyref) + (func $return_externref_returns (result externref) + (local $local_externref externref) (local $local_exnref exnref) (return - (local.get $local_anyref) + (local.get $local_externref) ) (return (local.get $local_exnref) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index 82ade2c15..ae36b9209 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $gimport$1 anyref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $gimport$1 externref)) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) (table $0 4 4 funcref) - (elem (i32.const 0) $take_anyref $take_funcref $take_exnref $take_nullref) - (global $global$0 (mut anyref) (ref.null)) + (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_nullref) + (global $global$0 (mut externref) (ref.null)) (global $global$1 (mut funcref) (ref.null)) (global $global$2 (mut exnref) (ref.null)) (global $global$3 (mut nullref) (ref.null)) - (global $global$4 (mut anyref) (ref.func $foo)) + (global $global$4 (mut externref) (ref.func $foo)) (global $global$5 (mut funcref) (ref.func $foo)) (export "export_func" (func $import_func)) (export "export_global" (global $gimport$1)) - (func $take_anyref (param $0 anyref) + (func $take_externref (param $0 externref) (nop) ) (func $take_funcref (param $0 funcref) @@ -38,7 +38,7 @@ ) (func $test (local $0 funcref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 exnref) (local.set $1 @@ -119,31 +119,31 @@ (global.set $global$3 (ref.null) ) - (call $take_anyref + (call $take_externref (local.get $1) ) - (call $take_anyref + (call $take_externref (local.get $0) ) - (call $take_anyref + (call $take_externref (local.get $3) ) - (call $take_anyref + (call $take_externref (ref.null) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $1) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $0) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $3) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,7 +172,7 @@ (i32.const 3) ) (drop - (block $label$1 (result anyref) + (block $label$1 (result externref) (br_if $label$1 (local.get $1) (i32.const 1) @@ -180,7 +180,7 @@ ) ) (drop - (block $label$2 (result anyref) + (block $label$2 (result externref) (br_if $label$2 (local.get $0) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $label$3 (result anyref) + (block $label$3 (result externref) (br_if $label$3 (local.get $3) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $label$4 (result anyref) + (block $label$4 (result externref) (br_if $label$4 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $label$8 (result anyref) + (loop $label$8 (result externref) (local.get $1) ) ) (drop - (loop $label$9 (result anyref) + (loop $label$9 (result externref) (local.get $0) ) ) (drop - (loop $label$10 (result anyref) + (loop $label$10 (result externref) (local.get $3) ) ) (drop - (loop $label$11 (result anyref) + (loop $label$11 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (local.get $1) (local.get $3) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -308,7 +308,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (local.get $1) ) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $3) (local.get $1) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -443,18 +443,18 @@ ) ) ) - (func $return_anyref (result anyref) - (local $0 anyref) + (func $return_externref (result externref) + (local $0 externref) (local.get $0) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) + (func $return_externref3 (result externref) (local $0 exnref) (local.get $0) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -474,8 +474,8 @@ (local $0 nullref) (local.get $0) ) - (func $return_anyref_returns (result anyref) - (local $0 anyref) + (func $return_externref_returns (result externref) + (local $0 externref) (local $1 exnref) (return (local.get $0) diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo index a89f3a3a3..9e8dac3a3 100644 --- a/test/reference-types.wast.fromBinary.noDebugInfo +++ b/test/reference-types.wast.fromBinary.noDebugInfo @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $gimport$1 anyref)) - (import "env" "import_func" (func $fimport$0 (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $gimport$1 externref)) + (import "env" "import_func" (func $fimport$0 (param externref) (result funcref))) (table $0 4 4 funcref) (elem (i32.const 0) $0 $1 $2 $3) - (global $global$0 (mut anyref) (ref.null)) + (global $global$0 (mut externref) (ref.null)) (global $global$1 (mut funcref) (ref.null)) (global $global$2 (mut exnref) (ref.null)) (global $global$3 (mut nullref) (ref.null)) - (global $global$4 (mut anyref) (ref.func $4)) + (global $global$4 (mut externref) (ref.func $4)) (global $global$5 (mut funcref) (ref.func $4)) (export "export_func" (func $fimport$0)) (export "export_global" (global $gimport$1)) - (func $0 (param $0 anyref) + (func $0 (param $0 externref) (nop) ) (func $1 (param $0 funcref) @@ -38,7 +38,7 @@ ) (func $5 (local $0 funcref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 exnref) (local.set $1 @@ -131,19 +131,19 @@ (call $0 (ref.null) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $1) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $0) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $3) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,7 +172,7 @@ (i32.const 3) ) (drop - (block $label$1 (result anyref) + (block $label$1 (result externref) (br_if $label$1 (local.get $1) (i32.const 1) @@ -180,7 +180,7 @@ ) ) (drop - (block $label$2 (result anyref) + (block $label$2 (result externref) (br_if $label$2 (local.get $0) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $label$3 (result anyref) + (block $label$3 (result externref) (br_if $label$3 (local.get $3) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $label$4 (result anyref) + (block $label$4 (result externref) (br_if $label$4 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $label$8 (result anyref) + (loop $label$8 (result externref) (local.get $1) ) ) (drop - (loop $label$9 (result anyref) + (loop $label$9 (result externref) (local.get $0) ) ) (drop - (loop $label$10 (result anyref) + (loop $label$10 (result externref) (local.get $3) ) ) (drop - (loop $label$11 (result anyref) + (loop $label$11 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (local.get $1) (local.get $3) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $4) (ref.null) @@ -308,7 +308,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (local.get $1) ) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $4) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.func $4) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $3) (local.get $1) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $4) (i32.const 1) @@ -443,18 +443,18 @@ ) ) ) - (func $6 (result anyref) - (local $0 anyref) + (func $6 (result externref) + (local $0 externref) (local.get $0) ) - (func $7 (result anyref) + (func $7 (result externref) (ref.func $4) ) - (func $8 (result anyref) + (func $8 (result externref) (local $0 exnref) (local.get $0) ) - (func $9 (result anyref) + (func $9 (result externref) (ref.null) ) (func $10 (result funcref) @@ -474,8 +474,8 @@ (local $0 nullref) (local.get $0) ) - (func $15 (result anyref) - (local $0 anyref) + (func $15 (result externref) + (local $0 externref) (local $1 exnref) (return (local.get $0) diff --git a/test/spec/old_select.wast b/test/spec/old_select.wast index bb9c7c587..e1dd40654 100644 --- a/test/spec/old_select.wast +++ b/test/spec/old_select.wast @@ -29,8 +29,8 @@ (func (export "select-funcref") (param funcref funcref i32) (result funcref) (select (result funcref) (local.get 0) (local.get 1) (local.get 2)) ) - (func (export "select-anyref") (param anyref anyref i32) (result anyref) - (select (result anyref) (local.get 0) (local.get 1) (local.get 2)) + (func (export "select-externref") (param externref externref i32) (result externref) + (select (result externref) (local.get 0) (local.get 1) (local.get 2)) ) ;; Check that both sides of the select are evaluated @@ -39,18 +39,18 @@ (func (export "select_trap_r") (param $cond i32) (result i32) (select (i32.const 0) (unreachable) (local.get $cond))) - (func (export "join-nullref") (param i32) (result anyref) - (select (result anyref) (ref.null) (ref.null) (local.get 0)) + (func (export "join-nullref") (param i32) (result externref) + (select (result externref) (ref.null) (ref.null) (local.get 0)) ) - (func (export "join-funcref") (param i32) (result anyref) - (select (result anyref) + (func (export "join-funcref") (param i32) (result externref) + (select (result externref) (ref.func $dummy) (ref.null) (local.get 0) ) ) - (func (export "join-anyref") (param i32) (param anyref) (result anyref) - (select (result anyref) + (func (export "join-externref") (param i32) (param externref) (result externref) + (select (result externref) (ref.func $dummy) (local.get 1) (local.get 0) @@ -92,13 +92,13 @@ (assert_return (invoke "select-f64-t" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) (assert_return (invoke "select-nullref" (ref.null) (ref.null) (i32.const 1)) (ref.null)) (assert_return (invoke "select-funcref" (ref.func "dummy") (ref.null) (i32.const 1)) (ref.func "dummy")) -(assert_return (invoke "select-anyref" (ref.null) (ref.func "dummy") (i32.const 1)) (ref.null)) +(assert_return (invoke "select-externref" (ref.null) (ref.func "dummy") (i32.const 1)) (ref.null)) (assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) (assert_return (invoke "select-i32-t" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) -(assert_return (invoke "select-anyref" (ref.null) (ref.func "dummy") (i32.const 0)) (ref.func "dummy")) +(assert_return (invoke "select-externref" (ref.null) (ref.func "dummy") (i32.const 0)) (ref.func "dummy")) (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) @@ -124,8 +124,8 @@ (assert_return_func (invoke "join-funcref" (i32.const 1))) (assert_return (invoke "join-funcref" (i32.const 0)) (ref.null)) -(assert_return_func (invoke "join-anyref" (i32.const 1) (ref.null))) -(assert_return (invoke "join-anyref" (i32.const 0) (ref.null)) (ref.null)) +(assert_return_func (invoke "join-externref" (i32.const 1) (ref.null))) +(assert_return (invoke "join-externref" (i32.const 0) (ref.null)) (ref.null)) (assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable executed") (assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable executed") diff --git a/test/spec/ref_func.wast b/test/spec/ref_func.wast index 0f0ecf6a3..79bf584be 100644 --- a/test/spec/ref_func.wast +++ b/test/spec/ref_func.wast @@ -5,8 +5,8 @@ (func $f (import "M" "f") (param i32) (result i32)) (func $g (param $x i32) (result i32) (i32.add (local.get $x) (i32.const 1))) - (global anyref (ref.func $f)) - (global anyref (ref.func $g)) + (global externref (ref.func $f)) + (global externref (ref.func $g)) (global funcref (ref.func $f)) (global funcref (ref.func $g)) (global $v (mut funcref) (ref.func $f)) diff --git a/test/spec/ref_is_null.wast b/test/spec/ref_is_null.wast index dbf465149..e44fcf496 100644 --- a/test/spec/ref_is_null.wast +++ b/test/spec/ref_is_null.wast @@ -2,7 +2,7 @@ (func $f1 (export "nullref") (param $x nullref) (result i32) (ref.is_null (local.get $x)) ) - (func $f2 (export "anyref") (param $x anyref) (result i32) + (func $f2 (export "externref") (param $x externref) (result i32) (ref.is_null (local.get $x)) ) (func $f3 (export "funcref") (param $x funcref) (result i32) @@ -11,5 +11,5 @@ ) (assert_return (invoke "nullref" (ref.null)) (i32.const 1)) -(assert_return (invoke "anyref" (ref.null)) (i32.const 1)) +(assert_return (invoke "externref" (ref.null)) (i32.const 1)) (assert_return (invoke "funcref" (ref.null)) (i32.const 1)) diff --git a/test/spec/ref_null.wast b/test/spec/ref_null.wast index 96cac314a..93e6acbd2 100644 --- a/test/spec/ref_null.wast +++ b/test/spec/ref_null.wast @@ -1,13 +1,13 @@ (module - (func (export "anyref") (result anyref) (ref.null)) + (func (export "externref") (result externref) (ref.null)) (func (export "funcref") (result funcref) (ref.null)) (func (export "nullref") (result nullref) (ref.null)) - (global anyref (ref.null)) + (global externref (ref.null)) (global funcref (ref.null)) (global nullref (ref.null)) ) -(assert_return (invoke "anyref") (ref.null)) +(assert_return (invoke "externref") (ref.null)) (assert_return (invoke "funcref") (ref.null)) (assert_return (invoke "nullref") (ref.null)) diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 4a79a6dd5..3b30595d6 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -160,14 +160,14 @@ class FeatureValidationTest(utils.BinaryenTestCase): ''' self.check_tail_call(module, 'return_call_indirect requires tail calls to be enabled') - def test_reference_types_anyref(self): + def test_reference_types_externref(self): module = ''' (module - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (import "env" "test2" (global $test2 anyref)) - (export "test1" (func $test1 (param anyref) (result anyref))) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (import "env" "test2" (global $test2 externref)) + (export "test1" (func $test1 (param externref) (result externref))) (export "test2" (global $test2)) - (func $anyref_test (param $0 anyref) (result anyref) + (func $externref_test (param $0 externref) (result externref) (return (call $test1 (local.get $0) @@ -298,7 +298,7 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase): filename = 'reference_types_target_feature.wasm' self.roundtrip(filename) self.check_features(filename, ['reference-types']) - self.assertIn('anyref', self.disassemble(filename)) + self.assertIn('externref', self.disassemble(filename)) def test_exception_handling(self): filename = 'exception_handling_target_feature.wasm' |