summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/exception-handling.js.txt8
-rw-r--r--test/binaryen.js/kitchen-sink.js21
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt47
-rw-r--r--test/binaryen.js/push-pop.js43
-rw-r--r--test/binaryen.js/push-pop.js.txt43
-rw-r--r--test/example/c-api-kitchen-sink.c24
-rw-r--r--test/example/c-api-kitchen-sink.txt22
-rw-r--r--test/passes/Os_print-stack-ir.txt20
-rw-r--r--test/passes/Os_print-stack-ir.wast12
-rw-r--r--test/passes/dce_all-features.txt11
-rw-r--r--test/passes/dce_all-features.wast11
-rw-r--r--test/push_pop.wast39
-rw-r--r--test/push_pop.wast.from-wast71
-rw-r--r--test/push_pop.wast.fromBinary48
-rw-r--r--test/push_pop.wast.fromBinary.noDebugInfo48
15 files changed, 63 insertions, 405 deletions
diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt
index a2b10d37f..380ce34d6 100644
--- a/test/binaryen.js/exception-handling.js.txt
+++ b/test/binaryen.js/exception-handling.js.txt
@@ -28,7 +28,7 @@
)
)
-getExpressionInfo(throw) = {"id":44,"type":1,"event":"e"}
-getExpressionInfo(br_on_exn) = {"id":46,"type":10,"name":"l","event":"e"}
-getExpressionInfo(rethrow) = {"id":45,"type":1}
-getExpressionInfo(try) = {"id":43,"type":0}
+getExpressionInfo(throw) = {"id":43,"type":1,"event":"e"}
+getExpressionInfo(br_on_exn) = {"id":45,"type":10,"name":"l","event":"e"}
+getExpressionInfo(rethrow) = {"id":44,"type":1}
+getExpressionInfo(try) = {"id":42,"type":0}
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index b0b81433d..6c5afa169 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -145,7 +145,6 @@ function test_ids() {
console.log("ThrowId: " + binaryen.ThrowId);
console.log("RethrowId: " + binaryen.RethrowId);
console.log("BrOnExnId: " + binaryen.BrOnExnId);
- console.log("PushId: " + binaryen.PushId);
console.log("PopId: " + binaryen.PopId);
}
@@ -548,16 +547,16 @@ function test_core() {
), 2
),
- // Push and pop
- module.push(module.i32.pop()),
- module.push(module.i64.pop()),
- module.push(module.f32.pop()),
- module.push(module.f64.pop()),
- module.push(module.v128.pop()),
- module.push(module.anyref.pop()),
- module.push(module.funcref.pop()),
- module.push(module.nullref.pop()),
- module.push(module.exnref.pop()),
+ // Pop
+ module.i32.pop(),
+ module.i64.pop(),
+ module.f32.pop(),
+ module.f64.pop(),
+ module.v128.pop(),
+ module.anyref.pop(),
+ module.funcref.pop(),
+ module.nullref.pop(),
+ module.exnref.pop(),
// TODO: Host
module.nop(),
module.unreachable(),
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index b27d147b3..14f8c0d03 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -69,12 +69,11 @@ MemoryInitId: 34
DataDropId: 35
MemoryCopyId: 36
MemoryFillId: 37
-TryId: 43
-ThrowId: 44
-RethrowId: 45
-BrOnExnId: 46
-PushId: 38
-PopId: 39
+TryId: 42
+ThrowId: 43
+RethrowId: 44
+BrOnExnId: 45
+PopId: 38
getExpressionInfo={"id":15,"type":4,"op":6}
(f32.neg
(f32.const -33.61199951171875)
@@ -1846,31 +1845,31 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
)
)
- (push
+ (drop
(i32.pop)
)
- (push
+ (drop
(i64.pop)
)
- (push
+ (drop
(f32.pop)
)
- (push
+ (drop
(f64.pop)
)
- (push
+ (drop
(v128.pop)
)
- (push
+ (drop
(anyref.pop)
)
- (push
+ (drop
(funcref.pop)
)
- (push
+ (drop
(nullref.pop)
)
- (push
+ (drop
(exnref.pop)
)
(nop)
@@ -3644,31 +3643,31 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
)
)
- (push
+ (drop
(i32.pop)
)
- (push
+ (drop
(i64.pop)
)
- (push
+ (drop
(f32.pop)
)
- (push
+ (drop
(f64.pop)
)
- (push
+ (drop
(v128.pop)
)
- (push
+ (drop
(anyref.pop)
)
- (push
+ (drop
(funcref.pop)
)
- (push
+ (drop
(nullref.pop)
)
- (push
+ (drop
(exnref.pop)
)
(nop)
diff --git a/test/binaryen.js/push-pop.js b/test/binaryen.js/push-pop.js
deleted file mode 100644
index 042ed17d6..000000000
--- a/test/binaryen.js/push-pop.js
+++ /dev/null
@@ -1,43 +0,0 @@
-function cleanInfo(info) {
- var ret = {};
- for (var x in info) {
- if (x !== 'value') {
- ret[x] = info[x];
- }
- }
- return ret;
-}
-
-function stringify(expr) {
- return JSON.stringify(cleanInfo(binaryen.getExpressionInfo(expr)));
-}
-
-var module = new binaryen.Module();
-
-var func = module.addFunction("func", binaryen.none, binaryen.none, [],
- module.block(null, [
- module.push(module.i32.pop()),
- module.push(module.i64.pop()),
- module.push(module.f32.pop()),
- module.push(module.f64.pop()),
- module.push(module.v128.pop()),
- module.push(module.funcref.pop()),
- module.push(module.anyref.pop()),
- module.push(module.nullref.pop()),
- module.push(module.exnref.pop())
- ])
-)
-
-assert(module.validate());
-console.log(module.emitText());
-
-console.log("getExpressionInfo(i32.pop) = " + stringify(module.i32.pop()));
-console.log("getExpressionInfo(i64.pop) = " + stringify(module.i64.pop()));
-console.log("getExpressionInfo(f32.pop) = " + stringify(module.f32.pop()));
-console.log("getExpressionInfo(f64.pop) = " + stringify(module.f64.pop()));
-console.log("getExpressionInfo(v128.pop) = " + stringify(module.v128.pop()));
-console.log("getExpressionInfo(funcref.pop) = " + stringify(module.funcref.pop()));
-console.log("getExpressionInfo(anyref.pop) = " + stringify(module.anyref.pop()));
-console.log("getExpressionInfo(nullref.pop) = " + stringify(module.nullref.pop()));
-console.log("getExpressionInfo(exnref.pop) = " + stringify(module.exnref.pop()));
-console.log("getExpressionInfo(push) = " + stringify(module.push(module.i32.const(0))));
diff --git a/test/binaryen.js/push-pop.js.txt b/test/binaryen.js/push-pop.js.txt
deleted file mode 100644
index e5d5437f9..000000000
--- a/test/binaryen.js/push-pop.js.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-(module
- (type $none_=>_none (func))
- (func $func
- (push
- (i32.pop)
- )
- (push
- (i64.pop)
- )
- (push
- (f32.pop)
- )
- (push
- (f64.pop)
- )
- (push
- (v128.pop)
- )
- (push
- (funcref.pop)
- )
- (push
- (anyref.pop)
- )
- (push
- (nullref.pop)
- )
- (push
- (exnref.pop)
- )
- )
-)
-
-getExpressionInfo(i32.pop) = {"id":39,"type":2}
-getExpressionInfo(i64.pop) = {"id":39,"type":3}
-getExpressionInfo(f32.pop) = {"id":39,"type":4}
-getExpressionInfo(f64.pop) = {"id":39,"type":5}
-getExpressionInfo(v128.pop) = {"id":39,"type":6}
-getExpressionInfo(funcref.pop) = {"id":39,"type":7}
-getExpressionInfo(anyref.pop) = {"id":39,"type":8}
-getExpressionInfo(nullref.pop) = {"id":39,"type":9}
-getExpressionInfo(exnref.pop) = {"id":39,"type":10}
-getExpressionInfo(push) = {"id":38}
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 3ea6c4ef0..764cc0ba6 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -733,18 +733,18 @@ void test_core() {
BinaryenTupleMake(module, tupleElements4a, 4),
BinaryenTupleExtract(
module, BinaryenTupleMake(module, tupleElements4b, 4), 2),
- // Push and pop
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeInt32())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeInt64())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeFloat32())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeFloat64())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeFuncref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeAnyref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeNullref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeExnref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeFuncref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeNullref())),
- BinaryenPush(module, BinaryenPop(module, BinaryenTypeExnref())),
+ // Pop
+ BinaryenPop(module, BinaryenTypeInt32()),
+ BinaryenPop(module, BinaryenTypeInt64()),
+ BinaryenPop(module, BinaryenTypeFloat32()),
+ BinaryenPop(module, BinaryenTypeFloat64()),
+ BinaryenPop(module, BinaryenTypeFuncref()),
+ BinaryenPop(module, BinaryenTypeAnyref()),
+ BinaryenPop(module, BinaryenTypeNullref()),
+ BinaryenPop(module, BinaryenTypeExnref()),
+ BinaryenPop(module, BinaryenTypeFuncref()),
+ BinaryenPop(module, BinaryenTypeNullref()),
+ BinaryenPop(module, BinaryenTypeExnref()),
// TODO: Host
BinaryenNop(module),
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index ced13ac72..fda846fcb 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1779,37 +1779,37 @@ BinaryenFeatureAll: 1023
)
)
)
- (push
+ (drop
(i32.pop)
)
- (push
+ (drop
(i64.pop)
)
- (push
+ (drop
(f32.pop)
)
- (push
+ (drop
(f64.pop)
)
- (push
+ (drop
(funcref.pop)
)
- (push
+ (drop
(anyref.pop)
)
- (push
+ (drop
(nullref.pop)
)
- (push
+ (drop
(exnref.pop)
)
- (push
+ (drop
(funcref.pop)
)
- (push
+ (drop
(nullref.pop)
)
- (push
+ (drop
(exnref.pop)
)
(nop)
diff --git a/test/passes/Os_print-stack-ir.txt b/test/passes/Os_print-stack-ir.txt
index 02af45e21..9fbde2f4a 100644
--- a/test/passes/Os_print-stack-ir.txt
+++ b/test/passes/Os_print-stack-ir.txt
@@ -49,23 +49,15 @@
(export "ppf32" (func $2))
(export "ppf64" (func $3))
(func $0 (result i32)
- i32.const 1
-
)
(func $1 (result i64)
- i64.const 1
-
)
(func $2 (result f32)
- f32.const 1
-
)
(func $3 (result f64)
- f64.const 1
-
)
)
@@ -79,27 +71,15 @@
(export "ppf32" (func $2))
(export "ppf64" (func $3))
(func $0 (; has Stack IR ;) (result i32)
- (push
- (i32.const 1)
- )
(i32.pop)
)
(func $1 (; has Stack IR ;) (result i64)
- (push
- (i64.const 1)
- )
(i64.pop)
)
(func $2 (; has Stack IR ;) (result f32)
- (push
- (f32.const 1)
- )
(f32.pop)
)
(func $3 (; has Stack IR ;) (result f64)
- (push
- (f64.const 1)
- )
(f64.pop)
)
)
diff --git a/test/passes/Os_print-stack-ir.wast b/test/passes/Os_print-stack-ir.wast
index 7318d8bef..6944a3207 100644
--- a/test/passes/Os_print-stack-ir.wast
+++ b/test/passes/Os_print-stack-ir.wast
@@ -15,25 +15,19 @@
)
)
(module
- ;; These are not quite valid usages of push/pop - they are not meant to be used
- ;; with each other. This just tests we can emit them/handle them in the optimizer.
- ;; Once we have proper places to use them, we can tighten up the validation and
- ;; replace this test with something correct.
+ ;; These are not valid usages of pops - they are not meant to be
+ ;; used alone. This just tests we can emit them/handle them in the
+ ;; optimizer.
(func "ppi32" (result i32)
- (push (i32.const 1))
(i32.pop)
)
(func "ppi64" (result i64)
- (push (i64.const 1))
(i64.pop)
)
(func "ppf32" (result f32)
- (push (f32.const 1))
(f32.pop)
)
(func "ppf64" (result f64)
- (push (f64.const 1))
(f64.pop)
)
)
-
diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt
index d1d116046..59f32f1be 100644
--- a/test/passes/dce_all-features.txt
+++ b/test/passes/dce_all-features.txt
@@ -551,14 +551,3 @@
)
)
)
-(module
- (type $none_=>_none (func))
- (func $foo
- (nop)
- )
- (func $push_unreachable
- (push
- (unreachable)
- )
- )
-)
diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast
index 641211eab..77e781097 100644
--- a/test/passes/dce_all-features.wast
+++ b/test/passes/dce_all-features.wast
@@ -811,14 +811,3 @@
)
)
)
-
-;; Push-pop
-(module
- (func $foo)
- (func $push_unreachable
- (push
- (unreachable)
- )
- (call $foo) ;; should be dce'd
- )
-)
diff --git a/test/push_pop.wast b/test/push_pop.wast
deleted file mode 100644
index d73e0dc68..000000000
--- a/test/push_pop.wast
+++ /dev/null
@@ -1,39 +0,0 @@
-(module
- ;; These are not quite valid usages of push/pop - they are not meant to be used
- ;; with each other. This just tests we can emit them/handle them in the optimizer.
- ;; Once we have proper places to use them, we can tighten up the validation and
- ;; replace this test with something correct.
- (func "ppi32" (result i32)
- (push (i32.const 1))
- (i32.pop)
- )
- (func "ppi64" (result i64)
- (push (i64.const 1))
- (i64.pop)
- )
- (func "ppf32" (result f32)
- (push (f32.const 1))
- (f32.pop)
- )
- (func "ppf64" (result f64)
- (push (f64.const 1))
- (f64.pop)
- )
- (func "ppanyref" (result anyref) (local $any anyref)
- (push (local.get $any))
- (anyref.pop)
- )
- (func "ppfuncref" (result funcref) (local $fn funcref)
- (push (local.get $fn))
- (funcref.pop)
- )
- (func "ppnullref"
- (push (ref.null))
- (drop (nullref.pop))
- )
- (func "ppexnref" (result exnref) (local $exn exnref)
- (push (local.get $exn))
- (exnref.pop)
- )
-)
-
diff --git a/test/push_pop.wast.from-wast b/test/push_pop.wast.from-wast
deleted file mode 100644
index 72309a0d0..000000000
--- a/test/push_pop.wast.from-wast
+++ /dev/null
@@ -1,71 +0,0 @@
-(module
- (type $none_=>_none (func))
- (type $none_=>_i32 (func (result i32)))
- (type $none_=>_i64 (func (result i64)))
- (type $none_=>_f32 (func (result f32)))
- (type $none_=>_f64 (func (result f64)))
- (type $none_=>_funcref (func (result funcref)))
- (type $none_=>_anyref (func (result anyref)))
- (type $none_=>_exnref (func (result exnref)))
- (export "ppi32" (func $0))
- (export "ppi64" (func $1))
- (export "ppf32" (func $2))
- (export "ppf64" (func $3))
- (export "ppanyref" (func $4))
- (export "ppfuncref" (func $5))
- (export "ppnullref" (func $6))
- (export "ppexnref" (func $7))
- (func $0 (result i32)
- (push
- (i32.const 1)
- )
- (i32.pop)
- )
- (func $1 (result i64)
- (push
- (i64.const 1)
- )
- (i64.pop)
- )
- (func $2 (result f32)
- (push
- (f32.const 1)
- )
- (f32.pop)
- )
- (func $3 (result f64)
- (push
- (f64.const 1)
- )
- (f64.pop)
- )
- (func $4 (result anyref)
- (local $any anyref)
- (push
- (local.get $any)
- )
- (anyref.pop)
- )
- (func $5 (result funcref)
- (local $fn funcref)
- (push
- (local.get $fn)
- )
- (funcref.pop)
- )
- (func $6
- (push
- (ref.null)
- )
- (drop
- (nullref.pop)
- )
- )
- (func $7 (result exnref)
- (local $exn exnref)
- (push
- (local.get $exn)
- )
- (exnref.pop)
- )
-)
diff --git a/test/push_pop.wast.fromBinary b/test/push_pop.wast.fromBinary
deleted file mode 100644
index 489897df6..000000000
--- a/test/push_pop.wast.fromBinary
+++ /dev/null
@@ -1,48 +0,0 @@
-(module
- (type $none_=>_none (func))
- (type $none_=>_i32 (func (result i32)))
- (type $none_=>_i64 (func (result i64)))
- (type $none_=>_f32 (func (result f32)))
- (type $none_=>_f64 (func (result f64)))
- (type $none_=>_funcref (func (result funcref)))
- (type $none_=>_anyref (func (result anyref)))
- (type $none_=>_exnref (func (result exnref)))
- (export "ppi32" (func $0))
- (export "ppi64" (func $1))
- (export "ppf32" (func $2))
- (export "ppf64" (func $3))
- (export "ppanyref" (func $4))
- (export "ppfuncref" (func $5))
- (export "ppnullref" (func $6))
- (export "ppexnref" (func $7))
- (func $0 (result i32)
- (i32.const 1)
- )
- (func $1 (result i64)
- (i64.const 1)
- )
- (func $2 (result f32)
- (f32.const 1)
- )
- (func $3 (result f64)
- (f64.const 1)
- )
- (func $4 (result anyref)
- (local $0 anyref)
- (local.get $0)
- )
- (func $5 (result funcref)
- (local $0 funcref)
- (local.get $0)
- )
- (func $6
- (drop
- (ref.null)
- )
- )
- (func $7 (result exnref)
- (local $0 exnref)
- (local.get $0)
- )
-)
-
diff --git a/test/push_pop.wast.fromBinary.noDebugInfo b/test/push_pop.wast.fromBinary.noDebugInfo
deleted file mode 100644
index 489897df6..000000000
--- a/test/push_pop.wast.fromBinary.noDebugInfo
+++ /dev/null
@@ -1,48 +0,0 @@
-(module
- (type $none_=>_none (func))
- (type $none_=>_i32 (func (result i32)))
- (type $none_=>_i64 (func (result i64)))
- (type $none_=>_f32 (func (result f32)))
- (type $none_=>_f64 (func (result f64)))
- (type $none_=>_funcref (func (result funcref)))
- (type $none_=>_anyref (func (result anyref)))
- (type $none_=>_exnref (func (result exnref)))
- (export "ppi32" (func $0))
- (export "ppi64" (func $1))
- (export "ppf32" (func $2))
- (export "ppf64" (func $3))
- (export "ppanyref" (func $4))
- (export "ppfuncref" (func $5))
- (export "ppnullref" (func $6))
- (export "ppexnref" (func $7))
- (func $0 (result i32)
- (i32.const 1)
- )
- (func $1 (result i64)
- (i64.const 1)
- )
- (func $2 (result f32)
- (f32.const 1)
- )
- (func $3 (result f64)
- (f64.const 1)
- )
- (func $4 (result anyref)
- (local $0 anyref)
- (local.get $0)
- )
- (func $5 (result funcref)
- (local $0 funcref)
- (local.get $0)
- )
- (func $6
- (drop
- (ref.null)
- )
- )
- (func $7 (result exnref)
- (local $0 exnref)
- (local.get $0)
- )
-)
-