summaryrefslogtreecommitdiff
path: root/test/lit/basic/shared-null-no-gc.wast
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-07-17 19:35:26 -0400
committerGitHub <noreply@github.com>2024-07-17 16:35:26 -0700
commit29746f14b8acd987ae137e2054391fc7afd3b3db (patch)
tree83b45befa174dfa12c31e89330b158d06bf9d899 /test/lit/basic/shared-null-no-gc.wast
parent1434591fbd62f611cc530ed024a1b1477e2e7614 (diff)
downloadbinaryen-29746f14b8acd987ae137e2054391fc7afd3b3db.tar.gz
binaryen-29746f14b8acd987ae137e2054391fc7afd3b3db.tar.bz2
binaryen-29746f14b8acd987ae137e2054391fc7afd3b3db.zip
[threads] Simplify and generalize heap type writing without GC (#6765)
We represent `ref.null`s as having bottom heap types, even when GC is not enabled. Bottom heap types are a feature of the GC proposal, so in that case the binary writer needs to write the corresponding top type instead. We previously had separate logic for this for each type hierarchy in the binary writer, but that did not handle shared types and would not have automatically handled other new types, either. Simplify and generalize the implementation and test that we can write `ref.null`s of shared types without GC enabled.
Diffstat (limited to 'test/lit/basic/shared-null-no-gc.wast')
-rw-r--r--test/lit/basic/shared-null-no-gc.wast19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lit/basic/shared-null-no-gc.wast b/test/lit/basic/shared-null-no-gc.wast
new file mode 100644
index 000000000..b920f80f8
--- /dev/null
+++ b/test/lit/basic/shared-null-no-gc.wast
@@ -0,0 +1,19 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+
+;; Test that we can write a binary without crashing when using a shared bottom
+;; type without GC enabled.
+
+;; RUN: wasm-opt %s --enable-reference-types --enable-shared-everything --roundtrip -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (func $test
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.null (shared nofunc))
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test
+ (drop
+ (ref.null (shared func))
+ )
+ )
+)