diff options
author | Alon Zakai <azakai@google.com> | 2021-01-28 00:18:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 16:18:43 -0800 |
commit | 53c471a445ef26eac7befc3f3a5e0a53870df8cb (patch) | |
tree | 419fb53072864affda454f942528416c258136c8 /test | |
parent | a5aa66c52e0b92597a3b90cf34ccc3b7dee775d0 (diff) | |
download | binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.tar.gz binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.tar.bz2 binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.zip |
[GC] Update br_on_cast: the text format also no longer has a heap type (#3523)
As a result, we cannot handle a br_on_cast with an unreachable RTT. The
binary format solves the problem by ignoring unreachable code, and this makes
the text format do the same.
A nice benefit of this is that we can remove the castType extra field.
Diffstat (limited to 'test')
-rw-r--r-- | test/heap-types.wast | 4 | ||||
-rw-r--r-- | test/heap-types.wast.from-wast | 8 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary | 10 | ||||
-rw-r--r-- | test/heap-types.wast.fromBinary.noDebugInfo | 10 | ||||
-rw-r--r-- | test/passes/Oz_fuzz-exec_all-features.wast | 6 |
5 files changed, 22 insertions, 16 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast index a36f12daf..26283da7a 100644 --- a/test/heap-types.wast +++ b/test/heap-types.wast @@ -173,11 +173,11 @@ ;; set the value to a local with type $struct.A, showing that the value ;; flowing out has the right type (local.set $temp.A - (br_on_cast $out $struct.B (ref.null $struct.A) (rtt.canon $struct.B)) + (br_on_cast $out (ref.null $struct.A) (rtt.canon $struct.B)) ) ;; an untaken br_on_cast, with unreachable rtt - so we cannot use the ;; RTT in binaryen IR to find the cast type. - (br_on_cast $out $struct.B (ref.null $struct.A) (unreachable)) + (br_on_cast $out (ref.null $struct.A) (unreachable)) (unreachable) ) ) diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index 4ff3bceec..c498e8fd5 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -184,13 +184,15 @@ (drop (block $out (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) (local.set $temp.A - (br_on_cast $out ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} + (br_on_cast $out (ref.null ${i32_f32_f64}) (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) ) ) - (br_on_cast $out ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} - (ref.null ${i32_f32_f64}) + (block + (drop + (ref.null ${i32_f32_f64}) + ) (unreachable) ) (unreachable) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 9f0220c53..d1003a685 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -184,15 +184,17 @@ (drop (block $label$1 (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) (local.set $temp.A - (br_on_cast $label$1 ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} + (br_on_cast $label$1 (ref.null ${i32_f32_f64}) (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) ) ) - (drop - (ref.null ${i32_f32_f64}) + (block $label$2 + (drop + (ref.null ${i32_f32_f64}) + ) + (unreachable) ) - (unreachable) ) ) ) diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo index 864d66abb..61fffe7a3 100644 --- a/test/heap-types.wast.fromBinary.noDebugInfo +++ b/test/heap-types.wast.fromBinary.noDebugInfo @@ -184,15 +184,17 @@ (drop (block $label$1 (result (ref null ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|})) (local.set $0 - (br_on_cast $label$1 ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|} + (br_on_cast $label$1 (ref.null ${i32_f32_f64}) (rtt.canon ${i8_mut:i16_ref?|{i32_f32_f64}|_mut:ref?|{i32_f32_f64}|}) ) ) - (drop - (ref.null ${i32_f32_f64}) + (block $label$2 + (drop + (ref.null ${i32_f32_f64}) + ) + (unreachable) ) - (unreachable) ) ) ) diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast index d521ad377..fb3be9691 100644 --- a/test/passes/Oz_fuzz-exec_all-features.wast +++ b/test/passes/Oz_fuzz-exec_all-features.wast @@ -147,9 +147,9 @@ (block $extendedblock (result (ref $extendedstruct)) (drop ;; second, try to cast our simple $struct to what it is, which will work - (br_on_cast $block $struct + (br_on_cast $block ;; first, try to cast our simple $struct to an extended, which will fail - (br_on_cast $extendedblock $extendedstruct + (br_on_cast $extendedblock (local.get $any) (rtt.canon $extendedstruct) ) (rtt.canon $struct) @@ -168,7 +168,7 @@ (block $never (result (ref $extendedstruct)) ;; an untaken br_on_cast, with unreachable rtt - so we cannot use the ;; RTT in binaryen IR to find the cast type. - (br_on_cast $never $extendedstruct (ref.null $struct) (unreachable)) + (br_on_cast $never (ref.null $struct) (unreachable)) (unreachable) ) ) |