Skip to content

[Binary] Preserve tag HeapTypes when reading - #9368

Open
tlively wants to merge 1 commit into
mainfrom
binary-reader-tag-types
Open

tlively wants to merge 1 commit into
mainfrom
binary-reader-tag-types

Conversation

@tlively

@tlively tlively commented Nov 8, 2026

Copy link
Copy Markdown
Member

PR #7220 updated Tag and WasmBinaryWriter to store and emit HeapTypes instead of Signatures so tag types retain rec group, supertype, and finality information, but WasmBinaryReader::readTagImport and WasmBinaryReader::readTags still called getSignatureByTypeIndex, which reconstructed a fresh canonical HeapType from the Signature. Replace getSignatureByTypeIndex with getSignatureTypeByIndex, which validates that the referenced type is a signature while returning the original HeapType, and call .getSignature() at the caller that still needs a Signature.

Fixes #9365.

PR #7220 updated Tag and WasmBinaryWriter to store and emit HeapTypes instead of Signatures so tag types retain rec group, supertype, and finality information, but WasmBinaryReader::readTagImport and WasmBinaryReader::readTags still called getSignatureByTypeIndex, which reconstructed a fresh canonical HeapType from the Signature. Replace getSignatureByTypeIndex with getSignatureTypeByIndex, which validates that the referenced type is a signature while returning the original HeapType, and call .getSignature() at the caller that still needs a Signature.

Fixes #9365.
@tlively
tlively requested a review from a team as a code owner November 8, 2026 16:13

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the WASM binary reader by replacing the getSignatureByTypeIndex method with getSignatureTypeByIndex, which returns a HeapType instead of a Signature. This change allows tags to support sub and super heap types, and the test suite in tags.wast has been updated to verify this behavior. There are no review comments, so I have no feedback to provide.

This branch has not been deployed

No deployments
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.

Binary reader rebuilds tag types from Signature, dropping rec group and supertype (follow-up to #7219)

1 participant