-
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
Allow ASM_CONSTS keys to be non-contiguous #9740
Conversation
As part of the plan to fix #9013, I plan to use the absolute address of the string in memory to index into this object.
Before we used 0-based indexes which meant that we needed to modify the code calling the emask function to replace the first argument. Now we use the string address itself as the index/code for the emasm constant. This allows use code to go unmodifed as the emscripten side will accept the memory address as the index/code. See: emscripten-core/emscripten#9013 Depends on: emscripten-core/emscripten#9740
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 understand how this and the other PRs help with the PIC issue, so I'm missing the point I guess.
Before we had an abstract 0-indexed list of EM_ASMs. After this, we have a map keyed on the string address. The new index depends on memory and so must be adjusted for relocation, which seems more complicated than before?
I'll try to explain why this helps us. This change is mostly to make binaryen's job simpler in the AsmConstWalker pass. In the current model the walker has two jobs:
After this change binaryen only needs to perform (1). No AST changes are needed at all. This in itself simplifies the pass, but the motivating factor is that doing (2) becomes very hard once arg0 has logic in its children. With PIC code the logic for determining string addresses become "global.get + offset", and llvm can do things like cash the result of the |
See like fetch depends on emscripten_is_main_browser_thread and not on emscripten_is_main_runtime_thread. I'm not sure how write a test for this but is came up as part of #9740.
See like fetch depends on emscripten_is_main_browser_thread and not on emscripten_is_main_runtime_thread. I'm not sure how write a test for this but is came up as part of #9740.
See like fetch depends on emscripten_is_main_browser_thread and not on emscripten_is_main_runtime_thread. I'm not sure how write a test for this but is came up as part of #9740.
As part of the plan to fix emscripten-core#9013, I plan to use the absolute address of the string in memory to index into this object.
See like fetch depends on emscripten_is_main_browser_thread and not on emscripten_is_main_runtime_thread. I'm not sure how write a test for this but is came up as part of emscripten-core#9740.
As part of the plan to fix #9013, I plan to use the absolute address
of the string in memory to index into this object.