summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/kitchen-sink.js1
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt25
-rw-r--r--test/extra-unreachable.wast4
-rw-r--r--test/extra-unreachable.wast.from-wast5
-rw-r--r--test/passes/directize_all-features.txt (renamed from test/passes/directize_enable-tail-call.txt)12
-rw-r--r--test/passes/directize_all-features.wast (renamed from test/passes/directize_enable-tail-call.wast)14
-rw-r--r--test/passes/instrument-locals_all-features_disable-typed-function-references.txt (renamed from test/passes/instrument-locals_all-features.txt)0
-rw-r--r--test/passes/instrument-locals_all-features_disable-typed-function-references.wast (renamed from test/passes/instrument-locals_all-features.wast)0
-rw-r--r--test/passes/translate-to-fuzz_all-features.txt1598
-rw-r--r--test/typed-function-references.wast24
-rw-r--r--test/typed-function-references.wast.from-wast45
-rw-r--r--test/typed-function-references.wast.fromBinary46
-rw-r--r--test/typed-function-references.wast.fromBinary.noDebugInfo46
-rw-r--r--test/unit/test_features.py4
-rw-r--r--test/unit/test_tail_call_type.py4
15 files changed, 1089 insertions, 739 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 703e8cb5a..831bdd3d8 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -169,6 +169,7 @@ function test_ids() {
console.log("TupleExtractId: " + binaryen.TupleExtractId);
console.log("I31NewId: " + binaryen.I31NewId);
console.log("I31GetId: " + binaryen.I31GetId);
+ console.log("CallRefId: " + binaryen.CallRefId);
console.log("RefTestId: " + binaryen.RefTestId);
console.log("RefCastId: " + binaryen.RefCastId);
console.log("BrOnCastId: " + binaryen.BrOnCastId);
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 980a6d8c1..464862159 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -93,18 +93,19 @@ TupleMakeId: 49
TupleExtractId: 50
I31NewId: 51
I31GetId: 52
-RefTestId: 53
-RefCastId: 54
-BrOnCastId: 55
-RttCanonId: 56
-RttSubId: 57
-StructNewId: 58
-StructGetId: 59
-StructSetId: 60
-ArrayNewId: 61
-ArrayGetId: 62
-ArraySetId: 63
-ArrayLenId: 64
+CallRefId: 53
+RefTestId: 54
+RefCastId: 55
+BrOnCastId: 56
+RttCanonId: 57
+RttSubId: 58
+StructNewId: 59
+StructGetId: 60
+StructSetId: 61
+ArrayNewId: 62
+ArrayGetId: 63
+ArraySetId: 64
+ArrayLenId: 65
getExpressionInfo={"id":15,"type":4,"op":6}
(f32.neg
(f32.const -33.61199951171875)
diff --git a/test/extra-unreachable.wast b/test/extra-unreachable.wast
index 799665924..80725c92e 100644
--- a/test/extra-unreachable.wast
+++ b/test/extra-unreachable.wast
@@ -1,5 +1,5 @@
(module
- (type $ii (param i32) (result i32))
+ (type $ii (func (param i32) (result i32)))
(memory (shared 1 1))
(table 0 funcref)
(global $g (mut f32) (f32.const 0))
@@ -86,7 +86,7 @@
(call $foo (unreachable))
)
(global.set $g
- (call_indirect (type $ii) (unreachable))
+ (call_indirect (type $ii) (unreachable) (unreachable))
)
;; unary
diff --git a/test/extra-unreachable.wast.from-wast b/test/extra-unreachable.wast.from-wast
index e084548f8..08aa4ed4b 100644
--- a/test/extra-unreachable.wast.from-wast
+++ b/test/extra-unreachable.wast.from-wast
@@ -1,7 +1,7 @@
(module
(type $none_=>_none (func))
- (type $i32_=>_none (func (param i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $i32_=>_none (func (param i32)))
(memory $0 (shared 1 1))
(table $0 0 funcref)
(global $g (mut f32) (f32.const 0))
@@ -64,7 +64,8 @@
)
)
(global.set $g
- (call_indirect (type $none_=>_none)
+ (call_indirect (type $i32_=>_i32)
+ (unreachable)
(unreachable)
)
)
diff --git a/test/passes/directize_enable-tail-call.txt b/test/passes/directize_all-features.txt
index 97956bee5..4b6934f06 100644
--- a/test/passes/directize_enable-tail-call.txt
+++ b/test/passes/directize_all-features.txt
@@ -209,3 +209,15 @@
)
)
)
+(module
+ (type $i32_i32_=>_none (func (param i32 i32)))
+ (func $foo (param $0 i32) (param $1 i32)
+ (unreachable)
+ )
+ (func $bar (param $x i32) (param $y i32)
+ (call $foo
+ (local.get $x)
+ (local.get $y)
+ )
+ )
+)
diff --git a/test/passes/directize_enable-tail-call.wast b/test/passes/directize_all-features.wast
index adebca6b6..b113af396 100644
--- a/test/passes/directize_enable-tail-call.wast
+++ b/test/passes/directize_all-features.wast
@@ -207,3 +207,17 @@
)
)
)
+;; call_ref
+(module
+ (func $foo (param i32) (param i32)
+ (unreachable)
+ )
+ (func $bar (param $x i32) (param $y i32)
+ (call_ref
+ (local.get $x)
+ (local.get $y)
+ (ref.func $foo)
+ )
+ )
+)
+
diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features_disable-typed-function-references.txt
index d027f54a0..d027f54a0 100644
--- a/test/passes/instrument-locals_all-features.txt
+++ b/test/passes/instrument-locals_all-features_disable-typed-function-references.txt
diff --git a/test/passes/instrument-locals_all-features.wast b/test/passes/instrument-locals_all-features_disable-typed-function-references.wast
index c709630b5..c709630b5 100644
--- a/test/passes/instrument-locals_all-features.wast
+++ b/test/passes/instrument-locals_all-features_disable-typed-function-references.wast
diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt
index 055f80e00..17d913b4b 100644
--- a/test/passes/translate-to-fuzz_all-features.txt
+++ b/test/passes/translate-to-fuzz_all-features.txt
@@ -1,4 +1,5 @@
(module
+ (type $none_=>_i32_v128_f64_v128 (func (result i32 v128 f64 v128)))
(type $none_=>_none (func))
(type $i32_=>_none (func (param i32)))
(type $i64_=>_none (func (param i64)))
@@ -35,7 +36,7 @@
(global.get $hangLimit)
)
(return
- (i32.const 235407412)
+ (i32.const 64)
)
)
(global.set $hangLimit
@@ -66,30 +67,48 @@
)
)
)
- (f32.store offset=1 align=1
- (i32.and
- (i32.const -127)
- (i32.const 15)
- )
- (f32.const -8)
- )
- (if
- (i32.eqz
- (ref.is_null
- (ref.null exn)
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (i32.const 303045650)
+ (i32.const 5)
+ )
+ (i32.shl
+ (ref.eq
+ (i31.new
+ (i32.const -65535)
+ )
+ (tuple.extract 2
+ (tuple.make
+ (f64.const 274877906944)
+ (i31.new
+ (i32.const -134217728)
+ )
+ (ref.null eq)
+ )
+ )
+ )
+ (i32.const 5)
+ )
+ )
+ (i32.load8_u offset=2
+ (i32.const 0)
)
)
- (block $label$1
- (nop)
- (br_if $label$1
- (loop $label$2 (result i32)
+ )
+ (nop)
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (loop $label$1 (result i32)
(block
(if
(i32.eqz
(global.get $hangLimit)
)
(return
- (i32.const 980647737)
+ (i32.const 4878)
)
)
(global.set $hangLimit
@@ -99,125 +118,85 @@
)
)
)
- (block $label$3 (result i32)
- (i32.const -1)
- )
- )
- )
- )
- (block $label$4
- (block $label$5
- (nop)
- (nop)
- )
- (nop)
- )
- )
- (local.set $0
- (i32.xor
- (i32.add
- (i32.shl
- (local.get $0)
- (i32.const 5)
- )
- (i32.const 175316752)
- )
- (i32.load8_u offset=4
- (i32.const 0)
- )
- )
- )
- (local.tee $0
- (i32.xor
- (i32.add
- (if
- (i32.eqz
- (i32.const 128)
- )
- (block $label$6
- (i32.store8 offset=4
- (i32.and
- (loop $label$7 (result i32)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const -2147483647)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
+ (block $label$2 (result i32)
+ (drop
+ (f64.const 3402823466385288598117041e14)
+ )
+ (loop $label$6
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
)
- (block $label$8 (result i32)
- (loop $label$9
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
+ (return
+ (i32.const -13)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block
+ (block $label$7
+ (nop)
+ (if
+ (block $label$8
+ (nop)
+ (br $label$1)
+ )
+ (block $label$9
+ (f64.store offset=2 align=2
+ (i32.and
+ (i32.const 118163717)
+ (i32.const 15)
+ )
+ (if (result f64)
+ (call $hashMemory)
+ (block $label$10 (result f64)
+ (memory.copy
+ (i32.const -129)
+ (i32.and
+ (i32.const 1195786829)
+ (i32.const 15)
+ )
+ (i32.const -8)
+ )
+ (f64.const -562949953421312.2)
)
- (return
- (i32.const 262143)
+ (block $label$11
+ (nop)
+ (br $label$7)
)
)
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
+ )
+ (if
+ (i32.eqz
+ (i32.atomic.load
+ (i32.and
+ (i32.const 65535)
+ (i32.const 15)
+ )
)
)
- )
- (block
- (block $label$10
+ (block $label$12
(nop)
(nop)
)
- (br_if $label$9
- (block
- (i32.wrap_i64
- (i64.trunc_f32_u
- (block $label$11
- (br_if $label$9
- (i32.eqz
- (br_if $label$8
- (select
- (i32.const 1162693199)
- (i32.const 5909)
- (i32.const 17989)
- )
- (i32.const 236914958)
- )
- )
- )
- (br $label$7)
- )
- )
- )
- (drop
- (i32.eqz
- (i32.const 1548964443)
- )
- )
- )
- )
- (v128.store offset=22
- (i32.and
- (i32.const 307712331)
- (i32.const 15)
+ (block $label$13
+ (br_if $label$7
+ (i32.const 10539)
)
- (loop $label$12 (result v128)
+ (loop $label$14
(block
(if
(i32.eqz
(global.get $hangLimit)
)
(return
- (i32.const -13)
+ (i32.const 1495078923)
)
)
(global.set $hangLimit
@@ -227,182 +206,25 @@
)
)
)
- (block (result v128)
- (br_if $label$7
- (i32.eqz
- (i32.const 24)
- )
- )
- (br_if $label$12
- (i32.const -118)
- )
- (i8x16.gt_u
- (i16x8.splat
- (loop $label$13 (result i32)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const -14)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block (result i32)
- (nop)
- (br_if $label$13
- (i32.eqz
- (i32.trunc_f32_u
- (f32.const 1099511627776)
- )
- )
- )
- (f32.le
- (f32.const 4398046511104)
- (f32.const 320406528)
- )
- )
- )
- )
- (loop $label$14 (result v128)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 386596886)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$15 (result v128)
- (br_if $label$12
- (f32.eq
- (f32.const -2147483648)
- (f32.const 555950656)
- )
- )
- (v128.const i32x4 0x80000000 0xffffff81 0x00008000 0x6e026f15)
- )
- )
- )
- )
+ (atomic.fence)
)
)
)
)
- (i32.const 0)
+ (nop)
)
)
- (i32.const 15)
- )
- (i31.get_s
- (block $label$16 (result i31ref)
- (nop)
- (i31.new
- (i32.const -256)
- )
+ (br_if $label$6
+ (i32.const -50)
)
- )
- )
- (return
- (i32.const -9)
- )
- )
- (block $label$17
- (return
- (i32.const 2376257)
- )
- )
- )
- (local.get $0)
- )
- (i32.load8_u offset=5
- (i32.const 0)
- )
- )
- )
- (local.set $0
- (tuple.extract 0
- (tuple.make
- (i32.const 262145)
- (i32.const 110)
- )
- )
- )
- (local.set $0
- (call $hashMemory)
- )
- (local.set $0
- (i32.xor
- (i32.add
- (i32.shl
- (local.get $0)
- (i32.const 5)
- )
- (local.get $0)
- )
- (i32.load8_u offset=6
- (i32.const 0)
- )
- )
- )
- (local.set $0
- (i32.xor
- (i32.add
- (i32.shl
- (local.get $0)
- (i32.const 5)
- )
- (i32.xor
- (i32.add
- (i32.shl
- (local.get $0)
- (i32.const 5)
- )
- (local.get $0)
- )
- (i32.load8_u offset=8
- (i32.const 0)
- )
- )
- )
- (i32.load8_u offset=9
- (i32.const 0)
- )
- )
- )
- (block $label$23
- (if
- (if (result i32)
- (i32.eqz
- (i32.const 218235656)
- )
- (block $label$24
- (global.set $global$_3
- (f64.add
- (f64.mul
- (loop $label$25 (result f64)
+ (loop $label$15
(block
(if
(i32.eqz
(global.get $hangLimit)
)
(return
- (i32.const 56235029)
+ (i32.const -96)
)
)
(global.set $hangLimit
@@ -412,271 +234,360 @@
)
)
)
- (block (result f64)
- (br_if $label$23
- (block $label$26
- (br $label$23)
- )
- )
- (br_if $label$25
- (i31.get_s
- (i31.new
- (i32.const -256)
- )
- )
- )
- (global.get $global$_3)
- )
- )
- (f64.const 0.878)
- )
- (block $label$27
- (nop)
- (br $label$23)
- )
- )
- )
- (br $label$23)
- )
- (select
- (call $hashMemory)
- (i32.const -2147483647)
- (i32.const 5909)
- )
- )
- (nop)
- (block $label$32
- (loop $label$33
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 15)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$34
- (br_if $label$23
- (i32.const 16911115)
- )
- (block $label$35
- (atomic.fence)
- (atomic.fence)
- )
- )
- )
- (atomic.fence)
- (atomic.fence)
- )
- )
- (atomic.fence)
- )
- (local.set $0
- (i32.xor
- (memory.atomic.notify offset=4
- (loop $label$36 (result i32)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 65512)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block (result i32)
- (if
- (ref.is_null
- (block $label$37
- (nop)
- (br $label$36)
- )
- )
- (nop)
- (nop)
- )
- (br_if $label$36
- (i32.eqz
- (block $label$38 (result i32)
- (loop $label$39
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 67108864)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
+ (block $label$16
+ (if
+ (i32.eqz
+ (br_if $label$2
+ (i8x16.extract_lane_s 2
+ (f64x2.gt
+ (v128.const i32x4 0xffffffc0 0xffffffff 0x60631d62 0x630f6218)
+ (if (result v128)
+ (i32.eqz
+ (f32.ne
+ (block $label$18
+ (nop)
+ (br $label$15)
+ )
+ (f32.const -nan:0x7fff8a)
+ )
+ )
+ (block $label$19 (result v128)
+ (nop)
+ (v128.const i32x4 0x00000000 0x38100000 0x00000000 0x40d89880)
+ )
+ (block $label$20
+ (if
+ (i32.atomic.rmw8.cmpxchg_u offset=4
+ (i32.and
+ (i32.const 2)
+ (i32.const 15)
+ )
+ (i32.const 65525)
+ (br_if $label$2
+ (i32.const -33554432)
+ (i64.lt_u
+ (i64.const -65536)
+ (i64.const 6663)
+ )
+ )
+ )
+ (block $label$21
+ (br_if $label$21
+ (i32.eqz
+ (i32.const 65535)
+ )
+ )
+ (nop)
+ )
+ (block $label$22
+ (v128.store offset=4
+ (i32.and
+ (i32.const 55)
+ (i32.const 15)
+ )
+ (v128.const i32x4 0xfffffe00 0x7fffffff 0x00005b34 0x00000039)
+ )
+ (nop)
+ )
+ )
+ (br $label$16)
+ )
+ )
+ )
+ )
+ (i32.eqz
+ (i32.const 85459227)
+ )
)
)
- )
- (block
- (br_if $label$39
- (i32.eqz
- (i32.const -58)
+ (block $label$23
+ (block $label$24
+ (block $label$25
+ (nop)
+ (nop)
+ )
+ (nop)
)
+ (nop)
)
- (br_if $label$39
- (loop $label$40
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 29)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
+ (block $label$26
+ (if
+ (br_if $label$2
+ (i32.const 1091126348)
+ (i32.const 1276841216)
)
- (block $label$41
- (if
- (i32.const 65534)
- (block $label$42
- (nop)
- (br_if $label$39
- (i32.eqz
- (i32.const -61)
+ (br_if $label$26
+ (i32.eqz
+ (tuple.extract 0
+ (if (result i32 v128 f64 v128)
+ (i32.load8_u offset=3
+ (i32.and
+ (f64.ge
+ (block $label$27 (result f64)
+ (nop)
+ (f64.const 41)
+ )
+ (f64x2.extract_lane 0
+ (v128.const i32x4 0xffffc000 0x00000007 0x00000001 0x473f2147)
+ )
+ )
+ (i32.const 15)
+ )
+ )
+ (block $label$28 (result i32 v128 f64 v128)
+ (tuple.make
+ (i32.const 67308125)
+ (v128.const i32x4 0xff00011d 0x0601e545 0x7f0e14ff 0x00b1f843)
+ (f64.const 1314148947)
+ (v128.const i32x4 0x0000003a 0x42d00000 0x00000000 0x40280000)
+ )
+ )
+ (block $label$29 (result i32 v128 f64 v128)
+ (br_if $label$15
+ (i32.eqz
+ (br_if $label$2
+ (i32.const -8192)
+ (i32.eqz
+ (i32.const -2)
+ )
+ )
+ )
+ )
+ (tuple.make
+ (i32.const 65534)
+ (v128.const i32x4 0x41530000 0x008045b2 0x01ff7f00 0xff2d8349)
+ (f64.const 1797693134862315708145274e284)
+ (v128.const i32x4 0xffbc630d 0xffb6ffbb 0x00015658 0xffb4ffff)
+ )
)
- )
- )
- (block $label$43
- (nop)
- (drop
- (ref.null exn)
)
)
)
- (br $label$40)
)
- )
- )
- (f32.store offset=3 align=2
- (i32.and
- (select
- (i32.const 42)
- (loop $label$44 (result i32)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
+ (block $label$30
+ (if
+ (loop $label$31 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 1578633994)
+ )
)
- (return
- (i32.const -9)
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
)
)
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
+ (block $label$32 (result i32)
+ (block $label$33
+ (if
+ (i32.eqz
+ (i32.atomic.rmw.and offset=4
+ (i32.const -2147483648)
+ (block $label$34
+ (loop $label$35
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 403574365)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block
+ (nop)
+ (br_if $label$35
+ (i32.const -65536)
+ )
+ (nop)
+ )
+ )
+ (br $label$1)
+ )
+ )
+ )
+ (block $label$36
+ (nop)
+ (br_if $label$16
+ (i32.const 2136)
+ )
+ )
+ (block $label$37
+ (nop)
+ (nop)
+ )
+ )
+ (atomic.fence)
+ )
+ (f32.lt
+ (f32.const 2147483648)
+ (f32.const 2147483648)
)
)
)
- (i16x8.extract_lane_s 2
- (v128.const i32x4 0x05030804 0x1e070503 0x80000001 0xffffffff)
- )
- )
- (memory.atomic.notify offset=22
- (i32.and
- (i32.atomic.load offset=22
+ (block $label$40
+ (i32.atomic.store16 offset=2
(i32.and
- (i32.const 1499338050)
+ (i31.get_s
+ (loop $label$41
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const -2)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$42
+ (loop $label$43
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const -13)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$44
+ (nop)
+ (nop)
+ )
+ )
+ (block $label$45
+ (nop)
+ (br $label$16)
+ )
+ )
+ )
+ )
(i32.const 15)
)
+ (block $label$46
+ (nop)
+ (ref.is_null
+ (if
+ (i32.eqz
+ (if (result i32)
+ (i32.eqz
+ (block $label$47
+ (nop)
+ (br $label$16)
+ )
+ )
+ (i32.const -4194304)
+ (i32.const 5140)
+ )
+ )
+ (block $label$48
+ (block $label$49
+ (nop)
+ (br_if $label$15
+ (i32.eqz
+ (loop $label$50 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 112)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (nop)
+ (br_if $label$50
+ (i32.eqz
+ (i32.const 3)
+ )
+ )
+ (i31.get_s
+ (i31.new
+ (i32.const 4095)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ (br $label$40)
+ )
+ (block $label$51
+ (drop
+ (ref.null exn)
+ )
+ (br $label$16)
+ )
+ )
+ )
+ )
)
- (i32.const 15)
)
- (i32.const -2)
- )
- )
- (i32.const 15)
- )
- (f32.const -9223372036854775808)
- )
- )
- )
- (i32.const -2147483648)
- )
- )
- )
- (select
- (i32.const -127)
- (i32.const 8)
- (i32.const -255)
- )
- )
- )
- (i32.const 608321884)
- )
- (i32.and
- (i32.const 72)
- (i64.eqz
- (loop $label$45 (result i64)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 2131838335)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block (result i64)
- (block $label$46
- (nop)
- )
- (br_if $label$45
- (i32.eqz
- (block $label$47
- (br_if $label$45
- (i32.eqz
- (i32.rem_s
- (if (result i32)
- (i32.rem_u
- (i32.atomic.load16_u offset=2
- (i32.and
- (if (result i32)
- (i32.eqz
- (loop $label$48 (result i32)
+ (block $label$52
+ (loop $label$53
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 7506)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block
+ (nop)
+ (br_if $label$53
+ (loop $label$54 (result i32)
(block
(if
(i32.eqz
(global.get $hangLimit)
)
(return
- (i32.const 55645307)
+ (i32.const 50922251)
)
)
(global.set $hangLimit
@@ -686,38 +597,115 @@
)
)
)
- (block (result i32)
- (br_if $label$48
- (i32.eqz
- (i32.const 4374)
+ (i32.const 6912)
+ )
+ )
+ (br_if $label$6
+ (br_if $label$2
+ (call $hashMemory)
+ (loop $label$55 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 319820056)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
)
)
- (br_if $label$48
- (i32.const 791226157)
+ (i32.const 2147483647)
+ )
+ )
+ )
+ )
+ )
+ (memory.copy
+ (i32.and
+ (i32.atomic.load offset=3
+ (i32.and
+ (loop $label$56 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const -2147483648)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
)
- (if (result i32)
- (i32.eqz
- (i32.const 270077278)
+ (loop $label$57 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 262143)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (block $label$58
+ (if
+ (i32.eqz
+ (i32.const 775321902)
+ )
+ (nop)
+ (if
+ (i32.eqz
+ (i32.const -18)
+ )
+ (nop)
+ (nop)
+ )
+ )
+ (nop)
+ )
+ (br_if $label$57
+ (i32.const 4194304)
+ )
+ (f32.le
+ (f32.const 18446744073709551615)
+ (f32.const -nan:0x7fff87)
+ )
)
- (i32.const -1)
- (i32.const 96)
)
)
+ (i32.const 15)
)
)
- (block $label$49
- (nop)
- (br $label$45)
- )
- (block $label$50 (result i32)
- (loop $label$51
+ (i32.const 15)
+ )
+ (i32.and
+ (block $label$59 (result i32)
+ (loop $label$60
(block
(if
(i32.eqz
(global.get $hangLimit)
)
(return
- (i32.const 44)
+ (i32.const -32768)
)
)
(global.set $hangLimit
@@ -728,94 +716,277 @@
)
)
(block
- (nop)
- (br_if $label$51
+ (block $label$61
+ (drop
+ (i31.new
+ (i32.const -8192)
+ )
+ )
+ (nop)
+ )
+ (br_if $label$60
(i32.eqz
- (i32.const 65507)
+ (loop $label$62 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 7)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block $label$63 (result i32)
+ (nop)
+ (i32.const 65521)
+ )
+ )
)
)
- (br_if $label$51
- (i32.const 1413679622)
+ (memory.fill
+ (i32.trunc_f32_u
+ (f32.const 256)
+ )
+ (i64.eq
+ (i64.const 256)
+ (i64.const -16384)
+ )
+ (i32.const 387455770)
)
)
)
- (f64.eq
- (f64.const -4095.596)
- (f64.const -54)
+ (i32.const 4627)
+ )
+ (i32.const 15)
+ )
+ (i32.load8_s offset=3
+ (i32.and
+ (br_if $label$2
+ (loop $label$64 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const -96)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (block $label$65
+ (loop $label$66
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 65518)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (nop)
+ )
+ (nop)
+ )
+ (br_if $label$64
+ (tuple.extract 1
+ (tuple.make
+ (v128.const i32x4 0x0606ff82 0xfffe0000 0x04052000 0xfffe0000)
+ (i32.const 1529028702)
+ )
+ )
+ )
+ (loop $label$67 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const -1073741825)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (i32.const 128)
+ )
+ )
+ )
+ (i32.eqz
+ (ref.is_null
+ (select (result anyref)
+ (ref.null eq)
+ (ref.null extern)
+ (i32.const 129)
+ )
+ )
+ )
)
+ (i32.const 15)
)
)
- (i32.const 15)
)
)
- (i32.const 262143)
)
- (i8x16.extract_lane_u 7
- (select
- (global.get $global$_1)
- (i32x4.lt_u
- (i32x4.gt_u
- (v128.const i32x4 0xffff0002 0x0000ffa0 0x000000ff 0xff800000)
- (v128.const i32x4 0x00000001 0xffffffb7 0x585f5c5d 0xe0000001)
- )
- (global.get $global$_1)
- )
- (i31.get_s
- (i31.new
- (i32.const 1431912225)
- )
- )
- )
+ (nop)
+ )
+ )
+ (block $label$68
+ (nop)
+ (nop)
+ )
+ )
+ )
+ (nop)
+ )
+ )
+ )
+ )
+ (if (result i32)
+ (block $label$69 (result i32)
+ (if
+ (if (result i32)
+ (br_if $label$2
+ (loop $label$71 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
)
- (block $label$52
- (if
+ (return
+ (i32.const 15)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (block (result i32)
+ (block $label$72
+ (br_if $label$72
+ (i32.const -1)
+ )
+ (nop)
+ )
+ (br_if $label$71
+ (i32.eqz
+ (i32.const -2147483648)
+ )
+ )
+ (if (result i32)
+ (i32.eqz
+ (i32.const -32766)
+ )
+ (block $label$73 (result i32)
+ (br_if $label$71
(i32.eqz
- (memory.atomic.notify offset=4
- (i8x16.extract_lane_s 6
- (v128.const i32x4 0x0000040a 0x00000000 0x51080d5a 0x05040f53)
- )
- (i32.atomic.rmw8.cmpxchg_u offset=22
- (i32.and
- (if (result i32)
- (i32.const 35)
- (block $label$53
- (br $label$45)
- )
- (i32.const 2147483647)
- )
- (i32.const 15)
- )
- (i32.const 47)
- (i32.const 118818079)
+ (tuple.extract 1
+ (block $label$74
+ (nop)
+ (br $label$1)
)
)
)
- (block $label$54
- (drop
- (ref.null exn)
- )
- (nop)
- )
- (block $label$55
- (data.drop 0)
- (nop)
- )
)
- (br $label$45)
+ (ref.is_null
+ (global.get $global$_0)
+ )
+ )
+ (i32x4.all_true
+ (v128.const i32x4 0x3c800c01 0x193fff27 0x52a20001 0x970000ff)
+ )
+ )
+ )
+ )
+ (i32.eqz
+ (loop $label$70 (result i32)
+ (block
+ (if
+ (i32.eqz
+ (global.get $hangLimit)
+ )
+ (return
+ (i32.const 1048576)
+ )
+ )
+ (global.set $hangLimit
+ (i32.sub
+ (global.get $hangLimit)
+ (i32.const 1)
+ )
+ )
+ )
+ (i32.const 256)
+ )
+ )
+ )
+ (i32.atomic.load8_u offset=22
+ (i32.const 858607703)
+ )
+ (block $label$75 (result i32)
+ (nop)
+ (br_if $label$75
+ (i32.const 7)
+ (i31.get_s
+ (tuple.extract 0
+ (tuple.make
+ (i31.new
+ (i32.const 219815443)
+ )
+ (v128.const i32x4 0x00000001 0x151b1e13 0x00000001 0x1a5f0000)
)
)
- (call $hashMemory)
)
)
)
- (br $label$45)
)
+ (block $label$76
+ (nop)
+ )
+ (nop)
)
+ (i32.const 2097152)
+ )
+ (i32.const -84)
+ (block $label$77 (result i32)
+ (i32.const -16)
)
- (i64.const 5064094673136993862)
)
)
)
+ (local.get $0)
+ )
+ (i32.load8_u offset=4
+ (i32.const 0)
)
)
)
@@ -828,148 +999,137 @@
)
(local.get $0)
)
- (i32.shl
+ (i32.load8_u offset=5
+ (i32.const 0)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
+ )
(local.get $0)
- (i32.const 5)
)
+ (i32.const 6506)
)
)
(nop)
(local.set $0
(i32.xor
(i32.add
- (i32.const 5)
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
+ )
(local.get $0)
)
- (i32.load8_u offset=14
+ (i32.load8_u offset=6
(i32.const 0)
)
)
)
- (block $label$56
- (drop
- (memory.atomic.notify offset=2
- (i32.and
- (f64.ne
- (f64.const -1797693134862315708145274e284)
- (select
- (global.get $global$_3)
- (if (result f64)
- (i32.eqz
- (i32.const -2147483647)
- )
- (f64.trunc
- (f64.div
- (if (result f64)
- (i32.eqz
- (i32.atomic.rmw8.xor_u offset=22
- (i32.const 488975911)
- (select
- (i32.const -16383)
- (if (result i32)
- (i32.eqz
- (loop $label$57 (result i32)
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const 386995985)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block (result i32)
- (nop)
- (br_if $label$57
- (i32.const 453384208)
- )
- (i32.const -2147483648)
- )
- )
- )
- (i32.const 7753)
- (block $label$58
- (nop)
- (br $label$56)
- )
- )
- (i32.const 0)
- )
- )
- )
- (block $label$59 (result f64)
- (nop)
- (global.get $global$_3)
- )
- (block $label$60
- (nop)
- (br $label$56)
- )
- )
- (tuple.extract 1
- (loop $label$61
- (block
- (if
- (i32.eqz
- (global.get $hangLimit)
- )
- (return
- (i32.const -8)
- )
- )
- (global.set $hangLimit
- (i32.sub
- (global.get $hangLimit)
- (i32.const 1)
- )
- )
- )
- (block $label$62
- (br $label$56)
- )
- )
- )
- )
- )
- (block $label$63 (result f64)
- (nop)
- (f64.load offset=4
- (i32.and
- (call $hashMemory)
- (i32.const 15)
- )
- )
- )
- )
- (ref.is_null
- (ref.null eq)
- )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (i32.const 1633371484)
+ (i32.const 5)
+ )
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
)
+ (local.get $0)
)
- (i32.const 15)
+ (i32.load8_u offset=8
+ (i32.const 0)
+ )
+ )
+ )
+ (i32.load8_u offset=9
+ (i32.const 0)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
)
- (i32.const 235020035)
+ (local.get $0)
+ )
+ (i32.load8_u offset=10
+ (i32.const 0)
)
)
- (i64.atomic.store32 offset=22
- (i32.and
- (memory.atomic.notify offset=22
- (i32.and
- (i32.const 255)
- (i32.const 15)
- )
- (i32.const -255)
+ )
+ (local.set $0
+ (i32.xor
+ (i32.const 1937132399)
+ (i32.load8_u offset=11
+ (i32.const 0)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (i32.const -85)
+ (i32.const 5)
+ )
+ (local.get $0)
+ )
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
+ )
+ (local.get $0)
+ )
+ (i32.load8_u offset=13
+ (i32.const 0)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.const 5)
+ (local.get $0)
+ )
+ (i32.load8_u offset=14
+ (i32.const 0)
+ )
+ )
+ )
+ (local.set $0
+ (i32.xor
+ (i32.add
+ (i32.shl
+ (local.get $0)
+ (i32.const 5)
)
- (i32.const 15)
+ (local.get $0)
+ )
+ (i32.load8_u offset=12
+ (i32.const 0)
)
- (i64.const 33554432)
)
)
(local.get $0)
diff --git a/test/typed-function-references.wast b/test/typed-function-references.wast
new file mode 100644
index 000000000..59346f615
--- /dev/null
+++ b/test/typed-function-references.wast
@@ -0,0 +1,24 @@
+(module
+ (type $i32-i32 (func (param i32) (result i32)))
+
+ (func $call-ref
+ (call_ref (ref.func $call-ref))
+ )
+ (func $return-call-ref
+ (return_call_ref (ref.func $call-ref))
+ )
+ (func $call-ref-more (param i32) (result i32)
+ (call_ref (i32.const 42) (ref.func $call-ref-more))
+ )
+ (func $call_from-param (param $f (ref $i32-i32)) (result i32)
+ (call_ref (i32.const 42) (local.get $f))
+ )
+ (func $call_from-param-null (param $f (ref null $i32-i32)) (result i32)
+ (call_ref (i32.const 42) (local.get $f))
+ )
+ (func $call_from-local-null (result i32)
+ (local $f (ref null $i32-i32))
+ (local.set $f (ref.func $call-ref-more))
+ (call_ref (i32.const 42) (local.get $f))
+ )
+)
diff --git a/test/typed-function-references.wast.from-wast b/test/typed-function-references.wast.from-wast
new file mode 100644
index 000000000..c098f351d
--- /dev/null
+++ b/test/typed-function-references.wast.from-wast
@@ -0,0 +1,45 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (type $ref_null<i32_->_i32>_=>_i32 (func (param (ref null (func (param i32) (result i32)))) (result i32)))
+ (type $ref<i32_->_i32>_=>_i32 (func (param (ref (func (param i32) (result i32)))) (result i32)))
+ (func $call-ref
+ (call_ref
+ (ref.func $call-ref)
+ )
+ )
+ (func $return-call-ref
+ (return_call_ref
+ (ref.func $call-ref)
+ )
+ )
+ (func $call-ref-more (param $0 i32) (result i32)
+ (call_ref
+ (i32.const 42)
+ (ref.func $call-ref-more)
+ )
+ )
+ (func $call_from-param (param $f (ref (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+ (func $call_from-param-null (param $f (ref null (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+ (func $call_from-local-null (result i32)
+ (local $f (ref null (func (param i32) (result i32))))
+ (local.set $f
+ (ref.func $call-ref-more)
+ )
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+)
diff --git a/test/typed-function-references.wast.fromBinary b/test/typed-function-references.wast.fromBinary
new file mode 100644
index 000000000..dcabbeaaf
--- /dev/null
+++ b/test/typed-function-references.wast.fromBinary
@@ -0,0 +1,46 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (type $ref_null<i32_->_i32>_=>_i32 (func (param (ref null (func (param i32) (result i32)))) (result i32)))
+ (type $ref<i32_->_i32>_=>_i32 (func (param (ref (func (param i32) (result i32)))) (result i32)))
+ (func $call-ref
+ (call_ref
+ (ref.func $call-ref)
+ )
+ )
+ (func $return-call-ref
+ (return_call_ref
+ (ref.func $call-ref)
+ )
+ )
+ (func $call-ref-more (param $0 i32) (result i32)
+ (call_ref
+ (i32.const 42)
+ (ref.func $call-ref-more)
+ )
+ )
+ (func $call_from-param (param $f (ref (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+ (func $call_from-param-null (param $f (ref null (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+ (func $call_from-local-null (result i32)
+ (local $f (ref null (func (param i32) (result i32))))
+ (local.set $f
+ (ref.func $call-ref-more)
+ )
+ (call_ref
+ (i32.const 42)
+ (local.get $f)
+ )
+ )
+)
+
diff --git a/test/typed-function-references.wast.fromBinary.noDebugInfo b/test/typed-function-references.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..0808e0c52
--- /dev/null
+++ b/test/typed-function-references.wast.fromBinary.noDebugInfo
@@ -0,0 +1,46 @@
+(module
+ (type $none_=>_none (func))
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (type $none_=>_i32 (func (result i32)))
+ (type $ref_null<i32_->_i32>_=>_i32 (func (param (ref null (func (param i32) (result i32)))) (result i32)))
+ (type $ref<i32_->_i32>_=>_i32 (func (param (ref (func (param i32) (result i32)))) (result i32)))
+ (func $0
+ (call_ref
+ (ref.func $0)
+ )
+ )
+ (func $1
+ (return_call_ref
+ (ref.func $0)
+ )
+ )
+ (func $2 (param $0 i32) (result i32)
+ (call_ref
+ (i32.const 42)
+ (ref.func $2)
+ )
+ )
+ (func $3 (param $0 (ref (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $0)
+ )
+ )
+ (func $4 (param $0 (ref null (func (param i32) (result i32)))) (result i32)
+ (call_ref
+ (i32.const 42)
+ (local.get $0)
+ )
+ )
+ (func $5 (result i32)
+ (local $0 (ref null (func (param i32) (result i32))))
+ (local.set $0
+ (ref.func $2)
+ )
+ (call_ref
+ (i32.const 42)
+ (local.get $0)
+ )
+ )
+)
+
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 889b149b1..01ea4c754 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -153,7 +153,7 @@ class FeatureValidationTest(utils.BinaryenTestCase):
)
)
'''
- self.check_tail_call(module, 'return_call requires tail calls to be enabled')
+ self.check_tail_call(module, 'return_call* requires tail calls to be enabled')
def test_tail_call_indirect(self):
module = '''
@@ -167,7 +167,7 @@ class FeatureValidationTest(utils.BinaryenTestCase):
)
)
'''
- self.check_tail_call(module, 'return_call_indirect requires tail calls to be enabled')
+ self.check_tail_call(module, 'return_call* requires tail calls to be enabled')
def test_reference_types_externref(self):
module = '''
diff --git a/test/unit/test_tail_call_type.py b/test/unit/test_tail_call_type.py
index 01c6ca88e..1221dd0a7 100644
--- a/test/unit/test_tail_call_type.py
+++ b/test/unit/test_tail_call_type.py
@@ -21,7 +21,7 @@ class TailCallTypeTest(utils.BinaryenTestCase):
input=module, check=False, capture_output=True)
self.assertNotEqual(p.returncode, 0)
self.assertIn(
- 'return_call callee return type must match caller return type',
+ 'return_call* callee return type must match caller return type',
p.stderr)
def test_return_call_indirect(self):
@@ -41,5 +41,5 @@ class TailCallTypeTest(utils.BinaryenTestCase):
input=module, check=False, capture_output=True)
self.assertNotEqual(p.returncode, 0)
self.assertIn(
- 'return_call_indirect callee return type must match caller return type',
+ 'return_call* callee return type must match caller return type',
p.stderr)