You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[wasm-split] Make placeholder namespace contain module name (#7975)
For now we use a single namespace for all placeholder imports. This
namespace can be set by `--placeholder-namespace` and if not set it is
by default `placeholder`.
This changes it so that the namespace is in the format of
`placeholder.[secondaryName]`. That `placeholder`, or a user-specified
string via `--placeholder-namespace`, is a prefix of the namespace and
not the namespace itself. In `secondaryName` part we put the name of
secondary modules.
To be consistent with that change, I'd like to rename
`--placeholder-namespace` to `--placeholder-namespace-prefix`. But in
order not to break people who are using the old option, this just adds
`--placeholder-namespace-prefix` and keeps `--placeholder-namespace` but
make its behavior the same as `--placeholder-namespace-prefix`.
This is done to make multi-split module loading work in emscripten.
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.
The companion PR in emscripten
(emscripten-core/emscripten#25571) makes
emscripten runtime use that `secondaryName` part to figure out which
secondary module file to load in case a placeholder function is called.
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`.
Companion PR: emscripten-core/emscripten#25571,
which has to land first.
0 commit comments