Skip to content

MarkJSCalled pass#8733

Merged
kripken merged 7 commits into
WebAssembly:mainfrom
kripken:mark.js-called
May 20, 2026
Merged

MarkJSCalled pass#8733
kripken merged 7 commits into
WebAssembly:mainfrom
kripken:mark.js-called

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented May 20, 2026

This adds @binaryen.js.called to functions called from any configureAll,
even one not from the start function.

Addresses the issue in #8727, where fuzzing the start function can lead to
situations where a function is referred to from configureAll but not marked
as js-called, which can break optimizations. By using this in the fuzzer, we
can fuzz even files with interesting configureAll calls.

FindAll<Call> calls(func->body);
for (auto* call : calls.list) {
if (intrinsics.isConfigureAll(call)) {
for (auto name : intrinsics.getConfigureAllFunctions(call)) {
Copy link
Copy Markdown
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 to produce a warning or fatal error when there are function operands passed to configureAll that we are not able to analyze. As a follow-up to this change we should remove getConfigureAllFunctions and all its uses in favor of explicitly annotated js-called functions anyway, so I think we can just inline the logic from getConfigureAllFunctions here.

In the future, if folks have different usage patterns and are running into the warning or fatal error, we can add support for more usage patterns here as well. (array.new_fixed usage comes to mind as low-hanging fruit.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so I think we can just inline the logic from getConfigureAllFunctions here.

I'd rather not do that in this PR, so that it is NFC aside from adding a new pass? I don't want to change behavior for users.

But I agree on the path after this PR, yes, it would be nice to unify and simplify this.

(Given we shouldn't unify it yet, I don't think it's worth adding detailed warnings here - that would lead to a bunch of duplicated code.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure, maybe a TODO about adding a warning/error, then?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure, done.

@kripken kripken merged commit 17a9078 into WebAssembly:main May 20, 2026
16 checks passed
@kripken kripken deleted the mark.js-called branch May 20, 2026 23:03
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