Skip to content

Fix handling of declarative segments #7660

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

osa1
Copy link
Contributor

@osa1 osa1 commented Jun 17, 2025

Declarative segments can be referred to in runtime, but they will be empty.

Update handling to create an empty segment, instead of ignoring.

Enable elem.wast in the spec test suite.

osa1 added 2 commits June 17, 2025 10:26
Declarative segments can be referred to in runtime, but they will be
empty.

Update handling to create an empty segment, instead of ignoring.

Enable `elem.wast` in the spec test suite.
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

The binary parser probably needs a similar fix.

;; CHECK-BIN-NODEBUG: (elem $9 (table $3) (i32.const 0) (ref null $0) (item (ref.func $0)) (item (ref.func $2)))
;; CHECK-BIN-NODEBUG: (elem $9 func)

;; CHECK-BIN-NODEBUG: (elem $10 (table $3) (i32.const 0) (ref null $0) (item (ref.func $0)) (item (ref.func $2)))
Copy link
Member

Choose a reason for hiding this comment

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

It would be good if the binary writer searched for an empty segment with an appropriate type to reuse as the declarative segment to avoid having round trips increase the number of segments like this.

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.

2 participants