[SPLIT_MODULE] Support multi-split loading #25571
Merged
+8
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if the primary module name is
test.wasm
and when a placeholder function is called, the emscripten JS runtime loadstest.deferred.wasm
, which is hardcoded. But as we want emscripten to support multi-split, the runtime has to know which secondary module to load.Binaryen's WebAssembly/binaryen#7975 changes the placeholder import module naming scheme. Currently placeholder's import modules are all
placeholder
: https://github.com/WebAssembly/binaryen/blob/dcc704ce20e4723ae42012039bdb3b84ec2035f9/test/lit/wasm-split/multi-split.wast#L291-L295But the Binaryen's companion PR will change this to the format of
placeholder.[secondaryName]
. Then Emscripten runtime will parse this module name to learn which secondary file to load. For example, if the import module isplaceholder.2
and the import base is3
and the primary wasm file istest.wasm
,when
placeholder_3
function is loaded, the runtime will parseplaceholder.2
and correctly figure out that it should loadtest.2.wasm
.This PR still supports the old
placeholder
namespace, because this PR has to land first for the Binaryen companion PR to land. After it lands, we can remove theplaceholder
handling part.Companion PR: WebAssembly/binaryen#7975