summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-03-16 13:51:31 -0700
committerGitHub <noreply@github.com>2020-03-16 13:51:31 -0700
commitaadec4526b339af4d2d2b92d3d64f07f935df7a5 (patch)
treeb1bb4d3154d6b0d922d8b5d82a83da2c23231bb9 /test
parent2b8e9248604b2419a69c268ab131366a7408ebaf (diff)
downloadbinaryen-aadec4526b339af4d2d2b92d3d64f07f935df7a5.tar.gz
binaryen-aadec4526b339af4d2d2b92d3d64f07f935df7a5.tar.bz2
binaryen-aadec4526b339af4d2d2b92d3d64f07f935df7a5.zip
Collect signatures from all block kinds (#2691)
Previously the signature collection mechanism responsible for populating the type section with signatures used by instructions only collected signatures from indirect call and block instructions. This works as long as all other control flow constructs like ifs, loops, and tries contain blocks with the same signature. But it is possible to have an if with non-block children, and we would need to collect its signature as well.
Diffstat (limited to 'test')
-rw-r--r--test/multivalue.wast6
-rw-r--r--test/multivalue.wast.from-wast8
-rw-r--r--test/multivalue.wast.fromBinary13
-rw-r--r--test/multivalue.wast.fromBinary.noDebugInfo13
4 files changed, 30 insertions, 10 deletions
diff --git a/test/multivalue.wast b/test/multivalue.wast
index d2deaef89..08e23f62a 100644
--- a/test/multivalue.wast
+++ b/test/multivalue.wast
@@ -116,16 +116,18 @@
)
)
)
- (func $mv-if (result i32 i64)
- (if (result i32 i64)
+ (func $mv-if (result i32 i64 anyref)
+ (if (result i32 i64 nullref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
)
)
diff --git a/test/multivalue.wast.from-wast b/test/multivalue.wast.from-wast
index 293ec8cb0..a918979f5 100644
--- a/test/multivalue.wast.from-wast
+++ b/test/multivalue.wast.from-wast
@@ -5,6 +5,8 @@
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
(type $none_=>_i32 (func (result i32)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
+ (type $none_=>_i32_i64_nullref (func (result i32 i64 nullref)))
(type $none_=>_f32 (func (result f32)))
(import "env" "pair" (func $pair (result i32 i64)))
(func $triple (; 1 ;) (result i32 i64 f32)
@@ -117,16 +119,18 @@
)
)
)
- (func $mv-if (; 14 ;) (result i32 i64)
- (if (result i32 i64)
+ (func $mv-if (; 14 ;) (result i32 i64 anyref)
+ (if (result i32 i64 nullref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
)
)
diff --git a/test/multivalue.wast.fromBinary b/test/multivalue.wast.fromBinary
index 9bd9d5e58..32f744c46 100644
--- a/test/multivalue.wast.fromBinary
+++ b/test/multivalue.wast.fromBinary
@@ -1,10 +1,12 @@
(module
(type $none_=>_i32_i64 (func (result i32 i64)))
(type $none_=>_none (func))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
(type $none_=>_i64 (func (result i64)))
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
(type $none_=>_i32 (func (result i32)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
+ (type $none_=>_i32_i64_nullref (func (result i32 i64 nullref)))
(type $none_=>_f32 (func (result f32)))
(import "env" "pair" (func $pair (result i32 i64)))
(func $triple (; 1 ;) (result i32 i64 f32)
@@ -366,18 +368,20 @@
)
)
)
- (func $mv-if (; 14 ;) (result i32 i64)
- (local $0 (i32 i64))
+ (func $mv-if (; 14 ;) (result i32 i64 anyref)
+ (local $0 (i32 i64 nullref))
(local.set $0
- (if (result i32 i64)
+ (if (result i32 i64 nullref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
)
)
@@ -388,6 +392,9 @@
(tuple.extract 1
(local.get $0)
)
+ (tuple.extract 2
+ (local.get $0)
+ )
)
)
(func $mv-loop (; 15 ;) (result i32 i64)
diff --git a/test/multivalue.wast.fromBinary.noDebugInfo b/test/multivalue.wast.fromBinary.noDebugInfo
index 71d0939ba..c105df989 100644
--- a/test/multivalue.wast.fromBinary.noDebugInfo
+++ b/test/multivalue.wast.fromBinary.noDebugInfo
@@ -1,10 +1,12 @@
(module
(type $none_=>_i32_i64 (func (result i32 i64)))
(type $none_=>_none (func))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
(type $none_=>_i64 (func (result i64)))
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
(type $none_=>_i32 (func (result i32)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
+ (type $none_=>_i32_i64_nullref (func (result i32 i64 nullref)))
(type $none_=>_f32 (func (result f32)))
(import "env" "pair" (func $fimport$0 (result i32 i64)))
(func $0 (; 1 ;) (result i32 i64 f32)
@@ -366,18 +368,20 @@
)
)
)
- (func $13 (; 14 ;) (result i32 i64)
- (local $0 (i32 i64))
+ (func $13 (; 14 ;) (result i32 i64 anyref)
+ (local $0 (i32 i64 nullref))
(local.set $0
- (if (result i32 i64)
+ (if (result i32 i64 nullref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
(tuple.make
(i32.const 42)
(i64.const 42)
+ (ref.null)
)
)
)
@@ -388,6 +392,9 @@
(tuple.extract 1
(local.get $0)
)
+ (tuple.extract 2
+ (local.get $0)
+ )
)
)
(func $14 (; 15 ;) (result i32 i64)