diff options
author | Thomas Lively <tlively@google.com> | 2024-09-16 14:12:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-16 14:12:13 -0700 |
commit | 2a4096512d514b2319ff1c9360f0fbc9ecc94e5d (patch) | |
tree | fe5953fcaaa673ec2f106fe7653d83294143db90 /test | |
parent | 4913080cd040c0e0a1607ed73ac13bbbafe3a05d (diff) | |
download | binaryen-2a4096512d514b2319ff1c9360f0fbc9ecc94e5d.tar.gz binaryen-2a4096512d514b2319ff1c9360f0fbc9ecc94e5d.tar.bz2 binaryen-2a4096512d514b2319ff1c9360f0fbc9ecc94e5d.zip |
Remove open "ignorable public" array types (#6940)
There are a few heap types that are hard-coded to be considered public
and therefore allowed on module boundaries even in --closed-world mode,
specifically to support js-string-builtins. We previously considered
both open and closed (i.e. final) mutable i8 arrays to be public in this
manner, but js-string-builtins only uses the closed versions, so remove
the open versions.
This fixes a particular bug in which Unsubtyping optimized a private
array type to be equivalent to an ignorable public array type,
incorrectly changing the behavior of a cast, but it does not address the
larger problem of optimizations producing types that are equivalent to
public types. Add a TODO about that problem for now.
Fixes #6935.
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/unsubtyping.wast | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/lit/passes/unsubtyping.wast b/test/lit/passes/unsubtyping.wast index 0d4e11e12..aa4af720b 100644 --- a/test/lit/passes/unsubtyping.wast +++ b/test/lit/passes/unsubtyping.wast @@ -1747,3 +1747,35 @@ ;; CHECK: (global $g (ref $super) (struct.new_default $sub)) (global $g (ref $super) (struct.new_default $sub)) ) + +;; Regression test for a bug where we considered $super to be a public type +;; (because it was once in contention to appear in js-string-builtin +;; signatures), so we only updated $sub, but that caused $sub and $super to be +;; the same type, changing the behavior of the cast. +(module + ;; CHECK: (type $super (sub (array (mut i8)))) + (type $super (sub (array (mut i8)))) + (type $sub (sub $super (array (mut i8)))) + ;; CHECK: (type $1 (func)) + + ;; CHECK: (export "test" (func $0)) + + ;; CHECK: (func $0 (type $1) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (ref.cast (ref none) + ;; CHECK-NEXT: (array.new_default $super + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $0 (export "test") + (drop + (ref.cast (ref $sub) + (array.new_default $super + (i32.const 0) + ) + ) + ) + ) +) |