diff options
author | Alon Zakai <azakai@google.com> | 2021-01-26 23:36:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-26 15:36:56 -0800 |
commit | f82e94363a231bf570fbe3d7dc49259c8668206f (patch) | |
tree | 1c4dd05735dfe61e8cc5d87a1c98479b788b89bd /test | |
parent | 5e57a13614c56f959faab675d6bcabbd629ec562 (diff) | |
download | binaryen-f82e94363a231bf570fbe3d7dc49259c8668206f.tar.gz binaryen-f82e94363a231bf570fbe3d7dc49259c8668206f.tar.bz2 binaryen-f82e94363a231bf570fbe3d7dc49259c8668206f.zip |
[GC] ref.is_func/data/i31 (#3519)
Diffstat (limited to 'test')
-rw-r--r-- | test/binaryen.js/expressions.js | 16 | ||||
-rw-r--r-- | test/heap-types.wast | 5 | ||||
-rw-r--r-- | test/heap-types.wast.from-wast | 21 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary | 21 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary.noDebugInfo | 21 |
5 files changed, 84 insertions, 0 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 6d4fa8011..3d2a5d138 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -1377,6 +1377,22 @@ console.log("# RefIs"); "(ref.is_null\n (local.get $2)\n)\n" ); + assert( + binaryen.RefIs(module.ref.is_func(value)).toText() + == + "(ref.is_func\n (local.get $2)\n)\n" + ); + assert( + binaryen.RefIs(module.ref.is_data(value)).toText() + == + "(ref.is_data\n (local.get $2)\n)\n" + ); + assert( + binaryen.RefIs(module.ref.is_i31(value)).toText() + == + "(ref.is_i31\n (local.get $2)\n)\n" + ); + module.dispose(); })(); diff --git a/test/heap-types.wast b/test/heap-types.wast index da8baf1e0..614bbb1c5 100644 --- a/test/heap-types.wast +++ b/test/heap-types.wast @@ -182,4 +182,9 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if (ref.is_func (local.get $x)) (unreachable)) + (if (ref.is_data (local.get $x)) (unreachable)) + (if (ref.is_i31 (local.get $x)) (unreachable)) + ) ) diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index 33c86b903..b717de63f 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -196,4 +197,24 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if + (ref.is_func + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $x) + ) + (unreachable) + ) + ) ) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 2e1f25235..5b6dca2f6 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -195,5 +196,25 @@ ) ) ) + (func $ref.is_X (param $x anyref) + (if + (ref.is_func + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $x) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $x) + ) + (unreachable) + ) + ) ) diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo index beb9732a1..fef210e11 100644 --- a/test/heap-types.wast.fromBinary.noDebugInfo +++ b/test/heap-types.wast.fromBinary.noDebugInfo @@ -4,6 +4,7 @@ (type ${} (struct )) (type ${mut:f32} (struct (field (mut f32)))) (type $none_=>_none (func)) + (type $anyref_=>_none (func (param anyref))) (type ${i32} (struct (field i32))) (type ${i32_i64} (struct (field i32) (field i64))) (type $[mut:i32] (array (mut i32))) @@ -195,5 +196,25 @@ ) ) ) + (func $5 (param $0 anyref) + (if + (ref.is_func + (local.get $0) + ) + (unreachable) + ) + (if + (ref.is_data + (local.get $0) + ) + (unreachable) + ) + (if + (ref.is_i31 + (local.get $0) + ) + (unreachable) + ) + ) ) |