diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gc.wast | 32 | ||||
-rw-r--r-- | test/gc.wast.from-wast | 46 | ||||
-rw-r--r-- | test/gc.wast.fromBinary | 46 | ||||
-rw-r--r-- | test/gc.wast.fromBinary.noDebugInfo | 46 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_all-features.txt | 471 |
5 files changed, 441 insertions, 200 deletions
diff --git a/test/gc.wast b/test/gc.wast index c3c561413..7ce6e01a9 100644 --- a/test/gc.wast +++ b/test/gc.wast @@ -1,21 +1,18 @@ ;; A preliminary test for prototype GC types and instructions. ;; TODO: Move subtype tests from reference-types.wast here? +;; TODO: The test assumes that `(i31.new (i32.const N))` is a valid constant +;; initializer for i31ref types globals, which isn't yet specified. (module - ;; TODO: There are no trivial global initializers for i31ref globals because - ;; i31ref is non-nullable, hence `(ref.null i31)` cannot be used. The test - ;; currently works around this limitation by importing a constant value. - (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref)) - ;; Test global initializer expressions (global $global_anyref (mut anyref) (ref.null any)) (global $global_eqref (mut eqref) (ref.null eq)) - (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref)) ;; ^ + (global $global_i31ref (mut i31ref) (i31.new (i32.const 0))) ;; Test subtype relationship in global initializer expressions (global $global_anyref2 (mut anyref) (ref.null eq)) - (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref)) ;; ^ - (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref)) ;; ^ + (global $global_anyref3 (mut anyref) (i31.new (i32.const 0))) + (global $global_eqref2 (mut eqref) (i31.new (i32.const 0))) (func $test (local $local_i32 i32) @@ -32,7 +29,7 @@ (local.set $local_eqref (ref.null eq)) (local.set $local_i31ref (local.get $local_i31ref)) (local.set $local_i31ref (global.get $global_i31ref)) - (local.set $local_i31ref (global.get $trivial_i31ref)) ;; ^ + (local.set $local_i31ref (i31.new (i32.const 0))) ;; Test subtype relationship for local.set (local.set $local_anyref (local.get $local_eqref)) @@ -40,10 +37,10 @@ (local.set $local_anyref (ref.null eq)) (local.set $local_anyref (local.get $local_i31ref)) (local.set $local_anyref (global.get $global_i31ref)) - (local.set $local_anyref (global.get $trivial_i31ref)) ;; ^ + (local.set $local_anyref (i31.new (i32.const 0))) (local.set $local_eqref (local.get $local_i31ref)) (local.set $local_eqref (global.get $global_i31ref)) - (local.set $local_eqref (global.get $trivial_i31ref)) ;; ^ + (local.set $local_eqref (i31.new (i32.const 0))) ;; Test types for global.get/set (global.set $global_anyref (local.get $local_anyref)) @@ -54,7 +51,7 @@ (global.set $global_eqref (ref.null eq)) (global.set $global_i31ref (local.get $local_i31ref)) (global.set $global_i31ref (global.get $global_i31ref)) - (global.set $global_i31ref (global.get $trivial_i31ref)) ;; ^ + (global.set $global_i31ref (i31.new (i32.const 0))) ;; Test subtype relationship for global.set (global.set $global_anyref (local.get $local_eqref)) @@ -62,17 +59,10 @@ (global.set $global_anyref (ref.null eq)) (global.set $global_anyref (local.get $local_i31ref)) (global.set $global_anyref (global.get $global_i31ref)) - (global.set $global_anyref (global.get $trivial_i31ref)) ;; ^ + (global.set $global_anyref (i31.new (i32.const 0))) (global.set $global_eqref (local.get $local_i31ref)) (global.set $global_eqref (global.get $global_i31ref)) - (global.set $global_eqref (global.get $trivial_i31ref)) ;; ^ - - ;; Test i31.new - (local.set $local_i31ref (i31.new (i32.const 0))) - - ;; Test subtype relationship for i31.new - (local.set $local_anyref (i31.new (i32.const 0))) - (local.set $local_eqref (i31.new (i32.const 0))) + (global.set $global_eqref (i31.new (i32.const 0))) ;; Test i31.get_s/u (local.set $local_i32 (i31.get_s (local.get $local_i31ref))) diff --git a/test/gc.wast.from-wast b/test/gc.wast.from-wast index 7a80cffe6..aeface521 100644 --- a/test/gc.wast.from-wast +++ b/test/gc.wast.from-wast @@ -1,12 +1,17 @@ (module (type $none_=>_none (func)) - (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref)) (global $global_anyref (mut anyref) (ref.null any)) (global $global_eqref (mut eqref) (ref.null eq)) - (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref)) + (global $global_i31ref (mut i31ref) (i31.new + (i32.const 0) + )) (global $global_anyref2 (mut anyref) (ref.null eq)) - (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref)) - (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref)) + (global $global_anyref3 (mut anyref) (i31.new + (i32.const 0) + )) + (global $global_eqref2 (mut eqref) (i31.new + (i32.const 0) + )) (func $test (local $local_i32 i32) (local $local_anyref anyref) @@ -37,7 +42,9 @@ (global.get $global_i31ref) ) (local.set $local_i31ref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (local.set $local_anyref (local.get $local_eqref) @@ -55,7 +62,9 @@ (global.get $global_i31ref) ) (local.set $local_anyref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (local.set $local_eqref (local.get $local_i31ref) @@ -64,7 +73,9 @@ (global.get $global_i31ref) ) (local.set $local_eqref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_anyref (local.get $local_anyref) @@ -91,7 +102,9 @@ (global.get $global_i31ref) ) (global.set $global_i31ref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_anyref (local.get $local_eqref) @@ -109,7 +122,9 @@ (global.get $global_i31ref) ) (global.set $global_anyref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_eqref (local.get $local_i31ref) @@ -118,19 +133,6 @@ (global.get $global_i31ref) ) (global.set $global_eqref - (global.get $trivial_i31ref) - ) - (local.set $local_i31ref - (i31.new - (i32.const 0) - ) - ) - (local.set $local_anyref - (i31.new - (i32.const 0) - ) - ) - (local.set $local_eqref (i31.new (i32.const 0) ) diff --git a/test/gc.wast.fromBinary b/test/gc.wast.fromBinary index d86c08985..4d22c984f 100644 --- a/test/gc.wast.fromBinary +++ b/test/gc.wast.fromBinary @@ -1,12 +1,17 @@ (module (type $none_=>_none (func)) - (import "env" "trivial_i31ref" (global $trivial_i31ref i31ref)) (global $global_anyref (mut anyref) (ref.null any)) (global $global_eqref (mut eqref) (ref.null eq)) - (global $global_i31ref (mut i31ref) (global.get $trivial_i31ref)) + (global $global_i31ref (mut i31ref) (i31.new + (i32.const 0) + )) (global $global_anyref2 (mut anyref) (ref.null eq)) - (global $global_anyref3 (mut anyref) (global.get $trivial_i31ref)) - (global $global_eqref2 (mut eqref) (global.get $trivial_i31ref)) + (global $global_anyref3 (mut anyref) (i31.new + (i32.const 0) + )) + (global $global_eqref2 (mut eqref) (i31.new + (i32.const 0) + )) (func $test (local $local_i32 i32) (local $local_anyref anyref) @@ -37,7 +42,9 @@ (global.get $global_i31ref) ) (local.set $local_i31ref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (local.set $local_anyref (local.get $local_eqref) @@ -55,7 +62,9 @@ (global.get $global_i31ref) ) (local.set $local_anyref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (local.set $local_eqref (local.get $local_i31ref) @@ -64,7 +73,9 @@ (global.get $global_i31ref) ) (local.set $local_eqref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_anyref (local.get $local_anyref) @@ -91,7 +102,9 @@ (global.get $global_i31ref) ) (global.set $global_i31ref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_anyref (local.get $local_eqref) @@ -109,7 +122,9 @@ (global.get $global_i31ref) ) (global.set $global_anyref - (global.get $trivial_i31ref) + (i31.new + (i32.const 0) + ) ) (global.set $global_eqref (local.get $local_i31ref) @@ -118,19 +133,6 @@ (global.get $global_i31ref) ) (global.set $global_eqref - (global.get $trivial_i31ref) - ) - (local.set $local_i31ref - (i31.new - (i32.const 0) - ) - ) - (local.set $local_anyref - (i31.new - (i32.const 0) - ) - ) - (local.set $local_eqref (i31.new (i32.const 0) ) diff --git a/test/gc.wast.fromBinary.noDebugInfo b/test/gc.wast.fromBinary.noDebugInfo index 9989a5ad8..9fd83ad04 100644 --- a/test/gc.wast.fromBinary.noDebugInfo +++ b/test/gc.wast.fromBinary.noDebugInfo @@ -1,12 +1,17 @@ (module (type $none_=>_none (func)) - (import "env" "trivial_i31ref" (global $gimport$0 i31ref)) (global $global$0 (mut anyref) (ref.null any)) (global $global$1 (mut eqref) (ref.null eq)) - (global $global$2 (mut i31ref) (global.get $gimport$0)) + (global $global$2 (mut i31ref) (i31.new + (i32.const 0) + )) (global $global$3 (mut anyref) (ref.null eq)) - (global $global$4 (mut anyref) (global.get $gimport$0)) - (global $global$5 (mut eqref) (global.get $gimport$0)) + (global $global$4 (mut anyref) (i31.new + (i32.const 0) + )) + (global $global$5 (mut eqref) (i31.new + (i32.const 0) + )) (func $0 (local $0 i32) (local $1 anyref) @@ -37,7 +42,9 @@ (global.get $global$2) ) (local.set $3 - (global.get $gimport$0) + (i31.new + (i32.const 0) + ) ) (local.set $1 (local.get $2) @@ -55,7 +62,9 @@ (global.get $global$2) ) (local.set $1 - (global.get $gimport$0) + (i31.new + (i32.const 0) + ) ) (local.set $2 (local.get $3) @@ -64,7 +73,9 @@ (global.get $global$2) ) (local.set $2 - (global.get $gimport$0) + (i31.new + (i32.const 0) + ) ) (global.set $global$0 (local.get $1) @@ -91,7 +102,9 @@ (global.get $global$2) ) (global.set $global$2 - (global.get $gimport$0) + (i31.new + (i32.const 0) + ) ) (global.set $global$0 (local.get $2) @@ -109,7 +122,9 @@ (global.get $global$2) ) (global.set $global$0 - (global.get $gimport$0) + (i31.new + (i32.const 0) + ) ) (global.set $global$1 (local.get $3) @@ -118,19 +133,6 @@ (global.get $global$2) ) (global.set $global$1 - (global.get $gimport$0) - ) - (local.set $3 - (i31.new - (i32.const 0) - ) - ) - (local.set $1 - (i31.new - (i32.const 0) - ) - ) - (local.set $2 (i31.new (i32.const 0) ) diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt index 91c9dffe8..ab8ac7ca2 100644 --- a/test/passes/translate-to-fuzz_all-features.txt +++ b/test/passes/translate-to-fuzz_all-features.txt @@ -1,12 +1,21 @@ (module - (type $f32_=>_none (func (param f32))) (type $none_=>_none (func)) + (type $none_=>_i32 (func (result i32))) (type $i32_=>_none (func (param i32))) (type $i64_=>_none (func (param i64))) + (type $f32_=>_none (func (param f32))) (type $f64_=>_none (func (param f64))) (type $v128_=>_none (func (param v128))) (type $exnref_=>_none (func (param exnref))) - (type $none_=>_i32 (func (result i32))) + (type $none_=>_i64 (func (result i64))) + (type $externref_eqref_funcref_=>_i64 (func (param externref eqref funcref) (result i64))) + (type $none_=>_f32 (func (result f32))) + (type $i32_i32_f32_exnref_=>_externref (func (param i32 i32 f32 exnref) (result externref))) + (type $externref_f64_f32_eqref_i31ref_anyref_=>_externref (func (param externref f64 f32 eqref i31ref anyref) (result externref))) + (type $exnref_f32_i31ref_externref_funcref_i31ref_i64_=>_exnref (func (param exnref f32 i31ref externref funcref i31ref i64) (result exnref))) + (type $none_=>_exnref_anyref_v128 (func (result exnref anyref v128))) + (type $externref_i32_eqref_v128_=>_exnref_anyref_v128 (func (param externref i32 eqref v128) (result exnref anyref v128))) + (type $none_=>_i31ref (func (result i31ref))) (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))) @@ -15,22 +24,28 @@ (import "fuzzing-support" "log-exnref" (func $log-exnref (param exnref))) (memory $0 (shared 1 1)) (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 0 0 funcref) + (table $0 5 5 funcref) + (elem (i32.const 0) $func_9 $func_9 $func_9 $func_10 $func_16) (global $global$5 (mut eqref) (ref.null eq)) - (global $global$4 (mut externref) (ref.null extern)) - (global $global$3 (mut exnref) (ref.null exn)) - (global $global$2 (mut funcref) (ref.null func)) - (global $global$1 (mut (v128 funcref i64 anyref eqref exnref)) (tuple.make - (v128.const i32x4 0x0c0d0c62 0x48060d0d 0x000000ff 0x00000000) - (ref.null func) - (i64.const -2199023255552) - (ref.null any) + (global $global$4 (mut i32) (i32.const 470177031)) + (global $global$3 (mut f64) (f64.const 2147483647)) + (global $global$2 (mut (eqref f32 eqref funcref funcref i64)) (tuple.make (ref.null eq) - (ref.null exn) + (f32.const -2147483648) + (ref.null eq) + (ref.null func) + (ref.null func) + (i64.const -32) )) + (global $global$1 (mut f32) (f32.const -32769)) (global $hangLimit (mut i32) (i32.const 10)) (export "hashMemory" (func $hashMemory)) (export "memory" (memory $0)) + (export "func_7_invoker" (func $func_7_invoker)) + (export "func_9" (func $func_9)) + (export "func_11_invoker" (func $func_11_invoker)) + (export "func_14_invoker" (func $func_14_invoker)) + (export "func_17" (func $func_17)) (export "hangLimitInitializer" (func $hangLimitInitializer)) (func $hashMemory (result i32) (local $0 i32) @@ -263,20 +278,53 @@ ) (local.get $0) ) - (func $func_7 (param $0 f32) - (local $1 (anyref externref)) - (local $2 i32) - (local $3 i64) - (local $4 funcref) - (local $5 v128) - (local $6 (funcref anyref f32 i32 exnref)) - (local $7 i32) + (func $func_7 (param $0 i32) (param $1 i32) (param $2 f32) (param $3 exnref) (result externref) + (local $4 i32) (block (if (i32.eqz (global.get $hangLimit) ) - (return) + (return + (ref.null extern) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (ref.null extern) + ) + (func $func_7_invoker + (drop + (call $func_7 + (i32.const -127) + (i32.const -268435456) + (f32.const 1179405440) + (ref.null exn) + ) + ) + (call $log-i32 + (call $hashMemory) + ) + ) + (func $func_9 (result f32) + (local $0 anyref) + (local $1 f64) + (local $2 (anyref anyref)) + (local $3 eqref) + (local $4 externref) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (f32.const 1.4949444621624858e-31) + ) ) (global.set $hangLimit (i32.sub @@ -286,110 +334,307 @@ ) ) (block $label$0 - (call $log-f64 - (if (result f64) - (i32.eqz - (i32.const 32768) - ) - (block $label$1 - (br_if $label$0 - (i32.eqz - (ref.eq - (ref.null eq) - (loop $label$21 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$22 - (nop) - (br $label$21) - ) - ) - ) - ) - ) - (if - (i32.eqz - (i32.const -33554432) - ) - (block $label$2 - (br_if $label$2 - (i32.eqz - (local.get $2) - ) - ) - (call $log-i32 - (call $hashMemory) - ) - ) - (drop - (ref.null extern) - ) - ) - (br $label$0) + (nop) + (block $label$1 + (nop) + (return + (f32.const 7.396028525772014e-24) + ) + ) + ) + ) + (func $func_10 (param $0 externref) (param $1 f64) (param $2 f32) (param $3 eqref) (param $4 i31ref) (param $5 anyref) (result externref) + (local $6 i64) + (local $7 (anyref exnref f32 f64 f64)) + (local $8 eqref) + (local $9 exnref) + (local $10 i64) + (local $11 f64) + (local $12 f32) + (local $13 v128) + (local $14 exnref) + (local $15 (funcref funcref v128 i31ref v128)) + (local $16 anyref) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (ref.null extern) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (ref.null extern) + ) + (func $func_11 (param $0 exnref) (param $1 f32) (param $2 i31ref) (param $3 externref) (param $4 funcref) (param $5 i31ref) (param $6 i64) (result exnref) + (local $7 (i32 i64 anyref externref externref eqref)) + (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_11_invoker + (drop + (call $func_11 + (ref.null exn) + (f32.const -1022.1400146484375) + (i31.new + (i32.const -32766) + ) + (ref.null extern) + (ref.null func) + (i31.new + (i32.const -65535) + ) + (i64.const 3) + ) + ) + (call $log-i32 + (call $hashMemory) + ) + ) + (func $func_13 (result i31ref) + (local $0 i31ref) + (local $1 (funcref f32 anyref f32 externref)) + (local $2 f64) + (local $3 f64) + (local $4 (i32 v128)) + (local $5 (anyref i64 v128 eqref funcref exnref)) + (local $6 i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i31.new + (i32.const -28) ) - (loop $label$4 (result f64) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (f64.const 82) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (i31.new + (i32.const 64) + ) + ) + (func $func_14 (result i32) + (local $0 i32) + (local $1 funcref) + (local $2 (anyref externref)) + (local $3 funcref) + (local $4 i64) + (local $5 externref) + (local $6 (exnref f64)) + (local $7 (anyref f64 f64)) + (local $8 (i64 i32 eqref exnref)) + (local $9 (v128 i64 funcref i32 anyref anyref)) + (local $10 (i32 eqref f64 funcref)) + (local $11 eqref) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i32.const 471818526) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$0 (result i32) + (nop) + (local.get $0) + ) + ) + (func $func_14_invoker + (drop + (call $func_14) + ) + (call $log-i32 + (call $hashMemory) + ) + (drop + (call $func_14) + ) + (drop + (call $func_14) + ) + (drop + (call $func_14) + ) + (drop + (call $func_14) + ) + (drop + (call $func_14) + ) + (call $log-i32 + (call $hashMemory) + ) + (drop + (call $func_14) + ) + (call $log-i32 + (call $hashMemory) + ) + ) + (func $func_16 (param $0 externref) (param $1 i32) (param $2 eqref) (param $3 v128) (result exnref anyref v128) + (local $4 exnref) + (local $5 i31ref) + (local $6 eqref) + (local $7 funcref) + (local $8 (i31ref eqref f64)) + (local $9 v128) + (local $10 eqref) + (local $11 exnref) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (tuple.make + (ref.null exn) + (ref.null any) + (v128.const i32x4 0x0c1f021d 0x00020814 0x4742fffc 0x007f252c) ) ) ) - (call $log-v128 - (if (result v128) - (local.tee $7 - (block $label$23 - (nop) - (return) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$0 + (call $log-i32 + (local.get $1) + ) + (return + (tuple.make + (ref.null exn) + (ref.null any) + (v128.const i32x4 0x00010001 0xfff00000 0xffff8001 0x00000202) + ) + ) + ) + ) + (func $func_17 (result i64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i64.const 590056222575119631) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (i64.const 650238098827575305) + ) + (func $func_18 (param $0 externref) (param $1 eqref) (param $2 funcref) (result i64) + (local $3 f32) + (local $4 eqref) + (local $5 exnref) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i64.const -1) + ) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$0 (result i64) + (nop) + (local.set $5 + (local.get $5) + ) + (br_if $label$0 + (if (result i64) + (i32.const 0) + (block $label$2 (result i64) + (nop) + (br_if $label$2 + (i64.or + (i64.const -2147483648) + (i64.const 3088) + ) + (i32.const -17) ) ) - (loop $label$5 - (block - (if - (i32.eqz - (global.get $hangLimit) + (block $label$11 (result i64) + (nop) + (call $log-f64 + (f64.const 3848309694063512128130702e64) + ) + (loop $label$12 (result i64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return + (i64.const -32768) + ) ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) ) ) - ) - (block $label$6 - (drop - (ref.null extern) - ) - (br $label$5) + (i64.const 4883) ) ) - (v128.const i32x4 0x55490b31 0x1b002f01 0x00015c17 0x022a1b01) ) + (i32.const 8) ) ) ) |