Description
Today, binaryen generates dynCall_xx
functions that emscripten then uses in various places to call C/C++ functions via pointers.
Now that fastcomp has been removed we should be able replace this mechanism with function invocation directly via the wasm table. This will reduce our dependency on the post-link work done by wasm-emscripten-finalize
and could additionally offer some code size and/or performance benefits.
emscripten uses dynCall's for (at least) two different purposes:
-
In the implementation of
invoke_xx
functions that are in turn used to implement setjmp/longjmp and exception handling. In this case theinvoke_xx
functions jump directly back into native code via a function pointer (my first patch removes the use of dynCalls for this purpose: Use direct table access over dynCall in invoke_xx functions #11979). -
To invoke callback registered in various high level API (see
makeDynCall
in 'library_glfw.js,
library_browser.js`, etc). In this case JavaScript code need a generic what to invoke a C++ function pointer.