Wrap component function exports in functions that call __wasm_init_task#2417
Wrap component function exports in functions that call __wasm_init_task#2417alexcrichton merged 12 commits intobytecodealliance:mainfrom
__wasm_init_task#2417Conversation
|
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.