summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast8
-rw-r--r--test/heap-types.wast.from-wast8
-rw-r--r--test/heap-types.wast.fromBinary8
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo8
-rw-r--r--test/let.txt42
-rw-r--r--test/let.wasm.fromBinary12
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt4
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast8
8 files changed, 70 insertions, 28 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 87d751691..e645ee74d 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -95,10 +95,10 @@
)
(drop
(struct.new_with_rtt $struct.A
- (rtt.canon $struct.A)
(i32.const 1)
(f32.const 2.345)
(f64.const 3.14159)
+ (rtt.canon $struct.A)
)
)
(unreachable)
@@ -110,15 +110,15 @@
(local $tw (ref null $words))
(drop
(array.new_with_rtt $vector
- (rtt.canon $vector)
- (i32.const 3)
(f64.const 3.14159)
+ (i32.const 3)
+ (rtt.canon $vector)
)
)
(drop
(array.new_default_with_rtt $matrix
- (rtt.canon $matrix)
(i32.const 10)
+ (rtt.canon $matrix)
)
)
(drop
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index ceef0739a..b4228fd20 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -99,10 +99,10 @@
)
(drop
(struct.new_with_rtt $struct.A
- (rtt.canon $struct.A)
(i32.const 1)
(f32.const 2.3450000286102295)
(f64.const 3.14159)
+ (rtt.canon $struct.A)
)
)
(unreachable)
@@ -114,15 +114,15 @@
(local $tw (ref null $words))
(drop
(array.new_with_rtt $vector
- (rtt.canon $vector)
- (i32.const 3)
(f64.const 3.14159)
+ (i32.const 3)
+ (rtt.canon $vector)
)
)
(drop
(array.new_default_with_rtt $matrix
- (rtt.canon $matrix)
(i32.const 10)
+ (rtt.canon $matrix)
)
)
(drop
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 78e01e494..75dcae823 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -99,10 +99,10 @@
)
(drop
(struct.new_with_rtt $struct.A
- (rtt.canon $struct.A)
(i32.const 1)
(f32.const 2.3450000286102295)
(f64.const 3.14159)
+ (rtt.canon $struct.A)
)
)
(unreachable)
@@ -114,15 +114,15 @@
(local $tw (ref null $vector))
(drop
(array.new_with_rtt $vector
- (rtt.canon $vector)
- (i32.const 3)
(f64.const 3.14159)
+ (i32.const 3)
+ (rtt.canon $vector)
)
)
(drop
(array.new_default_with_rtt $matrix
- (rtt.canon $matrix)
(i32.const 10)
+ (rtt.canon $matrix)
)
)
(drop
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 1ae5792cb..e0b465bed 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -99,10 +99,10 @@
)
(drop
(struct.new_with_rtt ${i32_f32_f64}
- (rtt.canon ${i32_f32_f64})
(i32.const 1)
(f32.const 2.3450000286102295)
(f64.const 3.14159)
+ (rtt.canon ${i32_f32_f64})
)
)
(unreachable)
@@ -114,15 +114,15 @@
(local $4 (ref null $[mut:f64]))
(drop
(array.new_with_rtt $[mut:f64]
- (rtt.canon $[mut:f64])
- (i32.const 3)
(f64.const 3.14159)
+ (i32.const 3)
+ (rtt.canon $[mut:f64])
)
)
(drop
(array.new_default_with_rtt $[ref?|[mut:f64]|]
- (rtt.canon $[ref?|[mut:f64]|])
(i32.const 10)
+ (rtt.canon $[ref?|[mut:f64]|])
)
)
(drop
diff --git a/test/let.txt b/test/let.txt
new file mode 100644
index 000000000..9901aaad8
--- /dev/null
+++ b/test/let.txt
@@ -0,0 +1,42 @@
+;; source code for let.wasm, which was created by wasp
+(module
+ (type $vector (array (mut f64)))
+ (func $main
+ (local $x i32)
+ (local $y i32)
+ (drop (local.get $x)) ;; 0 is the index appearing in the binary
+ ;; first let
+ (array.new_with_rtt $vector
+ (f64.const 3.14159)
+ (i32.const 1)
+ (rtt.canon $vector)
+ )
+ (let (local $v (ref $vector))
+ (drop (local.get $v)) ;; 0
+ (drop (local.get $x)) ;; 1
+ ;; another one, nested
+ (array.new_with_rtt $vector
+ (f64.const 1234)
+ (i32.const 2)
+ (rtt.canon $vector)
+ )
+ (let (local $w (ref $vector))
+ (drop (local.get $v)) ;; 1
+ (drop (local.get $w)) ;; 0
+ (drop (local.get $x)) ;; 2
+ )
+ )
+ ;; another one, later
+ (array.new_with_rtt $vector
+ (f64.const 2.1828)
+ (i32.const 3)
+ (rtt.canon $vector)
+ )
+ (let (local $v (ref $vector))
+ (drop (local.get $v)) ;; 0
+ (drop (local.get $x)) ;; 1
+ )
+ (drop (local.get $x)) ;; 0
+ )
+)
+
diff --git a/test/let.wasm.fromBinary b/test/let.wasm.fromBinary
index 1de54a96d..d3f1760ce 100644
--- a/test/let.wasm.fromBinary
+++ b/test/let.wasm.fromBinary
@@ -13,9 +13,9 @@
(block
(local.set $2
(array.new_with_rtt $[mut:f64]
- (rtt.canon $[mut:f64])
- (i32.const 1)
(f64.const 3.14159)
+ (i32.const 1)
+ (rtt.canon $[mut:f64])
)
)
(block
@@ -28,9 +28,9 @@
(block
(local.set $3
(array.new_with_rtt $[mut:f64]
- (rtt.canon $[mut:f64])
- (i32.const 2)
(f64.const 1234)
+ (i32.const 2)
+ (rtt.canon $[mut:f64])
)
)
(block
@@ -50,9 +50,9 @@
(block
(local.set $4
(array.new_with_rtt $[mut:f64]
- (rtt.canon $[mut:f64])
- (i32.const 3)
(f64.const 2.1828)
+ (i32.const 3)
+ (rtt.canon $[mut:f64])
)
)
(block
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index baa2a24e9..9d79199f5 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -89,9 +89,9 @@
(array.len $bytes
(local.tee $0
(array.new_with_rtt $bytes
- (rtt.canon $bytes)
- (i32.const 50)
(i32.const 42)
+ (i32.const 50)
+ (rtt.canon $bytes)
)
)
)
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index 44ea8625b..97e270f0f 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -46,9 +46,9 @@
(local $x (ref null $bytes))
(local.set $x
(array.new_with_rtt $bytes
- (rtt.canon $bytes)
- (i32.const 50) ;; size
(i32.const 42) ;; value to splat into the array
+ (i32.const 50) ;; size
+ (rtt.canon $bytes)
)
)
;; The length should be 50
@@ -87,9 +87,9 @@
(call $log
(ref.test $struct
(array.new_with_rtt $bytes
- (rtt.canon $bytes)
- (i32.const 10)
(i32.const 20)
+ (i32.const 10)
+ (rtt.canon $bytes)
)
(rtt.canon $struct)
)