Commit 56ed8e9
authored
[SPLIT_MODULE] Support multi-split loading (#25571)
Currently, if the primary module name is `test.wasm` and when a
placeholder function is called, the emscripten JS runtime loads
`test.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-L295
But 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 is `placeholder.2` and the import base is `3` and the
primary wasm file is `test.wasm`,
```wast
(import "placeholder.2" "3" (func $placeholder_3 (result i32)))
```
when `placeholder_3` function is loaded, the runtime will parse
`placeholder.2` and correctly figure out that it should load
`test.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 the `placeholder` handling part.
Companion PR: WebAssembly/binaryen#79751 parent 0b127ff commit 56ed8e9
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
493 | 500 | | |
494 | 501 | | |
495 | 502 | | |
496 | 503 | | |
497 | 504 | | |
498 | 505 | | |
499 | | - | |
500 | 506 | | |
501 | 507 | | |
502 | 508 | | |
503 | 509 | | |
504 | 510 | | |
505 | | - | |
506 | | - | |
| 511 | + | |
507 | 512 | | |
508 | 513 | | |
509 | 514 | | |
| |||
0 commit comments