-
Notifications
You must be signed in to change notification settings - Fork 313
Wrap component function exports in functions that call __wasm_init_task
#2417
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
Conversation
|
Thanks! Some high level thoughts on this:
|
Sure, maybe worth keeping a
Yeah, that sounds good to me.
👍 |
|
On one hand that seems redundant to have a |
__wasilibc_init_task__wasm_init_task
Exports need their stack pointer and thread-local storage set up. For this, in wasip3,
wasi-libccan export__wasilibc_init_task(_async)functions that should be called before the real component exports are called. This PR introduces a new module into components generated bywit-componentwhen it detects__wasilibc_init_task(_async)functions exported from the main module.This new module is called
wasilibc-init-wrappers. For every function the component exports, it imports that function, and exports a wrapper that calls the relevant task initialization function before calling the original export. I did this with a separate module to cleanly separate out the logic, but could dump the wrappers into the original module or the shim if desired.