File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626// placeholder function (and eventually to the original secondary
2727// function), allocating a new table slot for the placeholder if necessary.
2828//
29- // 4. Replace all references to each secondary module's functions in the
30- // primary module's and each other secondary module's table segments with
31- // references to imported placeholder functions.
29+ // 4. Pre-create trampolines for secondary functions referenced in global
30+ // initializers but not yet replace the function references. Replace all
31+ // other references to each secondary module's functions in the primary
32+ // module's and each other secondary module's table segments with
33+ // references to trampoline functions that call imported placeholder
34+ // functions.
3235//
3336// 5. Rewrite direct calls from primary functions to secondary functions to be
3437// indirect calls to their placeholder functions (and eventually to their
4851// import them in the secondary modules. If possible, move those module
4952// items instead to the secondary modules.
5053//
54+ // 9. Delete unused trampoline functions pre-created in 3, since some global
55+ // initializers end up referencing functions the same module.
56+ //
5157// Functions can be used or referenced three ways in a WebAssembly module: they
5258// can be exported, called, or referenced with ref.func. The above procedure
5359// introduces a layer of indirection to each of those mechanisms that removes
You can’t perform that action at this time.
0 commit comments