summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast9
-rw-r--r--test/heap-types.wast.from-wast12
-rw-r--r--test/heap-types.wast.fromBinary12
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo12
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt72
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast48
6 files changed, 161 insertions, 4 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index d85cf82d2..35284bef6 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -305,4 +305,13 @@
(unreachable)
)
)
+ (func $array-copy (param $x (ref $vector)) (param $y (ref null $vector))
+ (array.copy $vector $vector
+ (local.get $x)
+ (i32.const 11)
+ (local.get $y)
+ (i32.const 42)
+ (i32.const 1337)
+ )
+ )
)
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 6e48c4a68..e9dfc9a25 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -1,8 +1,8 @@
(module
(type $struct.A (struct (field i32) (field f32) (field $named f64)))
+ (type $vector (array (mut f64)))
(type $none_=>_none (func))
(type $struct.B (struct (field i8) (field (mut i16)) (field (ref $struct.A)) (field (mut (ref $struct.A)))))
- (type $vector (array (mut f64)))
(type $grandchild (struct (field i32) (field i64)))
(type $struct.C (struct (field $named-mut (mut f32))))
(type $matrix (array (mut (ref null $vector))))
@@ -17,6 +17,7 @@
(type $nested-child-array (array (mut (ref $child))))
(type $rtt_1_$parent_=>_none (func (param (rtt 1 $parent))))
(type $rtt_$parent_=>_none (func (param (rtt $parent))))
+ (type $ref|$vector|_ref?|$vector|_=>_none (func (param (ref $vector) (ref null $vector))))
(global $rttparent (rtt 0 $parent) (rtt.canon $parent))
(global $rttchild (rtt 1 $child) (rtt.sub $child
(global.get $rttparent)
@@ -385,4 +386,13 @@
(unreachable)
)
)
+ (func $array-copy (param $x (ref $vector)) (param $y (ref null $vector))
+ (array.copy $vector $vector
+ (local.get $x)
+ (i32.const 11)
+ (local.get $y)
+ (i32.const 42)
+ (i32.const 1337)
+ )
+ )
)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 591be6431..dbe080996 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -1,8 +1,8 @@
(module
(type $struct.A (struct (field i32) (field f32) (field $named f64)))
+ (type $vector (array (mut f64)))
(type $none_=>_none (func))
(type $struct.B (struct (field i8) (field (mut i16)) (field (ref $struct.A)) (field (mut (ref $struct.A)))))
- (type $vector (array (mut f64)))
(type $grandchild (struct (field i32) (field i64)))
(type $matrix (array (mut (ref null $vector))))
(type $struct.C (struct (field $named-mut (mut f32))))
@@ -17,6 +17,7 @@
(type $nested-child-array (array (mut (ref $child))))
(type $rtt_1_$parent_=>_none (func (param (rtt 1 $parent))))
(type $rtt_$parent_=>_none (func (param (rtt $parent))))
+ (type $ref|$vector|_ref?|$vector|_=>_none (func (param (ref $vector) (ref null $vector))))
(global $rttparent (rtt 0 $parent) (rtt.canon $parent))
(global $rttchild (rtt 1 $child) (rtt.sub $child
(global.get $rttparent)
@@ -348,5 +349,14 @@
)
(unreachable)
)
+ (func $array-copy (param $x (ref $vector)) (param $y (ref null $vector))
+ (array.copy $vector $vector
+ (local.get $x)
+ (i32.const 11)
+ (local.get $y)
+ (i32.const 42)
+ (i32.const 1337)
+ )
+ )
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index a6a26765f..2fb57aacb 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -1,8 +1,8 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
+ (type $[mut:f64] (array (mut f64)))
(type $none_=>_none (func))
(type ${i8_mut:i16_ref|{i32_f32_f64}|_mut:ref|{i32_f32_f64}|} (struct (field i8) (field (mut i16)) (field (ref ${i32_f32_f64})) (field (mut (ref ${i32_f32_f64})))))
- (type $[mut:f64] (array (mut f64)))
(type ${i32_i64} (struct (field i32) (field i64)))
(type $[mut:ref?|[mut:f64]|] (array (mut (ref null $[mut:f64]))))
(type ${mut:f32} (struct (field (mut f32))))
@@ -17,6 +17,7 @@
(type $[mut:ref|{i32}|] (array (mut (ref ${i32}))))
(type $rtt_1_{}_=>_none (func (param (rtt 1 ${}))))
(type $rtt_{}_=>_none (func (param (rtt ${}))))
+ (type $ref|[mut:f64]|_ref?|[mut:f64]|_=>_none (func (param (ref $[mut:f64]) (ref null $[mut:f64]))))
(global $global$0 (rtt 0 ${}) (rtt.canon ${}))
(global $global$1 (rtt 1 ${i32}) (rtt.sub ${i32}
(global.get $global$0)
@@ -348,5 +349,14 @@
)
(unreachable)
)
+ (func $17 (param $0 (ref $[mut:f64])) (param $1 (ref null $[mut:f64]))
+ (array.copy $[mut:f64] $[mut:f64]
+ (local.get $0)
+ (i32.const 11)
+ (local.get $1)
+ (i32.const 42)
+ (i32.const 1337)
+ )
+ )
)
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index b5bda3fb6..359311e41 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -38,11 +38,17 @@
[fuzz-exec] note result: init-array-packed => 213
[fuzz-exec] calling cast-func-to-struct
[trap cast error]
+[fuzz-exec] calling array-copy
+[LoggingExternalInterface logging 10]
+[LoggingExternalInterface logging 10]
+[LoggingExternalInterface logging 99]
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 10]
(module
(type $struct (struct (field (mut i32))))
(type $void_func (func))
- (type $extendedstruct (struct (field (mut i32)) (field f64)))
(type $bytes (array (mut i8)))
+ (type $extendedstruct (struct (field (mut i32)) (field f64)))
(type $int_func (func (result i32)))
(type $i32_=>_none (func (param i32)))
(type $anyref_=>_none (func (param anyref)))
@@ -59,6 +65,7 @@
(export "array-alloc-failure" (func $9))
(export "init-array-packed" (func $10))
(export "cast-func-to-struct" (func $12))
+ (export "array-copy" (func $13))
(func $0 (; has Stack IR ;)
(local $0 i32)
(call $log
@@ -290,6 +297,63 @@
)
)
)
+ (func $13 (; has Stack IR ;)
+ (local $0 (ref null $bytes))
+ (local $1 (ref null $bytes))
+ (array.set $bytes
+ (local.tee $1
+ (array.new_default_with_rtt $bytes
+ (i32.const 200)
+ (rtt.canon $bytes)
+ )
+ )
+ (i32.const 42)
+ (i32.const 99)
+ )
+ (call $log
+ (array.get_u $bytes
+ (local.tee $0
+ (array.new_with_rtt $bytes
+ (i32.const 10)
+ (i32.const 100)
+ (rtt.canon $bytes)
+ )
+ )
+ (i32.const 10)
+ )
+ )
+ (array.copy $bytes $bytes
+ (local.get $0)
+ (i32.const 10)
+ (local.get $1)
+ (i32.const 42)
+ (i32.const 2)
+ )
+ (call $log
+ (array.get_u $bytes
+ (local.get $0)
+ (i32.const 9)
+ )
+ )
+ (call $log
+ (array.get_u $bytes
+ (local.get $0)
+ (i32.const 10)
+ )
+ )
+ (call $log
+ (array.get_u $bytes
+ (local.get $0)
+ (i32.const 11)
+ )
+ )
+ (call $log
+ (array.get_u $bytes
+ (local.get $0)
+ (i32.const 12)
+ )
+ )
+ )
)
[fuzz-exec] calling structs
[LoggingExternalInterface logging 0]
@@ -330,6 +394,12 @@
[fuzz-exec] note result: init-array-packed => 213
[fuzz-exec] calling cast-func-to-struct
[trap cast error]
+[fuzz-exec] calling array-copy
+[LoggingExternalInterface logging 10]
+[LoggingExternalInterface logging 10]
+[LoggingExternalInterface logging 99]
+[LoggingExternalInterface logging 0]
+[LoggingExternalInterface logging 10]
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 32570852d..11a9f798d 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -268,6 +268,54 @@
)
)
)
+ (func "array-copy"
+ (local $x (ref null $bytes))
+ (local $y (ref null $bytes))
+ ;; Create an array of 10's, of size 100.
+ (local.set $x
+ (array.new_with_rtt $bytes
+ (i32.const 10)
+ (i32.const 100)
+ (rtt.canon $bytes)
+ )
+ )
+ ;; Create an array of zeros of size 200, and also set one index there.
+ (local.set $y
+ (array.new_default_with_rtt $bytes
+ (i32.const 200)
+ (rtt.canon $bytes)
+ )
+ )
+ (array.set $bytes
+ (local.get $y)
+ (i32.const 42)
+ (i32.const 99)
+ )
+ ;; Log out a value from $x before.
+ (call $log
+ (array.get_u $bytes (local.get $x) (i32.const 10))
+ )
+ (array.copy $bytes $bytes
+ (local.get $x)
+ (i32.const 10)
+ (local.get $y)
+ (i32.const 42)
+ (i32.const 2)
+ )
+ ;; Log out some value from $x after. Indexes 10 and 11 should be modified.
+ (call $log
+ (array.get_u $bytes (local.get $x) (i32.const 9))
+ )
+ (call $log
+ (array.get_u $bytes (local.get $x) (i32.const 10))
+ )
+ (call $log
+ (array.get_u $bytes (local.get $x) (i32.const 11))
+ )
+ (call $log
+ (array.get_u $bytes (local.get $x) (i32.const 12))
+ )
+ )
)
(module
(type $[mut:i8] (array (mut i8)))