-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Optimization O3 fails when importing Wasi functions #16294
Comments
We have two different namespaces from which we import symbols. "env" and "wasi_snapshot_preview1". "fd_close" is part of WASI and so should come from the latter... but somehow importing from the former is confusing that minifiier. If you import from "wasi_snapshot_preview1" then it fixes the issue. To do that you would do something like: |
@kripken do you think is worth fixing the import/export minifier to deal with this case? The above example fails .. but not until runtime... whereas importing from |
Thank you for the quick reply, works like a charm. The world may now enjoy hyper-optimized PThreadFS :) |
Hmm, metadce sees that the symbol is unused (because the declaration is declaring it in another import space - so it's declaring something else entirely). I think that is as expected. Perhaps we could try to get a better error message at compile time here, but at a glance that's not trivial: early in metadce we assume that the import namespaces are merged, so we forget about which import comes from where. By the time we run The more surprising thing to me is that this works with This is fixable, but I'm not sure it's worth the effort. |
The implementation of PThreadFS imports Wasi functions such as
fd_write()
. Unfortunately, this fails under optimization level-O3
. Under optimization level-O2
, everything works well. Is there a way to avoid this issue?Minimal example
Compile with
emcc -o o3bug.html o3bug.cpp -O3
, then instantiation fails withUsing Emsdk 3.1.3, Chrome 98.
The text was updated successfully, but these errors were encountered: