Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Nov 13, 2025

This magic import refers to functions, which we must handle, and not
modify their signature or contents.

This fixes things optimally for RUME, but for all the passes that look
at public/private heap types, it just marks those functions as public,
which inhibits optimizations. This unblocks work on JS Interop for now
(and maybe those optimizations are not necessary, but if we do want
them, it would mean changes to each such pass).

Spec:

https://github.com/WebAssembly/custom-descriptors/blob/main/proposals/custom-descriptors/Overview.md#configuration-api

@kripken kripken requested a review from tlively November 13, 2025 17:54
@tlively
Copy link
Member

tlively commented Nov 13, 2025

What is RUME???

@kripken
Copy link
Member Author

kripken commented Nov 13, 2025

RemoveUnusedModuleElements

return nullptr;
}

bool Intrinsics::isConfigureAll(Function* func) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's check the type as well so all users can be guaranteed that the parameters have the correct types.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't do that for the intrinsic above. Do you think it is worth the effort? I'm not sure what it would catch in practice that would be useful. (If the user has this wrong, the VM will error anyhow?)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, maybe it's not worth it. configureAll has a single type whereas call.without.effects is overloaded for an infinite set of types, so at least we could check its type rather than letting the user find out about the problem at runtime.

// several passes.
// TODO Specific fixes in those passes could replace this, and allow better
// optimization.
if (wasm.start) {
Copy link
Member

Choose a reason for hiding this comment

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

I imagine that eventually we'll need to handle this in places other than the start function, but starting with this is probably sufficient.

Co-authored-by: Thomas Lively <[email protected]>
return nullptr;
}

bool Intrinsics::isConfigureAll(Function* func) {
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, maybe it's not worth it. configureAll has a single type whereas call.without.effects is overloaded for an infinite set of types, so at least we could check its type rather than letting the user find out about the problem at runtime.

Comment on lines +67 to +69
auto error = [&](const char* msg) {
Fatal() << "Invalid configureAll( " << msg << "): " << *call;
};
Copy link
Member

Choose a reason for hiding this comment

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

We should definitely avoid erroring out on unrecognized configureAll patterns, since they would still be perfectly valid. Maybe we can print a warning and return an empty list if we see some other pattern.

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 think it might be better to error for now? A warning might be missed, and make things harder to debug. (We can always reduce an error to a warning later if it feels annoying in practice.)

Copy link
Member Author

Choose a reason for hiding this comment

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

In particular, if a warning is missed, and configureAll is not noticed, we'd end up optimizing away code in ways that might be confusing, like we've seen already.

Copy link
Member

Choose a reason for hiding this comment

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

Ok fair enough.

@kripken kripken merged commit f70c5cf into WebAssembly:main Nov 14, 2025
16 checks passed
@kripken kripken deleted the configureAll branch November 14, 2025 17:27
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