Skip to content

Remove the need for auto-generated dynCall_xx wasm functions #12002

Closed
@sbc100

Description

@sbc100

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:

  1. In the implementation of invoke_xx functions that are in turn used to implement setjmp/longjmp and exception handling. In this case the invoke_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).

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions