-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[SPLIT_MODULE] Fix wasmRawExports to actually be the raw exports. NFC
#25979
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
Conversation
We don't want the raw exports include things like `Asyncify.instrumentWasmExports` or `relocateExports`. They should be the actual raw exports. See emscripten-core#25621
tlively
left a comment
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.
Is there a test we can write for this?
|
It would also be useful to not have this behind the SPLIT_MODULE ifdef (at least for my personal use). |
Sadly that would increase codesize for everyone so we don't want to do that by default if we can help it. Have you looked into using |
Its a little tricky because for a couple of reasons:
I will have a go but if its not easy I might just request that we land this as a "does not regress" change :) |
kripken
left a comment
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 don't feel strongly either way about testing here.
I think I'm worried about MAIN_MODULE having side effects going that route. Grepping in src/ yields ~60 conditionals that have to do with that. So yes, accessing wasmImports would be stable that way, but there's a lot of other potential side effects. What exactly is the problem with always defining? Is it the few extra bytes from it uselessly existing there for 99.9% of people, or does it existing cause some other chain of events with a more significant impact on the overall size? |
I made some changes recently that make the cost of
No, the codesize cost is just a few bytes for everyone. Emscripten tries to avoid these kind of things because we suffer from a death by a thousand cuts if we are not careful. In this case though I'm also worried about exposing more internals and adding more things we need to test. |
Totally understood re: death by a thousand cuts. Just tested with MAIN_MODULE=2 and using wasmImports - it worked. The downsides however - |
I guess it kind of makes sense because this is the object that you will pass as the "imports" object to each wasm file you instantiate right? This object acts as a kind of global symbol table for dynanic linking. Each wasm module imports it and the exports of each module as then added to it. Maybe we could rename it something better? "globalSymbolTable", "objectToImportIntoWasmFiles"?
3% seems like about what I expected. Is the coming from increased Wasm or JS size BTW? |
|
I'm gonna land this PR now and we can continue the discussion in followups. |
|
Don't worry, I'm not sweating it right now. 3% doesn't matter here, and there are more pressing things to work on :) |
We don't want the raw exports include things like
Asyncify.instrumentWasmExportsorrelocateExports. They should be the actual raw exports.See #25621