-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Move emscripten_atomic_wait_async
to atomic.h and add core testing
#20404
Conversation
57091df
to
3904f1c
Compare
acbdf92
to
1fe2c44
Compare
$polyfillWaitAsync: () => { | ||
// nop, used for its postset to ensure waitAsync() polyfill is included | ||
// exaclyt once. | ||
// Any function using Atomics.waitAsync should depend on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I suppose you are looking to fix a situation where only JS code would ever be doing Atomics.waitAsync()s, and Wasm code is doing all the wakes, hence the polyfill would never be emitted?
This situation looks like something that would be good to go in the Atomics related documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing this PR for these functional changes is a bit tricky, given the code move. Are there other functional differences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I suppose you are looking to fix a situation where only JS code would ever be doing Atomics.waitAsync()s, and Wasm code is doing all the wakes, hence the polyfill would never be emitted?
This situation looks like something that would be good to go in the Atomics related documentation?
I'm not quite sure I understand. Atomics.waitAsync
can only ever be performed by JS code, since its JS only function, right? There is no wasm version of it.
This dependency just means the polyfill is only ever included when the library functions that call it are included. Isn't that desirable? Or would you rather the polyfill always be included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing this PR for these functional changes is a bit tricky, given the code move. Are there other functional differences?
I'm pretty sure I didn't change anything functionally on the JS library side, just moved stuff around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I suppose you are looking to fix a situation where only JS code would ever be doing Atomics.waitAsync()s, and Wasm code is doing all the wakes, hence the polyfill would never be emitted?
This situation looks like something that would be good to go in the Atomics related documentation?
I can split out the __deps
fix and land that first to make it more obvious what is going on here ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one change to the JS code here, in order to support running emscripten_atomic_wait_async
under node: I added runtimeKeepalivePush/runtimeKeepalivePop and callUserCallback to emscripten_atomic_wait_async
. This means that the runtime will not exit will async waits are running, but will exit cleanly once the last one is done.
Split out from emscripten-core#20404. Rather than adding artificial dependencies on `emscripten_atomic_wait_async` we can use the same technique used by `$polyfillSetImmediate` in `library_eventloop.js`.
Split out from #20404. Rather than adding artificial dependencies on `emscripten_atomic_wait_async` we can use the same technique used by `$polyfillSetImmediate` in `library_eventloop.js`.
1fe2c44
to
736067d
Compare
Rebased on top of #20474 |
736067d
to
02eb840
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing the changes since my last lgtm, all the changed files lgtm aside from src/library_atomic.js
which has changes and is very large. Any chance you have a diff compared to my last review?
I think adding commits on top of an existing PR is really better for this workflow, as I've said in the past. For small stuff it doesn't matter, but there's 150 lines of code in that file here.
Nothing should have changed here since that last review, just rebased on top of #20474 |
The reason that is hard for me to do that since my workflow is basically a rebase one. I use How about this: The next time you see a PR from me that you think you would rather see review in a merge workflow can you comment there and I will give it a try. |
Rebasing sgtm - it's the squashing that is the issue for me, iiuc. That is, if this PR had one commit, then you realized the need for a fix so you added another commit, and then you rebased them both on Is adding more commits as you go tricky for some reason? Does the rebase workflow always squash them for you for some reason? |
Ah no, you are right, its the rebasing that is kind of key to my workflow, not the constant squashing. I could avoid that in some cases. However, IIRC github still gets confused about incremental reviewing when rebasing happens, even if squashing doesn't happen. You can still review each commit if you like, but githubs "show be whats changed since I last looked" feature I think doesn't work. |
At least in this PR "show me what changed" seems to have worked. Some files were marked as unchanged and some were marked as changed. (I didn't have a way to verify that it was the right ones, though.) |
02eb840
to
9649f90
Compare
This API was orininally added for wasm workers but is not wasm worker specific. Followup to emscripten-core#20381.
9649f90
to
06f2e36
Compare
This API was orininally added for wasm workers but is not wasm worker specific.
As part of making this API compatible with pthreads I added support for
runtimeKeepalivePush/Pop and callUserCallback which means that this PR
subsumes #20306.
Followup to #20381.