-
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
Add ASYNCIFY+JSPI support to MINIMAL_RUNTIME build mode. #22501
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,15 @@ function assert(condition, text) { | |
} | ||
#endif | ||
|
||
#if ASYNCIFY == 1 // ASYNCIFY-mode requires checking ABORT variable to avoid operating if code has aborted during an unwind | ||
var ABORT = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this relates to ASYNCIFY == 1 but the PR title talks about JSPI. Does this change cover both? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Err, yes. Updated the title to clarify that this PR addresses both ASYNCIFY and JSPI. |
||
#endif | ||
|
||
/** @param {string|number=} what */ | ||
function abort(what) { | ||
#if ASYNCIFY == 1 | ||
ABORT = 1; | ||
#endif | ||
throw {{{ ASSERTIONS ? 'new Error(what)' : 'what' }}}; | ||
} | ||
|
||
|
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.
Is this a debug feature or do we need to add this new variable even in release builds?
I worry that this makes the feature matrix even more complicated and there could be other places in the codebase that deal with
ABORT
that need to be changes now thatABORT
does exist undefMINIMAL_RUNTIME
but only withASYNCIFY
is enabled.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.
I added that variable to help places like this and this to compile.
There seem to be places that call to it in library_async.js: https://github.com/emscripten-core/emscripten/blob/main/src/library_async.js#L18 so looks like in ASYNCIFY==1 mode we cannot avoid adding ABORT in the build. In ASYNCIFY==2 mode, maybe we could.
Overall, I think the support would be ok to be expanded incrementally via proof by test cases.