Skip to content
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

Make 'instantiateWasm' callback resolve the result return from 'recei… #23781

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gogogoghost
Copy link

@gogogoghost gogogoghost commented Feb 27, 2025

In js output content.

When ASYNCIFY enabled, wasmExports modified by Asyncify.instrumentWasmExports. source

But when Module['instantiateWasm'] used. The createWasm function will always resolve the original wasmExports. source.

It will case crash when async C++ function rewind.

So I make instantiateWasm callback resolve the result return from receiveInstance.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Tanks for the fix!

Do you think we can update one of the existing tests to cover this? Maybe test_instantiate_wasm in test_other.py

@gogogoghost
Copy link
Author

gogogoghost commented Feb 28, 2025

I have just updated the test unit. And this issue only affects when EXPORT_ES6 enabled.

When EXPORT_ES6 disabled. createWasm called after wasmExports defined.

var wasmExports;
createWasm();

wasmExports can be updated in createWasm.

When EXPORT_ES6 enabled. wasmExports assigned by the return value of createWasm.

var wasmExports = await createWasm();

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