summaryrefslogtreecommitdiff
path: root/src/ir/module-splitting.h
diff options
context:
space:
mode:
authorBrendan Dahl <brendan.dahl@gmail.com>2023-01-20 10:37:36 -0800
committerGitHub <noreply@github.com>2023-01-20 10:37:36 -0800
commited3bf4f0613a66496342720d82f4100eccf39403 (patch)
tree0b779ca1a4b8f92bd9905ccb860eb7c8e1296ed2 /src/ir/module-splitting.h
parent992584fadfdd1714aeb8ff64e7e8cd7ca3ff3326 (diff)
downloadbinaryen-ed3bf4f0613a66496342720d82f4100eccf39403.tar.gz
binaryen-ed3bf4f0613a66496342720d82f4100eccf39403.tar.bz2
binaryen-ed3bf4f0613a66496342720d82f4100eccf39403.zip
Support using JSPI to load the secondary wasm split module. (#5431)
When using JSPI with wasm-split, any calls to secondary module functions will now first check a global to see if the module is loaded. If not loaded it will call a JSPI'ed function that will handle loading module. The setup is split into the JSPI pass and wasm-split tool since the JSPI pass is first run by emscripten and we need to JSPI'ify the load secondary module function. wasm-split then injects all the checks and calls to the load function.
Diffstat (limited to 'src/ir/module-splitting.h')
-rw-r--r--src/ir/module-splitting.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ir/module-splitting.h b/src/ir/module-splitting.h
index 2cc6760c0..dc5bb1998 100644
--- a/src/ir/module-splitting.h
+++ b/src/ir/module-splitting.h
@@ -44,6 +44,8 @@
namespace wasm::ModuleSplitting {
+static const Name LOAD_SECONDARY_MODULE("__load_secondary_module");
+
struct Config {
// The set of functions to keep in the primary module. All others are split
// out into the new secondary module. Must include the start function if it
@@ -64,6 +66,9 @@ struct Config {
// false, the original function names will be used (after `newExportPrefix`)
// as the new export names.
bool minimizeNewExportNames = false;
+ // When JSPI support is enabled the secondary module loading is handled by an
+ // imported function.
+ bool jspi = false;
};
struct Results {