Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store HeapTypes in Tags #7220

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Store HeapTypes in Tags #7220

merged 3 commits into from
Jan 16, 2025

Conversation

tlively
Copy link
Member

@tlively tlively commented Jan 15, 2025

Tags in WebAssembly syntactically refer to function heap types, but
Binaryen IR was previously storing signatures instead and reconstructing
heap types as necessary when emitting binaries. Before WasmGC this was
not a problem because the reconstructed types would be the same as the
original types, but with WasmGC round tripping function types through
Signature could lose information such as the rec group, the declared
supertype, and the finality from the original type. Store the original
heap type in the IR instead to stop losing this information.

Fixes #7219.

Tags in WebAssembly syntactically refer to function heap types, but
Binaryen IR was previously storing signatures instead and reconstructing
heap types as necessary when emitting binaries. Before WasmGC this was
not a problem because the reconstructed types would be the same as the
original types, but with WasmGC round tripping function types through
Signature could lose information such as the rec group, the declared
supertype, and the finality from the original type. Store the original
heap type in the IR instead to stop losing this information.

Fixes #7219.
@tlively tlively requested review from kripken and aheejin January 15, 2025 21:21
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

lgtm % comments

src/wasm.h Show resolved Hide resolved
o << ')' << maybeNewLine;
}

void PrintSExpression::printTagType(HeapType type) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like handleSignature (used for Function) is similar - can we share this code perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take another look at it. At first glance the existence of parameter names for functions made it seem writing separate code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I think it's more trouble than it's worth right now.

Co-authored-by: Alon Zakai <azakai@google.com>
@tlively tlively enabled auto-merge (squash) January 15, 2025 22:14
@tlively tlively merged commit f9dd59e into main Jan 16, 2025
13 checks passed
@tlively tlively deleted the tag-heaptype branch January 16, 2025 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binaryen changes type structure in open world even with zero-level optimization enabled
3 participants