Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/wasm/literal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2700,11 +2700,12 @@ Literal Literal::externalize() const {
}

Literal Literal::internalize() const {
auto extType = HeapTypes::ext.getBasic(type.getHeapType().getShared());
auto share = type.getHeapType().getShared();
auto extType = HeapTypes::ext.getBasic(share);
assert(Type::isSubType(type, Type(extType, Nullable)) &&
"can only internalize external references");
if (isNull()) {
return Literal(std::shared_ptr<GCData>{}, HeapType::none);
return Literal(std::shared_ptr<GCData>{}, HeapTypes::none.getBasic(share));
}
if (gcData->type.isMaybeShared(HeapType::i31)) {
assert(gcData->values[0].type.getHeapType().isMaybeShared(HeapType::i31));
Expand Down
15 changes: 15 additions & 0 deletions test/lit/exec/share.wast
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write this as a spec test so it can eventually be upstreamed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: wasm-opt %s -all --fuzz-exec-before -q -o /dev/null 2>&1 | filecheck %s

(module
;; CHECK: [fuzz-exec] calling shared-null
;; CHECK-NEXT: [fuzz-exec] note result: shared-null => null
(func $shared-null (export "shared-null") (result (ref null (shared any)))
;; The shared null here should remain shared as we internalize it.
(any.convert_extern
(ref.null (shared noextern))
)
)
)