-
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
What is the intended way to disable import/export minification? #20762
Comments
I think I'm curious why you want to disable this minification, though? (In general the ABI between the wasm and JS is not mean to be inspectable.) |
We have code that needs to grab the raw wasm exported functions out of the Module so it can insert them into the function pointer table. Using cwrap doesn't guarantee that the return value will be the raw function instead of a JS wrapper. |
Interesting. Rather than export those functions, could you add them to the table at compile time? (I think a larger table is more compact than a longer list of exports, at least in the wasm binary - but maybe not at runtime?) |
We have had this request before I think, but I'm struggling to remember exactly where from and why. In general, as will all settings we prefer to keep them internal if we possibly can. Emscripten suffers pretty badly from combinatoric settings explosion. So we could try to look into other options before exposing this one. |
Yeah, one option I was considering is getting their location in the table and using that to fetch them out of it. If that is what you recommend I might dig in more to try and figure out the best way to do it - maybe a C function that returns their address out of a dispatch switch statement or something. The code bloat would probably not be too bad. For now I'm testing out Your point about the table being more compact than exports is a good one. If we could avoid exporting them, that would compensate for the cost of the 'give me a fn pointer' helper function. Thanks! |
By default in specific circumstances emscripten will minify export names, which breaks things like getRawCwrap. We can suppress this with `-lexports.js`. Fixes #94939. See emscripten-core/emscripten#20762
MINIFY_WASM_EXPORT_NAMES
andMINIFY_WASM_IMPORTS_AND_EXPORTS
both exist as settings, but we're not allowed to actually use them. The logic internally for picking their values is very complex, and feels like it could change arbitrarily at any point in time. If I want to disable minification of exports and imports reliably, what is the intended way to do it? I see that at present-lexports.js
will do it but I'm not sure if that's a good solution (and I don't love that it increases code size a little bit.)Thanks!
The text was updated successfully, but these errors were encountered: