Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Nov 12, 2025

When custom descriptors are enabled, import primary functions into
secondary modules using exact imports. This allows references to those
functions in the secondary module to remain exact, just like they are
before splitting. Remove the exact casts we previously inserted to fix
this problem.

Do not use exact imports when custom descriptors are not enabled. In
principle this could cause validation errors because we allow e.g. exact
locals even when custom descriptors are not enabled. This could be
worked around in the future either by running a pass to remove exactness
before splitting or by always using and allowing exact imports, but then
emitting them as inexact imports when custom descriptors are disabled.

Validate that exact function imports require custom descriptors. An
alternative approach (that we may switch to in the future if necessary)
would be to always allow exact imports, but then strip them out in the
binary writer when custom descriptors are not enabled. For now take the
more explicit what-you-see-is-what-you-get approach.
When custom descriptors are enabled, import primary functions into
secondary modules using exact imports. This allows references to those
functions in the secondary module to remain exact, just like they are
before splitting. Remove the exact casts we previously inserted to fix
this problem.

Do not use exact imports when custom descriptors are not enabled. In
principle this could cause validation errors because we allow e.g. exact
locals even when custom descriptors are not enabled. This could be
worked around in the future either by running a pass to remove exactness
before splitting or by always using and allowing exact imports, but then
emitting them as inexact imports when custom descriptors are disabled.
@tlively tlively requested a review from kripken November 12, 2025 23:19
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 if the fuzzer somehow doesn't trip up on this, but I think it will without some workaround..?

Can test locally by running the Split fuzzer with higher priority to verify.

@tlively
Copy link
Member Author

tlively commented Nov 13, 2025

Yep, will fuzz heavily before landing. I think the fuzzer should be ok here, though, because wasm-split does not do any optimization like refining the types of locals between reading the input and splitting. And if custom descriptors is not allowed, the input file will also not have any exact locals or other exact locations that could cause validation problems.

Base automatically changed from exact-import-validation to main November 13, 2025 23:22
@tlively tlively enabled auto-merge (squash) November 14, 2025 17:26
@tlively tlively merged commit cb18db5 into main Nov 14, 2025
16 checks passed
@tlively tlively deleted the use-exact-func-imports branch November 14, 2025 18:02
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.

3 participants