Skip to content

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

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

Closed
sbc100 opened this issue Aug 22, 2020 · 2 comments
Closed

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

sbc100 opened this issue Aug 22, 2020 · 2 comments
Labels

Comments

@sbc100
Copy link
Collaborator

sbc100 commented Aug 22, 2020

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.

@sbc100
Copy link
Collaborator Author

sbc100 commented Aug 26, 2020

This is part of WebAssembly/binaryen#3043

sbc100 added a commit that referenced this issue Aug 26, 2020
Some uses of this function can just be replaced by `makeDynCall`.

The remaining uses only exist in library_browser.js and so this function
can become a library function there.

This is part of #12002
sbc100 added a commit that referenced this issue Aug 26, 2020
sbc100 added a commit that referenced this issue Aug 26, 2020
sbc100 added a commit that referenced this issue Aug 26, 2020
Some uses of this function can just be replaced by `makeDynCall`.

The remaining uses only exist in library_browser.js and so this function
can become a library function there.

This is part of #12002
sbc100 added a commit that referenced this issue Aug 26, 2020
sbc100 added a commit that referenced this issue Aug 26, 2020
This change now passes flags to binaryen to limit the creation
of the dynCall functions and removes more internal use of the
legacy dynCall functions.

See #12002
sbc100 added a commit that referenced this issue Aug 27, 2020
This change now passes flags to binaryen to limit the creation
of the dynCall functions and removes more internal use of the
legacy dynCall functions.

See #12002
sbc100 added a commit that referenced this issue Aug 27, 2020
This change now passes flags to binaryen to limit the creation
of the dynCall functions and removes more internal use of the
legacy dynCall functions.

See #12002
sbc100 added a commit that referenced this issue Aug 31, 2020
This change now passes flags to binaryen to limit the creation
of the dynCall functions and removes more internal use of the
legacy dynCall functions.

See #12002
sbc100 added a commit that referenced this issue Aug 31, 2020
This change now passes flags to binaryen to limit the creation
of the dynCall functions and removes more internal use of the
legacy dynCall functions.

See #12002
@stale
Copy link

stale bot commented Aug 28, 2021

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant