Skip to content

[MakeSharedObjects] Wrap externref global imports - #9141

Open
tlively wants to merge 1 commit into
mainfrom
make-shared-obj-strings
Open

tlively wants to merge 1 commit into
mainfrom
make-shared-obj-strings

Conversation

@tlively

@tlively tlively commented Sep 23, 2026

Copy link
Copy Markdown
Member

Keep externref global imports as externrefs at the module boundary and insert their values into the externref table during instantiation via an active element segment. Replace the original globals with internal shared i31 globals initialized to their corresponding table indices. This keeps e.g. imported string constants working as expected without assuming that they can be converted to (ref (shared extern)), which would not work if they flowed to the same locations as other externrefs, which would have been lowered to i31ref instead.

Now that both the function and externref tables have initial content, move the logic for creating the element segment to LazyTable.

Keep externref global imports as externrefs at the module boundary and insert their values into the externref table during instantiation via an active element segment. Replace the original globals with internal shared i31 globals initialized to their corresponding table indices. This keeps e.g. imported string constants working as expected without assuming that they can be converted to `(ref (shared extern))`, which would not work if they flowed to the same locations as other externrefs, which would have been lowered to i31ref instead.

Now that both the function and externref tables have initial content, move the logic for creating the element segment to LazyTable.
@tlively
tlively requested a review from a team as a code owner September 23, 2026 02:03
@tlively
tlively requested review from aheejin and removed request for a team September 23, 2026 02:03

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.

1 participant