summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast1
-rw-r--r--test/heap-types.wast.from-wast3
-rw-r--r--test/heap-types.wast.fromBinary3
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo5
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt51
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast44
6 files changed, 105 insertions, 2 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 06ceceb3b..0f8c3840c 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -36,6 +36,7 @@
(global $rttparent (rtt 0 $parent) (rtt.canon $parent))
(global $rttchild (rtt 1 $child) (rtt.sub $child (global.get $rttparent)))
(global $rttgrandchild (rtt 2 $grandchild) (rtt.sub $grandchild (global.get $rttchild)))
+ (global $rttfreshgrandchild (rtt 2 $grandchild) (rtt.fresh_sub $grandchild (global.get $rttchild)))
(type $nested-child-struct (struct (field (mut (ref $child)))))
(type $nested-child-array (array (mut (ref $child))))
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 6c4b837e8..e6bd0f31e 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -25,6 +25,9 @@
(global $rttgrandchild (rtt 2 $grandchild) (rtt.sub $grandchild
(global.get $rttchild)
))
+ (global $rttfreshgrandchild (rtt 2 $grandchild) (rtt.fresh_sub $grandchild
+ (global.get $rttchild)
+ ))
(global $struct.new-in-global (ref $struct.A) (struct.new_default_with_rtt $struct.A
(rtt.canon $struct.A)
))
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 1e3cc9527..d50532334 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -25,6 +25,9 @@
(global $rttgrandchild (rtt 2 $grandchild) (rtt.sub $grandchild
(global.get $rttchild)
))
+ (global $rttfreshgrandchild (rtt 2 $grandchild) (rtt.fresh_sub $grandchild
+ (global.get $rttchild)
+ ))
(global $struct.new-in-global (ref $struct.A) (struct.new_default_with_rtt $struct.A
(rtt.canon $struct.A)
))
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 30bfd1064..3d1f00a7c 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -25,7 +25,10 @@
(global $global$2 (rtt 2 ${i32_i64}) (rtt.sub ${i32_i64}
(global.get $global$1)
))
- (global $global$3 (ref ${i32_f32_f64}) (struct.new_default_with_rtt ${i32_f32_f64}
+ (global $global$3 (rtt 2 ${i32_i64}) (rtt.fresh_sub ${i32_i64}
+ (global.get $global$1)
+ ))
+ (global $global$4 (ref ${i32_f32_f64}) (struct.new_default_with_rtt ${i32_f32_f64}
(rtt.canon ${i32_f32_f64})
))
(func $0 (param $0 (ref ${i32_f32_f64})) (result (ref ${i8_mut:i16_ref|{i32_f32_f64}|_mut:ref|{i32_f32_f64}|}))
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index 2ce8cfa00..6d342196e 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -57,16 +57,21 @@
[LoggingExternalInterface logging 99]
[LoggingExternalInterface logging 0]
[LoggingExternalInterface logging 10]
+[fuzz-exec] calling rtt_Fresh
+[LoggingExternalInterface logging 1]
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 1]
(module
- (type $void_func (func))
(type $struct (struct (field (mut i32))))
(type $extendedstruct (struct (field (mut i32)) (field f64)))
+ (type $void_func (func))
(type $bytes (array (mut i8)))
(type $int_func (func (result i32)))
(type $i32_=>_none (func (param i32)))
(type $anyref_=>_none (func (param anyref)))
(type $eqref_=>_none (func (param eqref)))
(import "fuzzing-support" "log-i32" (func $log (param i32)))
+ (global $rtt (mut (rtt $extendedstruct)) (rtt.canon $extendedstruct))
(elem declare func $a-void-func $call-target)
(export "structs" (func $0))
(export "arrays" (func $1))
@@ -86,6 +91,7 @@
(export "init-array-packed" (func $17))
(export "cast-func-to-struct" (func $19))
(export "array-copy" (func $20))
+ (export "rtt_Fresh" (func $21))
(func $0 (; has Stack IR ;)
(local $0 i32)
(call $log
@@ -439,6 +445,45 @@
)
)
)
+ (func $21 (; has Stack IR ;)
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ )
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (rtt.fresh_sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ )
+ (global.set $rtt
+ (rtt.fresh_sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (global.get $rtt)
+ )
+ (global.get $rtt)
+ )
+ )
+ )
)
[fuzz-exec] calling structs
[LoggingExternalInterface logging 0]
@@ -498,6 +543,10 @@
[LoggingExternalInterface logging 99]
[LoggingExternalInterface logging 0]
[LoggingExternalInterface logging 10]
+[fuzz-exec] calling rtt_Fresh
+[LoggingExternalInterface logging 1]
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 1]
ignoring comparison of ExecutionResults!
[fuzz-exec] calling foo
[host limit allocation failure]
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index 93935d5c4..520747075 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -8,6 +8,8 @@
(import "fuzzing-support" "log-i32" (func $log (param i32)))
+ (global $rtt (mut (rtt $extendedstruct)) (rtt.canon $extendedstruct))
+
(func "structs"
(local $x (ref null $struct))
(local $y (ref null $struct))
@@ -431,6 +433,48 @@
(array.get_u $bytes (local.get $x) (i32.const 12))
)
)
+ (func "rtt_Fresh"
+ ;; Casting to the same sequence of rtt.subs works.
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ )
+ ;; But not with fresh!
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (rtt.sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (rtt.fresh_sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ )
+ ;; Casts with fresh succeed, if we use the same fresh rtt.
+ (global.set $rtt
+ (rtt.fresh_sub $extendedstruct
+ (rtt.canon $struct)
+ )
+ )
+ (call $log
+ (ref.test
+ (struct.new_default_with_rtt $extendedstruct
+ (global.get $rtt)
+ )
+ (global.get $rtt)
+ )
+ )
+ )
)
(module
(type $[mut:i8] (array (mut i8)))