-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix closure errors with MINIMAL_RUNTIME + USE_PTHREADS. NFC. #14936
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
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 |
---|---|---|
|
@@ -108,7 +108,7 @@ if (!ENVIRONMENT_IS_PTHREAD) { | |
#if USE_PTHREADS | ||
} else { | ||
#if MODULARIZE | ||
updateGlobalBufferAndViews({{{EXPORT_NAME}}}.buffer); | ||
updateGlobalBufferAndViews(Module.buffer); | ||
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. Why is this changed? 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. Without this it fails closure compiler with However
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. I see, sounds good. And closure will remove the extra var anyhow. |
||
#else | ||
updateGlobalBufferAndViews(wasmMemory.buffer); | ||
#endif | ||
|
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.
Does adding to this list pin down the function from being DCEd if not used?
exit()
is not used always in pthreads builds?Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, this entire like of functions cannot be DCEd in
USE_PTHREADS
builds.However
_exit
is not special here. Just like all the other functions here is used bylibrary_ptheads.js
in general, but might be used in a given application. For example, imagine an application that builds withUSE_PTHREADS
but never actually creates in any threads.. all of the functions in this list would essentially be unused but also prevented from DCE.I guess we want some other notion of
EXPORTED_FUNCTIONS
that also allows for DCE, but I don't know if that exists.Perhaps we could add something like
EXPORTED_FUNCTIONS_FOR_POSSIBLE_INTERNAL_JS_USAGE_ONLY
?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.
Or maybe just
POSSIBLY_USED_FUNCTIONS
?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.
The reference to
_exit
is from theexitProcess
handling code, and I wonder if we couldif
that out when EXIT_RUNTIME is not set... that would be a good solution I think. On the other hand theproc_exit
library functions (of whichexit
is an alias) is just a single line of code onMINIMAL_RUNTIME
and given thatUSE_PTHREADS
brings in many hundreds of extra lines of code (IIUC) it maybe not that urgent to fix?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.
Oh, I think I wrong, please ignore those previous replies.
Adding to
EXPORTED_FUNCTIONS
does not prevent DCE, because we don't consider themUSER_EXPORTED_FUNCTIONS
. OnlyUSER_EXPORTED_FUNCTIONS
are prevented from DCE.