summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast58
-rw-r--r--test/heap-types.wast.from-wast74
-rw-r--r--test/heap-types.wast.fromBinary74
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo78
4 files changed, 254 insertions, 30 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index c25c4ac61..1162bee16 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -19,6 +19,8 @@
;; Arrays
(type $vector (array (mut f64)))
(type $matrix (array (ref $vector)))
+ (type $bytes (array (mut i8)))
+ (type $words (array (mut i32)))
;; RTT
(type $parent (struct))
@@ -28,7 +30,7 @@
(global $rttchild (rtt 1 $child) (rtt.sub $child (global.get $rttparent)))
(global $rttgrandchild (rtt 2 $grandchild) (rtt.sub $grandchild (global.get $rttchild)))
- (func "foo" (param $x (ref $struct.A)) (result (ref $struct.B))
+ (func $structs (param $x (ref $struct.A)) (result (ref $struct.B))
(local $tA (ref null $struct.A))
(local $tB (ref null $struct.B))
(local $tc (ref null $struct.C))
@@ -101,6 +103,60 @@
)
(unreachable)
)
+ (func $arrays (param $x (ref $vector)) (result (ref $matrix))
+ (local $tv (ref null $vector))
+ (local $tm (ref null $matrix))
+ (local $tb (ref null $bytes))
+ (local $tw (ref null $words))
+ (drop
+ (array.new_with_rtt $vector
+ (rtt.canon $vector)
+ (i32.const 3)
+ (f64.const 3.14159)
+ )
+ )
+ (drop
+ (array.new_default_with_rtt $matrix
+ (rtt.canon $matrix)
+ (i32.const 10)
+ )
+ )
+ (drop
+ (array.get $vector
+ (local.get $x)
+ (i32.const 2)
+ )
+ )
+ (array.set $vector
+ (local.get $x)
+ (i32.const 2)
+ (f64.const 2.18281828)
+ )
+ (drop
+ (array.len $vector
+ (local.get $x)
+ )
+ )
+ (drop
+ (array.get $words
+ (local.get $tw)
+ (i32.const 1)
+ )
+ )
+ (drop
+ (array.get_u $bytes
+ (local.get $tb)
+ (i32.const 2)
+ )
+ )
+ (drop
+ (array.get_s $bytes
+ (local.get $tb)
+ (i32.const 3)
+ )
+ )
+ (unreachable)
+ )
;; RTT types as parameters
(func $rtt-param-with-depth (param $rtt (rtt 1 $parent)))
(func $rtt-param-without-depth (param $rtt (rtt $parent)))
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 3fad50922..f3ba97d99 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -1,15 +1,18 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
- (type ${} (struct ))
(type $[mut:f64] (array (mut f64)))
+ (type ${} (struct ))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
(type ${mut:f32} (struct (field (mut f32))))
- (type ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[mut:i32] (array (mut i32)))
+ (type $[mut:i8] (array (mut i8)))
+ (type ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
(type $rtt_1_${}_=>_none (func (param (rtt 1 ${}))))
(type $rtt_${}_=>_none (func (param (rtt ${}))))
- (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
- (type $ref?|{i32_f32_f64}|_=>_ref?|{i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|{i32_f32_f64}|_=>_ref?|{i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|[mut:f64]|_=>_ref?|[ref?|[mut:f64]|]| (func (param (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))))
(global $rttparent (rtt 0 ${}) (rtt.canon ${}))
(global $rttchild (rtt 1 ${i32}) (rtt.sub ${i32}
(global.get $rttparent)
@@ -17,10 +20,9 @@
(global $rttgrandchild (rtt 2 ${i32_i64}) (rtt.sub ${i32_i64}
(global.get $rttchild)
))
- (export "foo" (func $0))
- (func $0 (param $x (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (func $structs (param $x (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $tA (ref null ${i32_f32_f64}))
- (local $tB (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (local $tB (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $tc (ref null ${mut:f32}))
(local $tv (ref null $[mut:f64]))
(local $tm (ref null $[ref?|[mut:f64]|]))
@@ -48,12 +50,12 @@
)
)
(drop
- (struct.get_u ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_u ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $tB)
)
)
(drop
- (struct.get_s ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_s ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $tB)
)
)
@@ -103,6 +105,60 @@
)
(unreachable)
)
+ (func $arrays (param $x (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))
+ (local $tv (ref null $[mut:f64]))
+ (local $tm (ref null $[ref?|[mut:f64]|]))
+ (local $tb (ref null $[mut:i8]))
+ (local $tw (ref null $[mut:i32]))
+ (drop
+ (array.new_with_rtt $[mut:f64]
+ (rtt.canon $[mut:f64])
+ (i32.const 3)
+ (f64.const 3.14159)
+ )
+ )
+ (drop
+ (array.new_default_with_rtt $[ref?|[mut:f64]|]
+ (rtt.canon $[ref?|[mut:f64]|])
+ (i32.const 10)
+ )
+ )
+ (drop
+ (array.get $[mut:f64]
+ (local.get $x)
+ (i32.const 2)
+ )
+ )
+ (array.set $[mut:f64]
+ (local.get $x)
+ (i32.const 2)
+ (f64.const 2.18281828)
+ )
+ (drop
+ (array.len $[mut:f64]
+ (local.get $x)
+ )
+ )
+ (drop
+ (array.get $[mut:i32]
+ (local.get $tw)
+ (i32.const 1)
+ )
+ )
+ (drop
+ (array.get_u $[mut:i8]
+ (local.get $tb)
+ (i32.const 2)
+ )
+ )
+ (drop
+ (array.get_s $[mut:i8]
+ (local.get $tb)
+ (i32.const 3)
+ )
+ )
+ (unreachable)
+ )
(func $rtt-param-with-depth (param $rtt (rtt 1 ${}))
(nop)
)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 315d30d38..7917d95e0 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -1,15 +1,18 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
- (type ${} (struct ))
(type $[mut:f64] (array (mut f64)))
+ (type ${} (struct ))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
(type ${mut:f32} (struct (field (mut f32))))
- (type ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[mut:i32] (array (mut i32)))
+ (type $[mut:i8] (array (mut i8)))
+ (type ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
(type $rtt_1_${}_=>_none (func (param (rtt 1 ${}))))
(type $rtt_${}_=>_none (func (param (rtt ${}))))
- (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
- (type $ref?|{i32_f32_f64}|_=>_ref?|{i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|{i32_f32_f64}|_=>_ref?|{i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|[mut:f64]|_=>_ref?|[ref?|[mut:f64]|]| (func (param (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))))
(global $rttparent (rtt 0 ${}) (rtt.canon ${}))
(global $rttchild (rtt 1 ${i32}) (rtt.sub ${i32}
(global.get $rttparent)
@@ -17,10 +20,9 @@
(global $rttgrandchild (rtt 2 ${i32_i64}) (rtt.sub ${i32_i64}
(global.get $rttchild)
))
- (export "foo" (func $0))
- (func $0 (param $x (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (func $structs (param $x (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $tA (ref null ${i32_f32_f64}))
- (local $tB (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (local $tB (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $tc (ref null ${mut:f32}))
(local $tv (ref null $[ref?|[mut:f64]|]))
(local $tm (ref null $[mut:f64]))
@@ -48,12 +50,12 @@
)
)
(drop
- (struct.get_u ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_u ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $tB)
)
)
(drop
- (struct.get_s ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_s ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $tB)
)
)
@@ -103,6 +105,60 @@
)
(unreachable)
)
+ (func $arrays (param $x (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))
+ (local $tv (ref null $[ref?|[mut:f64]|]))
+ (local $tm (ref null $[mut:i32]))
+ (local $tb (ref null $[mut:i8]))
+ (local $tw (ref null $[mut:f64]))
+ (drop
+ (array.new_with_rtt $[mut:f64]
+ (rtt.canon $[mut:f64])
+ (i32.const 3)
+ (f64.const 3.14159)
+ )
+ )
+ (drop
+ (array.new_default_with_rtt $[ref?|[mut:f64]|]
+ (rtt.canon $[ref?|[mut:f64]|])
+ (i32.const 10)
+ )
+ )
+ (drop
+ (array.get $[mut:f64]
+ (local.get $x)
+ (i32.const 2)
+ )
+ )
+ (array.set $[mut:f64]
+ (local.get $x)
+ (i32.const 2)
+ (f64.const 2.18281828)
+ )
+ (drop
+ (array.len $[mut:f64]
+ (local.get $x)
+ )
+ )
+ (drop
+ (array.get $[mut:i32]
+ (local.get $tm)
+ (i32.const 1)
+ )
+ )
+ (drop
+ (array.get_u $[mut:i8]
+ (local.get $tb)
+ (i32.const 2)
+ )
+ )
+ (drop
+ (array.get_s $[mut:i8]
+ (local.get $tb)
+ (i32.const 3)
+ )
+ )
+ (unreachable)
+ )
(func $rtt-param-with-depth (param $rtt (rtt 1 ${}))
(nop)
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 9f54a8071..5fa0352c6 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -1,15 +1,18 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
- (type ${} (struct ))
(type $[mut:f64] (array (mut f64)))
+ (type ${} (struct ))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
(type ${mut:f32} (struct (field (mut f32))))
- (type ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[mut:i32] (array (mut i32)))
+ (type $[mut:i8] (array (mut i8)))
+ (type ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref null ${i32_f32_f64})) (field (mut (ref null ${i32_f32_f64})))))
+ (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
(type $rtt_1_${}_=>_none (func (param (rtt 1 ${}))))
(type $rtt_${}_=>_none (func (param (rtt ${}))))
- (type $[ref?|[mut:f64]|] (array (ref null $[mut:f64])))
- (type $ref?|{i32_f32_f64}|_=>_ref?|{i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|{i32_f32_f64}|_=>_ref?|{i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}| (func (param (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))))
+ (type $ref?|[mut:f64]|_=>_ref?|[ref?|[mut:f64]|]| (func (param (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))))
(global $global$0 (rtt 0 ${}) (rtt.canon ${}))
(global $global$1 (rtt 1 ${i32}) (rtt.sub ${i32}
(global.get $global$0)
@@ -17,10 +20,9 @@
(global $global$2 (rtt 2 ${i32_i64}) (rtt.sub ${i32_i64}
(global.get $global$1)
))
- (export "foo" (func $0))
- (func $0 (param $0 (ref null ${i32_f32_f64})) (result (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (func $0 (param $0 (ref null ${i32_f32_f64})) (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $1 (ref null ${i32_f32_f64}))
- (local $2 (ref null ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
+ (local $2 (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}))
(local $3 (ref null ${mut:f32}))
(local $4 (ref null $[ref?|[mut:f64]|]))
(local $5 (ref null $[mut:f64]))
@@ -48,12 +50,12 @@
)
)
(drop
- (struct.get_u ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_u ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $2)
)
)
(drop
- (struct.get_s ${i32_mut:i32_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
+ (struct.get_s ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} 0
(local.get $2)
)
)
@@ -103,10 +105,64 @@
)
(unreachable)
)
- (func $1 (param $0 (rtt 1 ${}))
+ (func $1 (param $0 (ref null $[mut:f64])) (result (ref null $[ref?|[mut:f64]|]))
+ (local $1 (ref null $[ref?|[mut:f64]|]))
+ (local $2 (ref null $[mut:i32]))
+ (local $3 (ref null $[mut:i8]))
+ (local $4 (ref null $[mut:f64]))
+ (drop
+ (array.new_with_rtt $[mut:f64]
+ (rtt.canon $[mut:f64])
+ (i32.const 3)
+ (f64.const 3.14159)
+ )
+ )
+ (drop
+ (array.new_default_with_rtt $[ref?|[mut:f64]|]
+ (rtt.canon $[ref?|[mut:f64]|])
+ (i32.const 10)
+ )
+ )
+ (drop
+ (array.get $[mut:f64]
+ (local.get $0)
+ (i32.const 2)
+ )
+ )
+ (array.set $[mut:f64]
+ (local.get $0)
+ (i32.const 2)
+ (f64.const 2.18281828)
+ )
+ (drop
+ (array.len $[mut:f64]
+ (local.get $0)
+ )
+ )
+ (drop
+ (array.get $[mut:i32]
+ (local.get $2)
+ (i32.const 1)
+ )
+ )
+ (drop
+ (array.get_u $[mut:i8]
+ (local.get $3)
+ (i32.const 2)
+ )
+ )
+ (drop
+ (array.get_s $[mut:i8]
+ (local.get $3)
+ (i32.const 3)
+ )
+ )
+ (unreachable)
+ )
+ (func $2 (param $0 (rtt 1 ${}))
(nop)
)
- (func $2 (param $0 (rtt ${}))
+ (func $3 (param $0 (rtt ${}))
(nop)
)
)