Skip to content

Always await the createWasm promise under WASM_ASYNC_COMPILATION#27075

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:wait_createWasm
Jun 9, 2026
Merged

Always await the createWasm promise under WASM_ASYNC_COMPILATION#27075
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:wait_createWasm

Conversation

@sbc100

@sbc100 sbc100 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

When WASM_ASYNC_COMPILATION is enabled createWasm returns a promise. However we were not always waiting on this and instead using the addRunDependency system to block the running of main.

This change simplifies things by always awaiting the promise when it exists.

This is kind of a followup to #27059 and a pre-cursor to #27028 which is a much larger change.

Comes with a nice little codesize saving too, since it avoid the whole addRunDependency in most simple programs.

When `WASM_ASYNC_COMPILATION` is enabled `createWasm` returns
a promise.  However we were not always waiting on this and instead
using the `addRunDependency` system to block the running of main.

This change simplifies things by always awaiting the promise when
it exists.

This is kind of a followup to emscripten-core#27059 and a pre-cursor to emscripten-core#27028
which is a much larger change.
@sbc100 sbc100 requested a review from brendandahl June 9, 2026 18:22
@sbc100 sbc100 enabled auto-merge (squash) June 9, 2026 19:04
@sbc100 sbc100 requested a review from kripken June 9, 2026 19:04
@sbc100

sbc100 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

@kripken, just checking you are ok with the slow march towards using more modern async constructs.

@sbc100 sbc100 merged commit 784f327 into emscripten-core:main Jun 9, 2026
39 checks passed
@sbc100 sbc100 deleted the wait_createWasm branch June 9, 2026 19:14
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jun 9, 2026
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jun 9, 2026
@kripken

kripken commented Jun 9, 2026

Copy link
Copy Markdown
Member

Direction lgtm!

sbc100 added a commit to sbc100/emscripten that referenced this pull request Jun 9, 2026
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jun 9, 2026
sbc100 added a commit that referenced this pull request Jun 10, 2026
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