-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[wasm64] Enable table64 lowering #21992
Conversation
This change prepares for the LLVM change which actually enables the use of table64 in the output: llvm/llvm-project#92042
Can you write a note in the commit message about the other stuff that this PR does (table32 export , the dyncall signature thing) and why? |
Done! |
Thanks! |
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.
Change LGTM though, we will be modifying the dyncall part again soon anyway.
The first argument to the dyncall function is a table index. With table32 the first argument to the dyncall function was always i32. With table64 we start seeing the first argument being i64 and even after lowering the ABI is still i64 (with a wrap injected by the lowering pass on the call_indirect). |
Right, but I guess my question was, why don't we know whether we're using table32 or table64 at the time the signatures are generated? |
Yes we do know in binaryen, and we generate the right signatures in binaryen these days. This was enabled in WebAssembly/binaryen#6604. The differences was that before we would always generated dynCalls with i32 for the first argument even for memory64.. mostly because that was the easiest thing to do and pointers in JS are numbers anyway. Once I landed WebAssembly/binaryen#6604 then emscripten now has to deal with two different types of dynCalls onces with i32 arg0 and onces with i64 arg0 (under memory64). This code here handles the latter case. Because we just ignored the issue by always generating wasm32-style dyncalls that just happened to work fine. |
This change prepares for the LLVM change which actually enables the use of table64 in the output:
llvm/llvm-project#92042
This change does several things:
dynCall_xxx
functions (which take a pointer as their first argument). Previously we got away with using i32 here since functions pointers happened to be i32.__table_base32
. Previously llvm would generate references to this symbol which meant it would get pulled in via normal mechanism. Now the references are generate by a post-link binaryen pass, so we need to explicitly export it.