-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix emulated function pointer cast exporting (#6939)
Emulated function pointers is the mode where we do calls from JS using the wasm Table, which is how we currently do dynamic linking in both asm.js and wasm (in asm.js, this mode creates something like a wasm Table on the outside of the asm.js, and calls that). Emulated function pointer casts is where we assume a function pointer type may be cast in a weird way, so we make sure indirect calls work even with the wrong argument number or type, sort of like native platforms do. The "trick" we use for that is to use i64s for all values, and cast as necessary. For this mode, we export every single function's function table index, as we need those from JS - we can't call them as wasm exports, as they return i64. So we call dynCall of the right signature, and then inside wasm we cast the i64 to what we want, and return that to JS. The bug here is that we mixed those two modes up - we exported all the function pointers for the former mode, when we just need it in the latter. So this just changes up a few ifdefs to the proper mode. Note the effect on the metadce test - a dynamic library now has far fewer exports and is smaller.
- Loading branch information
Showing
4 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters