-
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
Stop using re-assignment thunks when WASM_ASYNC_COMPILATION is enabled. #23339
Comments
(1) actually seems fairly bad since it perpetually mutates the |
One possible solution would be to simply delay the assignments and just generate initially-undefined variables:
In debug builds we could generate wrappers that simply fail if they are ever called:
The major breakage here would be for folks that are currently taking references to |
In debug builds nothing really changes here since we exported functions still get statically assigned to debug wrappers/thunks. However, after this change, in release builds, if you attempt to access `_foo` (internally) or `Module['_foo']` externally before the module is loaded you will now get `undefined`. Since it was always the case that calling these function would crash anyway, the only effected folks would be folks that take the reference early and then call later. e.g. ``` var myfunc = Module['_foo']; // Run before module is loaded // wait until loaded myfunc(); // This will no longer work. ``` Fixes: emscripten-core#23339
In debug builds nothing really changes here since we exported functions still get statically assigned to debug wrappers/thunks. However, after this change, in release builds, if you attempt to access `_foo` (internally) or `Module['_foo']` externally before the module is loaded you will now get `undefined`. Since it was always the case that calling these function would crash anyway, the only effected folks would be folks that take the reference early and then call later. e.g. ``` var myfunc = Module['_foo']; // Run before module is loaded // wait until loaded myfunc(); // This will no longer work. ``` Fixes: emscripten-core#23339
In debug builds nothing really changes here since we exported functions still get statically assigned to debug wrappers/thunks. However, after this change, in release builds, if you attempt to access `_foo` (internally) or `Module['_foo']` externally before the module is loaded you will now get `undefined`. Since it was always the case that calling these function would crash anyway, the only effected folks would be folks that take the reference early and then call later. e.g. ``` var myfunc = Module['_foo']; // Run before module is loaded // wait until loaded myfunc(); // This will no longer work. ``` Fixes: emscripten-core#23339
In release mode, when WASM_ASYNC_COMPILATION is used (i.e the default) we generate little thunks for all wasm exports. They looks like this:
The idea here is that these would then get re-assigned on first use. However, there are several problem with this:
See #23337
The text was updated successfully, but these errors were encountered: