diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/binaryen.js/expressions.js | 5 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js | 4 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js.txt | 2 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 18 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 2 | ||||
-rw-r--r-- | test/passes/fuzz-exec_all-features.txt | 12 | ||||
-rw-r--r-- | test/passes/fuzz-exec_all-features.wast | 6 | ||||
-rw-r--r-- | test/passes/fuzz_metrics_noprint.bin.txt | 48 | ||||
-rw-r--r-- | test/passes/instrument-locals_all-features.txt | 36 | ||||
-rw-r--r-- | test/passes/strip-target-features_roundtrip_print-features_all-features.txt | 1 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_all-features.txt | 1629 | ||||
-rw-r--r-- | test/unit/test_features.py | 3 |
12 files changed, 863 insertions, 903 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index a340adcbe..61fc0a3ef 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -1378,7 +1378,7 @@ console.log("# RefFunc"); const module = new binaryen.Module(); var func = "a"; - const theRefFunc = binaryen.RefFunc(module.ref.func(func)); + const theRefFunc = binaryen.RefFunc(module.ref.func(func, binaryen.funcref)); assert(theRefFunc instanceof binaryen.RefFunc); assert(theRefFunc instanceof binaryen.Expression); assert(theRefFunc.func === func); @@ -1388,7 +1388,8 @@ console.log("# RefFunc"); assert(theRefFunc.func === func); theRefFunc.type = binaryen.f64; theRefFunc.finalize(); - assert(theRefFunc.type === binaryen.funcref); + // TODO The type is a subtype of funcref, but we can't check that in the JS + // API atm. console.log(theRefFunc.toText()); assert( diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 836b7ab17..703e8cb5a 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -539,8 +539,8 @@ function test_core() { // Reference types module.ref.is_null(module.ref.null(binaryen.externref)), module.ref.is_null(module.ref.null(binaryen.funcref)), - module.ref.is_null(module.ref.func("kitchen()sinker")), - module.select(temp10, module.ref.null(binaryen.funcref), module.ref.func("kitchen()sinker"), binaryen.funcref), + module.ref.is_null(module.ref.func("kitchen()sinker", binaryen.funcref)), + module.select(temp10, module.ref.null(binaryen.funcref), module.ref.func("kitchen()sinker", binaryen.funcref), binaryen.funcref), // GC module.ref.eq(module.ref.null(binaryen.eqref), module.ref.null(binaryen.eqref)), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 4990c0abd..980a6d8c1 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -41,7 +41,7 @@ Features.ReferenceTypes: 256 Features.Multivalue: 512 Features.GC: 1024 Features.Memory64: 2048 -Features.All: 4095 +Features.All: 8191 InvalidId: 0 BlockId: 1 IfId: 2 diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 8a2f22e8d..25f8b1937 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -310,7 +310,8 @@ void test_core() { temp15 = makeInt32(module, 110), temp16 = makeInt64(module, 111); BinaryenExpressionRef externrefExpr = BinaryenRefNull(module, BinaryenTypeExternref()); BinaryenExpressionRef funcrefExpr = BinaryenRefNull(module, BinaryenTypeFuncref()); - funcrefExpr = BinaryenRefFunc(module, "kitchen()sinker"); + funcrefExpr = + BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref()); BinaryenExpressionRef exnrefExpr = BinaryenRefNull(module, BinaryenTypeExnref()); BinaryenExpressionRef i31refExpr = BinaryenI31New(module, makeInt32(module, 1)); @@ -737,15 +738,16 @@ void test_core() { BinaryenRefIsNull(module, externrefExpr), BinaryenRefIsNull(module, funcrefExpr), BinaryenRefIsNull(module, exnrefExpr), - BinaryenSelect(module, - temp10, - BinaryenRefNull(module, BinaryenTypeFuncref()), - BinaryenRefFunc(module, "kitchen()sinker"), - BinaryenTypeFuncref()), + BinaryenSelect( + module, + temp10, + BinaryenRefNull(module, BinaryenTypeFuncref()), + BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref()), + BinaryenTypeFuncref()), // GC BinaryenRefEq(module, - BinaryenRefNull(module, BinaryenTypeEqref()), - BinaryenRefNull(module, BinaryenTypeEqref())), + BinaryenRefNull(module, BinaryenTypeEqref()), + BinaryenRefNull(module, BinaryenTypeEqref())), // Exception handling BinaryenTry(module, tryBody, catchBody), // Atomics diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index ab9548924..dbbb30eb6 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -25,7 +25,7 @@ BinaryenFeatureReferenceTypes: 256 BinaryenFeatureMultivalue: 512 BinaryenFeatureGC: 1024 BinaryenFeatureMemory64: 2048 -BinaryenFeatureAll: 4095 +BinaryenFeatureAll: 8191 (f32.neg (f32.const -33.61199951171875) ) diff --git a/test/passes/fuzz-exec_all-features.txt b/test/passes/fuzz-exec_all-features.txt index cbdcf4fdb..22e342fc1 100644 --- a/test/passes/fuzz-exec_all-features.txt +++ b/test/passes/fuzz-exec_all-features.txt @@ -207,3 +207,15 @@ ) [fuzz-exec] calling rmw-reads-modifies-and-writes-asymmetrical [LoggingExternalInterface logging 214] +[fuzz-exec] calling func +[fuzz-exec] note result: func => funcref(func) +(module + (type $none_=>_funcref (func (result funcref))) + (export "func" (func $func)) + (func $func (result funcref) + (ref.func $func) + ) +) +[fuzz-exec] calling func +[fuzz-exec] note result: func => funcref(func) +[fuzz-exec] comparing func diff --git a/test/passes/fuzz-exec_all-features.wast b/test/passes/fuzz-exec_all-features.wast index 4e5c926a5..960990a33 100644 --- a/test/passes/fuzz-exec_all-features.wast +++ b/test/passes/fuzz-exec_all-features.wast @@ -121,3 +121,9 @@ ) ) ) +(module + (export "func" (func $func)) + (func $func (result funcref) + (ref.func $func) + ) +) diff --git a/test/passes/fuzz_metrics_noprint.bin.txt b/test/passes/fuzz_metrics_noprint.bin.txt index ad654067f..9e9b6f4f8 100644 --- a/test/passes/fuzz_metrics_noprint.bin.txt +++ b/test/passes/fuzz_metrics_noprint.bin.txt @@ -1,30 +1,30 @@ total [events] : 0 - [exports] : 35 - [funcs] : 47 + [exports] : 51 + [funcs] : 67 [globals] : 7 [imports] : 4 [memory-data] : 4 - [table-data] : 16 - [total] : 6048 - [vars] : 137 - binary : 458 - block : 871 - break : 230 - call : 240 - call_indirect : 52 - const : 1081 - drop : 40 - global.get : 480 - global.set : 204 - if : 356 - load : 108 - local.get : 527 - local.set : 351 - loop : 155 - nop : 120 - return : 233 - select : 51 - store : 58 - unary : 432 + [table-data] : 18 + [total] : 4870 + [vars] : 236 + binary : 368 + block : 699 + break : 191 + call : 300 + call_indirect : 39 + const : 847 + drop : 91 + global.get : 403 + global.set : 171 + if : 260 + load : 85 + local.get : 374 + local.set : 251 + loop : 111 + nop : 86 + return : 187 + select : 30 + store : 36 + unary : 340 unreachable : 1 diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index 03a5743e5..d027f54a0 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -157,18 +157,14 @@ ) ) (local.set $F - (call $set_funcref - (i32.const 15) - (i32.const 4) - (ref.func $test) - ) + (ref.func $test) ) (local.set $X (call $set_externref - (i32.const 17) + (i32.const 16) (i32.const 5) (call $get_externref - (i32.const 16) + (i32.const 15) (i32.const 5) (local.get $X) ) @@ -176,10 +172,10 @@ ) (local.set $E (call $set_exnref - (i32.const 19) + (i32.const 18) (i32.const 6) (call $get_exnref - (i32.const 18) + (i32.const 17) (i32.const 6) (local.get $E) ) @@ -187,7 +183,7 @@ ) (local.set $x (call $set_i32 - (i32.const 20) + (i32.const 19) (i32.const 0) (i32.const 11) ) @@ -197,24 +193,24 @@ ) (local.set $z (call $set_f32 - (i32.const 21) + (i32.const 20) (i32.const 2) (f32.const 33.209999084472656) ) ) (local.set $w (call $set_f64 - (i32.const 22) + (i32.const 21) (i32.const 3) (f64.const 44.321) ) ) (local.set $F (call $set_funcref - (i32.const 24) + (i32.const 23) (i32.const 4) (call $get_funcref - (i32.const 23) + (i32.const 22) (i32.const 4) (local.get $F) ) @@ -222,10 +218,10 @@ ) (local.set $X (call $set_externref - (i32.const 26) + (i32.const 25) (i32.const 5) (call $get_externref - (i32.const 25) + (i32.const 24) (i32.const 5) (local.get $X) ) @@ -233,10 +229,10 @@ ) (local.set $E (call $set_exnref - (i32.const 28) + (i32.const 27) (i32.const 6) (call $get_exnref - (i32.const 27) + (i32.const 26) (i32.const 6) (local.get $E) ) @@ -274,14 +270,14 @@ ) (drop (call $get_v128 - (i32.const 29) + (i32.const 28) (i32.const 7) (local.get $S) ) ) (local.set $S (call $set_v128 - (i32.const 30) + (i32.const 29) (i32.const 7) (v128.const i32x4 0x00000000 0x00000001 0x00000002 0x00000003) ) 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 18cee797f..96cb9b785 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 @@ -10,6 +10,7 @@ --enable-multivalue --enable-gc --enable-memory64 +--enable-typed-function-references (module (type $none_=>_v128_externref (func (result v128 externref))) (func $foo (result v128 externref) diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt index 6614e2009..055f80e00 100644 --- a/test/passes/translate-to-fuzz_all-features.txt +++ b/test/passes/translate-to-fuzz_all-features.txt @@ -2,23 +2,12 @@ (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i64_=>_none (func (param i64))) + (type $i64_i32_=>_none (func (param i64 i32))) (type $f32_=>_none (func (param f32))) (type $f64_=>_none (func (param f64))) (type $v128_=>_none (func (param v128))) - (type $funcref_=>_none (func (param funcref))) (type $exnref_=>_none (func (param exnref))) (type $none_=>_i32 (func (result i32))) - (type $anyref_anyref_externref_eqref_v128_=>_i64 (func (param anyref anyref externref eqref v128) (result i64))) - (type $eqref_externref_exnref_v128_exnref_=>_i64 (func (param eqref externref exnref v128 exnref) (result i64))) - (type $exnref_=>_f32 (func (param exnref) (result f32))) - (type $exnref_i64_funcref_f64_f64_=>_f32 (func (param exnref i64 funcref f64 f64) (result f32))) - (type $none_=>_funcref_f32_exnref_exnref (func (result funcref f32 exnref exnref))) - (type $funcref_funcref_=>_funcref_f32_exnref_exnref (func (param funcref funcref) (result funcref f32 exnref exnref))) - (type $none_=>_externref (func (result externref))) - (type $i31ref_v128_=>_exnref (func (param i31ref v128) (result exnref))) - (type $funcref_v128_=>_eqref (func (param funcref v128) (result eqref))) - (type $anyref_=>_eqref (func (param anyref) (result eqref))) - (type $i31ref_externref_v128_f32_f32_=>_eqref (func (param i31ref externref v128 f32 f32) (result eqref))) (import "fuzzing-support" "log-i32" (func $log-i32 (param i32))) (import "fuzzing-support" "log-i64" (func $log-i64 (param i64))) (import "fuzzing-support" "log-f32" (func $log-f32 (param f32))) @@ -27,37 +16,16 @@ (import "fuzzing-support" "log-exnref" (func $log-exnref (param exnref))) (memory $0 (shared 16 17)) (data (i32.const 0) "N\0fN\f5\f9\b1\ff\fa\eb\e5\fe\a7\ec\fb\fc\f4\a6\e4\ea\f0\ae\e3") - (table $0 17 funcref) - (elem (i32.const 0) $func_1 $func_1 $func_1 $func_5 $func_5 $func_6 $func_6 $func_6 $func_6 $func_6 $func_6 $func_6 $func_6 $func_6 $func_6 $func_8 $func_9) + (table $0 0 funcref) (global $global$ (mut eqref) (ref.null eq)) - (global $global$_0 (mut i32) (i32.const 470177031)) - (global $global$_1 (mut f64) (f64.const 2147483647)) - (global $global$_2 (mut (eqref f32 eqref funcref funcref i64)) (tuple.make - (ref.null eq) - (f32.const -2147483648) - (ref.null eq) - (ref.null func) - (ref.null func) - (i64.const -32) - )) - (global $global$_3 (mut f32) (f32.const -32769)) + (global $global$_0 (mut externref) (ref.null extern)) + (global $global$_1 (mut v128) (v128.const i32x4 0xfffffff9 0x06071c48 0x3f800000 0xc3800ae1)) + (global $global$_2 (mut eqref) (ref.null eq)) + (global $global$_3 (mut f64) (f64.const 0)) (global $hangLimit (mut i32) (i32.const 10)) + (event $event$ (attr 0) (param i64 i32)) (export "hashMemory" (func $hashMemory)) (export "memory" (memory $0)) - (export "func" (func $func)) - (export "func_invoker" (func $func_invoker)) - (export "func_1_invoker" (func $func_1_invoker)) - (export "func_2" (func $func_2)) - (export "func_2_invoker" (func $func_2_invoker)) - (export "func_3" (func $func_3)) - (export "func_3_invoker" (func $func_3_invoker)) - (export "func_4_invoker" (func $func_4_invoker)) - (export "func_5" (func $func_5)) - (export "func_5_invoker" (func $func_5_invoker)) - (export "func_6" (func $func_6)) - (export "func_6_invoker" (func $func_6_invoker)) - (export "func_7" (func $func_7)) - (export "func_8" (func $func_8)) (export "hangLimitInitializer" (func $hangLimitInitializer)) (func $hashMemory (result i32) (local $0 i32) @@ -67,7 +35,7 @@ (global.get $hangLimit) ) (return - (i32.const 69) + (i32.const 235407412) ) ) (global.set $hangLimit @@ -82,18 +50,7 @@ (i32.const 5381) ) (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u - (i32.const 0) - ) - ) + (i32.const 1140933654) ) (local.set $0 (i32.xor @@ -102,109 +59,58 @@ (local.get $0) (i32.const 5) ) - (local.get $0) + (i32.const -127) ) (i32.load8_u offset=1 (i32.const 0) ) ) ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=2 - (i32.const 0) - ) - ) - ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=3 - (i32.const 0) - ) - ) - ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=4 - (i32.const 0) - ) - ) - ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=5 - (i32.const 0) - ) + (f32.store offset=1 align=1 + (i32.and + (i32.const -127) + (i32.const 15) ) + (f32.const -8) ) - (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) + (if + (i32.eqz + (ref.is_null + (ref.null exn) ) ) - ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) + (block $label$1 + (nop) + (br_if $label$1 + (loop $label$2 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 980647737) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$3 (result i32) + (i32.const -1) + ) ) - (local.get $0) - ) - (i32.load8_u offset=7 - (i32.const 0) ) ) - ) - (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=8 - (i32.const 0) + (block $label$4 + (block $label$5 + (nop) + (nop) ) + (nop) ) ) (local.set $0 @@ -214,54 +120,231 @@ (local.get $0) (i32.const 5) ) - (local.get $0) + (i32.const 175316752) ) - (i32.load8_u offset=9 + (i32.load8_u offset=4 (i32.const 0) ) ) ) - (local.set $0 + (local.tee $0 (i32.xor (i32.add - (i32.shl - (local.get $0) - (i32.const 5) + (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$8 (result i32) + (loop $label$9 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 262143) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (block $label$10 + (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) + ) + (loop $label$12 (result v128) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const -13) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (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) + ) + ) + ) + ) + ) + ) + ) + ) + (i32.const 0) + ) + ) + (i32.const 15) + ) + (i31.get_s + (block $label$16 (result i31ref) + (nop) + (i31.new + (i32.const -256) + ) + ) + ) + ) + (return + (i32.const -9) + ) + ) + (block $label$17 + (return + (i32.const 2376257) + ) + ) ) (local.get $0) ) - (i32.load8_u offset=10 + (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.load8_u offset=11 - (i32.const 0) + (tuple.extract 0 + (tuple.make + (i32.const 262145) + (i32.const 110) ) ) ) (local.set $0 - (i32.xor - (i32.add - (i32.shl - (local.get $0) - (i32.const 5) - ) - (local.get $0) - ) - (i32.load8_u offset=12 - (i32.const 0) - ) - ) + (call $hashMemory) ) (local.set $0 (i32.xor @@ -272,7 +355,7 @@ ) (local.get $0) ) - (i32.load8_u offset=13 + (i32.load8_u offset=6 (i32.const 0) ) ) @@ -284,380 +367,283 @@ (local.get $0) (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.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) + ) + (local.get $0) + ) + (i32.load8_u offset=8 + (i32.const 0) + ) ) - (local.get $0) ) - (i32.load8_u offset=15 + (i32.load8_u offset=9 (i32.const 0) ) ) ) - (local.get $0) - ) - ) - (func $func (param $0 i31ref) (param $1 v128) (result exnref) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (ref.null exn) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (ref.null exn) - ) - (func $func_invoker - (drop - (call $func - (i31.new - (i32.const 1633240409) - ) - (v128.const i32x4 0xcf800000 0x4c816020 0x3e1a1a1a 0x00000000) - ) - ) - ) - (func $func_0 (param $0 anyref) (param $1 anyref) (param $2 externref) (param $3 eqref) (param $4 v128) (result i64) - (local $5 eqref) - (local $6 (funcref externref i32 f64 f32 i64)) - (local $7 (f32 funcref eqref i32 i31ref i32)) - (local $8 v128) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (i64.const 2147483647) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$0 (result i64) - (nop) - (br_if $label$0 - (tuple.extract 1 - (tuple.make - (f64.const -255) - (i64.const -127) - (ref.null func) - ) - ) - (i32.const -24) - ) - ) - ) - (func $func_1 (param $0 i31ref) (param $1 externref) (param $2 v128) (param $3 f32) (param $4 f32) (result eqref) - (local $5 v128) - (local $6 (exnref externref i64 i32 f64 funcref)) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (ref.null eq) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (ref.null eq) - ) - (func $func_1_invoker - (drop - (call $func_1 - (i31.new - (i32.const 16777216) - ) - (ref.null extern) - (v128.const i32x4 0x5d455846 0xcf800000 0x42aa0000 0x46b2a800) - (f32.const -17592186044416) - (f32.const -4294967296) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - (drop - (call $func_1 - (i31.new - (i32.const 73) - ) - (ref.null extern) - (v128.const i32x4 0xffff8001 0xffffffff 0x184c764c 0x10105676) - (f32.const -9223372036854775808) - (f32.const 129) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - (drop - (call $func_1 - (i31.new - (i32.const -4096) - ) - (ref.null extern) - (v128.const i32x4 0x00000000 0x00000020 0x00000001 0xffc00000) - (f32.const -nan:0x7fffbd) - (f32.const -255.8040008544922) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - (drop - (call $func_1 - (i31.new - (i32.const 1936946035) - ) - (ref.null extern) - (v128.const i32x4 0xff010001 0x4e07ffff 0x00060002 0xff00001f) - (f32.const 6918) - (f32.const 4.921484278772694e-25) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - ) - (func $func_2 (param $0 funcref) - (local $1 exnref) - (local $2 (f64 externref f32 f32 v128 eqref)) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$0 - (f32.store offset=3 align=2 - (i32.and - (i32.const 15) - (i32.const 15) - ) - (f32.const 66) - ) - (return) - ) - ) - (func $func_2_invoker - (call $func_2 - (ref.null func) - ) - ) - (func $func_3 (param $0 exnref) (result f32) - (local $1 i31ref) - (local $2 i31ref) - (local $3 (i32 externref f64 i32)) - (local $4 externref) - (local $5 (f32 funcref)) - (local $6 i31ref) - (local $7 i31ref) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const -nan:0x7fffa6) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$0 - (loop $label$1 - (block - (if + (block $label$23 + (if + (if (result i32) (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 0.4049999713897705) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (block $label$2 - (i32.store offset=4 align=1 - (i32.and - (block $label$32 (result i32) - (block $label$33 - (nop) - (if - (i32.eqz - (i32.const -1) - ) - (nop) - (nop) - ) - ) - (loop $label$34 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) + (i32.const 218235656) + ) + (block $label$24 + (global.set $global$_3 + (f64.add + (f64.mul + (loop $label$25 (result f64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 56235029) + ) ) - (return - (f32.const 1048576) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) ) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + (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) ) ) - (call $hashMemory) + (f64.const 0.878) + ) + (block $label$27 + (nop) + (br $label$23) ) - ) - (i32.const 15) - ) - (i32.load8_u offset=22 - (i32.and - (i32.const -14) - (i32.const 15) ) ) + (br $label$23) ) - (nop) - ) - (br_if $label$1 - (i32.const 33554431) - ) - (br_if $label$1 - (i32.const 134217729) - ) - ) - ) - (if - (i32.eqz - (i32.const -65535) - ) - (block $label$4 - (global.set $global$_1 - (block $label$23 - (nop) - (return - (f32.const -4503599627370496) - ) + (select + (call $hashMemory) + (i32.const -2147483647) + (i32.const 5909) ) ) - (call $log-i32 - (call $hashMemory) - ) - ) - (loop $label$6 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 2147483648) + (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) + ) + ) ) - ) - (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) ) - (if - (i32.eqz - (i16x8.extract_lane_s 7 - (v128.const i32x4 0x1c5e4449 0x4644c000 0xcf800000 0x477fd300) - ) - ) - (if - (i32.const -127) - (block $label$7 - (memory.copy - (i32.const 32768) - (i32.and - (i32.const 32768) - (i32.const 15) + ) + (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) ) - (global.get $global$_0) ) - (nop) ) - (block $label$8 - (call $log-i32 - (call $hashMemory) + (block (result i32) + (if + (ref.is_null + (block $label$37 + (nop) + (br $label$36) + ) + ) + (nop) + (nop) ) - (i32.atomic.store8 offset=4 - (i32.and - (i32.const -70) - (i32.const 15) + (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 + (br_if $label$39 + (i32.eqz + (i32.const -58) + ) + ) + (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$41 + (if + (i32.const 65534) + (block $label$42 + (nop) + (br_if $label$39 + (i32.eqz + (i32.const -61) + ) + ) + ) + (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) + ) + (return + (i32.const -9) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (i16x8.extract_lane_s 2 + (v128.const i32x4 0x05030804 0x1e070503 0x80000001 0xffffffff) + ) + ) + (memory.atomic.notify offset=22 + (i32.and + (i32.atomic.load offset=22 + (i32.and + (i32.const 1499338050) + (i32.const 15) + ) + ) + (i32.const 15) + ) + (i32.const -2) + ) + ) + (i32.const 15) + ) + (f32.const -9223372036854775808) + ) + ) + ) + (i32.const -2147483648) + ) ) - (i32.const 3342) + ) + (select + (i32.const -127) + (i32.const 8) + (i32.const -255) ) ) ) - (block $label$9 - (global.set $global$_0 - (i32.const 0) - ) - (loop $label$14 + (i32.const 608321884) + ) + (i32.and + (i32.const 72) + (i64.eqz + (loop $label$45 (result i64) (block (if (i32.eqz (global.get $hangLimit) ) (return - (f32.const -0) + (i32.const 2131838335) ) ) (global.set $hangLimit @@ -667,371 +653,326 @@ ) ) ) - (block - (block $label$15 + (block (result i64) + (block $label$46 (nop) - (f64.store offset=4 - (i32.and - (i16x8.extract_lane_s 3 - (v128.const i32x4 0x06143637 0x1df25a02 0x00304800 0x713ecf76) - ) - (i32.const 15) - ) - (global.get $global$_1) - ) ) - (br_if $label$14 - (i31.get_s - (local.get $1) - ) - ) - (call $log-f64 - (f64.div - (f64.load offset=2 align=2 - (i32.and - (i32.const -1) - (i32.const 15) - ) - ) - (f64.load offset=2 align=2 - (i32.and - (call $hashMemory) - (i32.const 15) + (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 + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 55645307) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i32) + (br_if $label$48 + (i32.eqz + (i32.const 4374) + ) + ) + (br_if $label$48 + (i32.const 791226157) + ) + (if (result i32) + (i32.eqz + (i32.const 270077278) + ) + (i32.const -1) + (i32.const 96) + ) + ) + ) + ) + (block $label$49 + (nop) + (br $label$45) + ) + (block $label$50 (result i32) + (loop $label$51 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 44) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (nop) + (br_if $label$51 + (i32.eqz + (i32.const 65507) + ) + ) + (br_if $label$51 + (i32.const 1413679622) + ) + ) + ) + (f64.eq + (f64.const -4095.596) + (f64.const -54) + ) + ) + ) + (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) + ) + ) + ) + ) + (block $label$52 + (if + (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) + ) + ) + ) + (block $label$54 + (drop + (ref.null exn) + ) + (nop) + ) + (block $label$55 + (data.drop 0) + (nop) + ) + ) + (br $label$45) + ) + ) + (call $hashMemory) + ) + ) ) + (br $label$45) ) ) ) + (i64.const 5064094673136993862) ) ) ) ) ) ) - (return - (f32.const 4095.84912109375) - ) - ) - ) - (func $func_3_invoker - (drop - (call $func_3 - (ref.null exn) - ) - ) - (drop - (call $func_3 - (ref.null exn) - ) - ) - (drop - (call $func_3 - (ref.null exn) - ) - ) - ) - (func $func_4 (param $0 funcref) (param $1 funcref) (result funcref f32 exnref exnref) - (local $2 f64) - (local $3 externref) - (local $4 f32) - (local $5 (funcref eqref anyref i32 exnref)) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (tuple.make - (ref.null func) - (f32.const 4294967296) - (ref.null exn) - (ref.null exn) - ) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (tuple.make - (local.get $0) - (f32.const 2147483648) - (ref.null exn) - (ref.null exn) - ) - ) - (func $func_4_invoker - (drop - (call $func_4 - (ref.null func) - (ref.null func) - ) - ) - (drop - (call $func_4 - (ref.null func) - (ref.null func) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - (drop - (call $func_4 - (ref.null func) - (ref.null func) - ) - ) - (drop - (call $func_4 - (ref.null func) - (ref.null func) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - ) - (func $func_5 (param $0 anyref) (result eqref) - (local $1 (anyref anyref i32 f64 exnref f64)) - (local $2 f64) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (ref.null eq) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (return - (ref.null eq) - ) - ) - (func $func_5_invoker - (drop - (call $func_5 - (ref.null any) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - (drop - (call $func_5 - (ref.null any) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - ) - (func $func_6 (param $0 funcref) (param $1 v128) (result eqref) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (ref.null eq) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$0 - (block $label$1 - (if - (i32.const 0) - (block $label$2 - (nop) - (nop) - ) - (block $label$3 - (nop) - (i32.atomic.store8 offset=3 - (i32.const 826952521) - (i31.get_u - (i31.new - (i32.const 2147483647) - ) - ) + (local.set $0 + (i32.xor + (i32.add + (i32.shl + (local.get $0) + (i32.const 5) ) - ) - ) - (block $label$4 - (call $log-i32 - (call $hashMemory) - ) - (local.set $0 (local.get $0) ) - ) - ) - (return - (ref.null eq) - ) - ) - ) - (func $func_6_invoker - (drop - (call $func_6 - (ref.null func) - (v128.const i32x4 0x0e165b0c 0x5b120b08 0x005353f8 0x41d00000) - ) - ) - ) - (func $func_7 (param $0 exnref) (param $1 i64) (param $2 funcref) (param $3 f64) (param $4 f64) (result f32) - (local $5 funcref) - (local $6 (f64 f64 f64)) - (local $7 exnref) - (local $8 f64) - (local $9 eqref) - (local $10 i64) - (local $11 v128) - (local $12 i32) - (local $13 (i31ref v128 f32 i64 exnref)) - (local $14 anyref) - (local $15 (externref eqref externref externref eqref)) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 43) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (select - (loop $label$0 (result f32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (f32.const 18446744073709551615) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (i32.shl + (local.get $0) + (i32.const 5) ) ) - (f32.const -nan:0x7fffeb) ) - (f32.const 18526) - (i32.const -50) - ) - ) - (func $func_8 (result externref) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (ref.null extern) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$0 (result externref) - (call $log-i32 - (call $hashMemory) - ) - (ref.null extern) - ) - ) - (func $func_9 (param $0 eqref) (param $1 externref) (param $2 exnref) (param $3 v128) (param $4 exnref) (result i64) - (local $5 f32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (i64.const -18014398509481983) - ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (loop $label$0 (result i64) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (i64.const 7709) + (nop) + (local.set $0 + (i32.xor + (i32.add + (i32.const 5) + (local.get $0) ) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + (i32.load8_u offset=14 + (i32.const 0) ) ) ) - (block $label$1 (result i64) - (br_if $label$0 - (i32.const 707800420) - ) - (loop $label$2 (result i64) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return - (i64.const 2305843009213693952) + (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) + ) + ) ) + (i32.const 15) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + (i32.const 235020035) + ) + ) + (i64.atomic.store32 offset=22 + (i32.and + (memory.atomic.notify offset=22 + (i32.and + (i32.const 255) + (i32.const 15) ) + (i32.const -255) ) + (i32.const 15) ) - (block $label$3 (result i64) - (data.drop 0) - (i64.const -116) - ) + (i64.const 33554432) ) ) + (local.get $0) ) ) (func $hangLimitInitializer diff --git a/test/unit/test_features.py b/test/unit/test_features.py index a44d58bbd..889b149b1 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -408,5 +408,6 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase): '--enable-reference-types', '--enable-multivalue', '--enable-gc', - '--enable-memory64' + '--enable-memory64', + '--enable-typed-function-references', ], p2.stdout.splitlines()) |