-
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
Fix for code size regression in log/log2/pow due to recent musl upgrade #15544
Conversation
Without the system_libs.py change the new test fails with:
|
tools/system_libs.py
Outdated
@@ -86,7 +86,7 @@ def create_lib(libname, inputs): | |||
building.emar('cr', libname, inputs) | |||
|
|||
|
|||
def get_wasm_libc_rt_files(): | |||
def get_wasm_libc_rt_files(is_optz=False, all=False): |
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'm having trouble understanding the meaning of all
here. Perhaps a comment would help? Even reading the code below I'm not sure why it is needed, it seems like is_optz
should be a variation on the library basically.
Speaking of variations, we do have OptimizedAggressivelyForSizeLibrary
which this could use? That would automatically provide the C define. That could then be used in the main .c file to do an ifdef on that and include the _small
version etc. - would that be simpler?
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 is using the OptimizedAggressivelyForSizeLibrary
method. Indeed the only library we currently compile in the mode is libc-rt
and its the self.is_optz
on this library that signals if we are in this mode.
This is a freestanding function that the libc-rt
library then calls and passes along the paramater.
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 reason this is a freestanding function is that it is used in two different places. In libc-rt its used to select which math functions to compile, and int libc its used to select which math files to ignore.
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 a comment which I hope will make this more clear. I also renamed the all
argument to superset
.
b105b25
to
c302443
Compare
In this case it seems much easier to have two separate files than to use the |
266731e
to
5dc6cf4
Compare
Restore the older versions of these files and used them in place of the new ones when optimizing for size. These regressions were intended and deemed acceptable in upsteeam musl: emscripten-core/musl@e4dd653 emscripten-core/musl@2a3210c emscripten-core/musl@236cd05 Fixes: #15483
5dc6cf4
to
b55900b
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.
Thanks, now I see! Good comment.
Yes, I agree this approach is best.
Nice, thank you @sbc100 I am interested in benchmarking this. What would be a good way to do that? Performance probably differs across environments, right? (node, browser, ...) |
I would expect performance to vary by architecture and by engine, but the same engine running in the browser and outside the browser should the be same (e.g. it should be enough to measure on d8/node rather than launching chrome). |
…de (emscripten-core#15544) Restore the older versions of these files and used them in place of the new ones when optimizing for size. These regressions were intended and deemed acceptable in upsteeam musl: emscripten-core/musl@e4dd653 emscripten-core/musl@2a3210c emscripten-core/musl@236cd05 Fixes: emscripten-core#15483
Restore the older versions of these files and used them in place of the
new ones when optimizing for size.
These regressions were intended and deemed acceptable in upstream
musl:
emscripten-core/musl@e4dd653
emscripten-core/musl@2a3210c
emscripten-core/musl@236cd05
Fixes: #15483