diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/heap-types.wast | 13 | ||||
-rw-r--r-- | test/heap-types.wast.from-wast | 13 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary | 13 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary.noDebugInfo | 13 | ||||
-rw-r--r-- | test/passes/O1_fuzz-exec_all-features.txt | 52 | ||||
-rw-r--r-- | test/passes/O1_fuzz-exec_all-features.wast | 37 |
6 files changed, 141 insertions, 0 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast index 7e44e4fdb..c25c4ac61 100644 --- a/test/heap-types.wast +++ b/test/heap-types.wast @@ -86,6 +86,19 @@ (local.get $x) (i32.const 100) ) + (drop + (struct.new_default_with_rtt $struct.A + (rtt.canon $struct.A) + ) + ) + (drop + (struct.new_with_rtt $struct.A + (rtt.canon $struct.A) + (i32.const 1) + (f32.const 2.345) + (f64.const 3.14159) + ) + ) (unreachable) ) ;; RTT types as parameters diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index 6f3c20589..3fad50922 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -88,6 +88,19 @@ (local.get $x) (i32.const 100) ) + (drop + (struct.new_default_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + ) + ) + (drop + (struct.new_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + (i32.const 1) + (f32.const 2.3450000286102295) + (f64.const 3.14159) + ) + ) (unreachable) ) (func $rtt-param-with-depth (param $rtt (rtt 1 ${})) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 537096fe0..315d30d38 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -88,6 +88,19 @@ (local.get $x) (i32.const 100) ) + (drop + (struct.new_default_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + ) + ) + (drop + (struct.new_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + (i32.const 1) + (f32.const 2.3450000286102295) + (f64.const 3.14159) + ) + ) (unreachable) ) (func $rtt-param-with-depth (param $rtt (rtt 1 ${})) diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo index 19e5f701d..9f54a8071 100644 --- a/test/heap-types.wast.fromBinary.noDebugInfo +++ b/test/heap-types.wast.fromBinary.noDebugInfo @@ -88,6 +88,19 @@ (local.get $0) (i32.const 100) ) + (drop + (struct.new_default_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + ) + ) + (drop + (struct.new_with_rtt ${i32_f32_f64} + (rtt.canon ${i32_f32_f64}) + (i32.const 1) + (f32.const 2.3450000286102295) + (f64.const 3.14159) + ) + ) (unreachable) ) (func $1 (param $0 (rtt 1 ${})) diff --git a/test/passes/O1_fuzz-exec_all-features.txt b/test/passes/O1_fuzz-exec_all-features.txt new file mode 100644 index 000000000..522943d69 --- /dev/null +++ b/test/passes/O1_fuzz-exec_all-features.txt @@ -0,0 +1,52 @@ +[fuzz-exec] calling structs +[LoggingExternalInterface logging 0] +[LoggingExternalInterface logging 42] +[LoggingExternalInterface logging 100] +[LoggingExternalInterface logging 100] +(module + (type ${i32} (struct (field i32))) + (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (import "fuzzing-support" "log-i32" (func $log (param i32))) + (export "structs" (func $0)) + (func $0 + (local $0 (ref null ${i32})) + (call $log + (struct.get ${i32} 0 + (local.tee $0 + (struct.new_default_with_rtt ${i32} + (rtt.canon ${i32}) + ) + ) + ) + ) + (struct.set ${i32} 0 + (local.get $0) + (i32.const 42) + ) + (call $log + (struct.get ${i32} 0 + (local.get $0) + ) + ) + (struct.set ${i32} 0 + (local.get $0) + (i32.const 100) + ) + (call $log + (struct.get ${i32} 0 + (local.get $0) + ) + ) + (call $log + (struct.get ${i32} 0 + (local.get $0) + ) + ) + ) +) +[fuzz-exec] calling structs +[LoggingExternalInterface logging 0] +[LoggingExternalInterface logging 42] +[LoggingExternalInterface logging 100] +[LoggingExternalInterface logging 100] diff --git a/test/passes/O1_fuzz-exec_all-features.wast b/test/passes/O1_fuzz-exec_all-features.wast new file mode 100644 index 000000000..0740e60e7 --- /dev/null +++ b/test/passes/O1_fuzz-exec_all-features.wast @@ -0,0 +1,37 @@ +(module + (type $struct (struct i32)) + (import "fuzzing-support" "log-i32" (func $log (param i32))) + (func "structs" + (local $x (ref null $struct)) + (local $y (ref null $struct)) + (local.set $x + (struct.new_default_with_rtt $struct + (rtt.canon $struct) + ) + ) + ;; The value is initialized to 0 + (call $log + (struct.get $struct 0 (local.get $x)) + ) + ;; Assigning a value works + (struct.set $struct 0 + (local.get $x) + (i32.const 42) + ) + (call $log + (struct.get $struct 0 (local.get $x)) + ) + ;; References are references, so writing to one's value affects the other's + (local.set $y (local.get $x)) + (struct.set $struct 0 + (local.get $y) + (i32.const 100) + ) + (call $log + (struct.get $struct 0 (local.get $x)) + ) + (call $log + (struct.get $struct 0 (local.get $y)) + ) + ) +) |