Skip to content

Make use externref + multivalue to speed up emscripten_atomic_wait_suspending#26964

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

Make use externref + multivalue to speed up emscripten_atomic_wait_suspending#26964
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:emscripten_promise_await_unchecked_asm

Conversation

@sbc100
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 commented May 15, 2026

Currently blocked on WebAssembly/binaryen#3739.

Mostly uploading as an example of how its possible to use externref (in both C and asm code) and multi-value (in JS and asm code) today.

@sbc100 sbc100 requested review from dschuff, kripken, tlively and trybka May 15, 2026 20:21
Copy link
Copy Markdown
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Can you gate this change on JSPI being enabled? I'd say it's unlikely that we will update Asyncify to support reference types.

Comment thread src/lib/libatomic.js
#endif
// In the synchronous case return the negative result code
return -atomicWaitStates.indexOf(wait.value);
return [undefined, atomicWaitStates.indexOf(wait.value)]
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.

null would make more sense than undefined here. That way you end up with a null externref on the Wasm side. With undefined, you end up with a non-null externref.

@sbc100
Copy link
Copy Markdown
Collaborator Author

sbc100 commented May 15, 2026

Can you gate this change on JSPI being enabled? I'd say it's unlikely that we will update Asyncify to support reference types.

We would need to have a custom version of libc (or some other support library) in that case. Right now we don't have an ASYNCIFY build of or libc or a JSPI one.. its all the same.

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