Skip to content

Use Promise internally for handling run dependencies. NFC#27171

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:resolveRunDependencies
Open

Use Promise internally for handling run dependencies. NFC#27171
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:resolveRunDependencies

Conversation

@sbc100

@sbc100 sbc100 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

This is a logical followup to #27121, and comes with a codesize saving in many cases.

Add $resolveRunDependencies to allow awaiting the resolution of all active run dependencies. This is useful for async runtime operations like emscripten_async_load_script which need to wait for loaded scripts to finish their own async setup (e.g. file preloading) before triggering their onload callbacks.

Codesize impact:

  • test_codesize_file_preload: -19 bytes (JS)
  • test_codesize_hello_dylink_all: +40 bytes (JS)
  • All other tests (including C++ tests): 0 bytes change (fully DCE'd)

@sbc100 sbc100 requested review from brendandahl and kripken June 24, 2026 00:31
@sbc100 sbc100 changed the title Use Promise internal for handling run dependencies. NFC Use Promise internally for handling run dependencies. NFC Jun 24, 2026
@sbc100 sbc100 force-pushed the resolveRunDependencies branch 2 times, most recently from 24bd80b to d8b705b Compare June 24, 2026 04:38
This is a logical followup to emscripten-core#27121, and comes with a codesize
saving in many cases.

Add `$resolveRunDependencies` to allow awaiting the resolution of all
active run dependencies. This is useful for async runtime operations
like `emscripten_async_load_script` which need to wait for loaded
scripts to finish their own async setup (e.g. file preloading) before
triggering their onload callbacks.

Codesize impact:
- test_codesize_file_preload: -19 bytes (JS)
- test_codesize_hello_dylink_all: +40 bytes (JS)
- All other tests (including C++ tests): 0 bytes change (fully DCE'd)
@sbc100 sbc100 force-pushed the resolveRunDependencies branch from d8b705b to 117db0c Compare June 24, 2026 06:21
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.

1 participant