From 31004204b4903d660f2652fc27fa26fee29622c5 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 15 Oct 2025 03:26:04 +0000 Subject: [PATCH 1/5] [wasm-split] Make placeholder namespace contain module name 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 (#?????) 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: --- src/ir/module-splitting.cpp | 7 +++++-- src/ir/module-splitting.h | 8 +++++--- src/tools/wasm-split/split-options.cpp | 16 +++++++++++++--- src/tools/wasm-split/split-options.h | 2 +- src/tools/wasm-split/wasm-split.cpp | 14 +++++++------- test/lit/help/wasm-split.test | 12 +++++++++--- test/lit/wasm-split/jspi-secondary-export.wast | 2 +- test/lit/wasm-split/jspi.wast | 2 +- .../lit/wasm-split/multi-split-escape-names.wast | 6 +++--- test/lit/wasm-split/multi-split.wast | 12 ++++++------ test/lit/wasm-split/no-active-segment.wast | 2 +- test/lit/wasm-split/passive.wast | 2 +- test/lit/wasm-split/ref.func.wast | 4 ++-- test/lit/wasm-split/segments.wast | 2 +- test/lit/wasm-split/trampoline.wast | 2 +- 15 files changed, 57 insertions(+), 36 deletions(-) diff --git a/src/ir/module-splitting.cpp b/src/ir/module-splitting.cpp index 887d21b11cc..380fef8385b 100644 --- a/src/ir/module-splitting.cpp +++ b/src/ir/module-splitting.cpp @@ -772,7 +772,9 @@ void ModuleSplitter::setupTablePatching() { assert(table == tableManager.activeTable->name); placeholderMap[table][index] = ref->func; - Module& secondary = *secondaries.at(funcToSecondaryIndex.at(ref->func)); + Index secondaryIndex = funcToSecondaryIndex.at(ref->func); + Module& secondary = *secondaries.at(secondaryIndex); + Name secondaryName = config.secondaryNames.at(secondaryIndex); auto* secondaryFunc = secondary.getFunction(ref->func); moduleToReplacedElems[&secondary][index] = secondaryFunc; if (!config.usePlaceholders) { @@ -782,7 +784,8 @@ void ModuleSplitter::setupTablePatching() { return; } auto placeholder = std::make_unique(); - placeholder->module = config.placeholderNamespace; + placeholder->module = config.placeholderNamespacePrefix.toString() + "." + + secondaryName.toString(); placeholder->base = std::to_string(index); placeholder->name = Names::getValidFunctionName( primary, std::string("placeholder_") + placeholder->base.toString()); diff --git a/src/ir/module-splitting.h b/src/ir/module-splitting.h index d6c525f7c3b..8bf9a60ff7f 100644 --- a/src/ir/module-splitting.h +++ b/src/ir/module-splitting.h @@ -53,6 +53,8 @@ struct Config { // may not include imported functions, which are always kept in the primary // module regardless. std::vector> secondaryFuncs; + // A vector of names of the secondary modules. + std::vector secondaryNames; // Whether to import placeholder functions into the primary module that will // be called when a secondary function is called before the secondary module // has been loaded. @@ -60,9 +62,9 @@ struct Config { // The namespace from which to import primary functions into the secondary // module. Name importNamespace = "primary"; - // The namespace from which to import placeholder functions into the primary - // module. Ignored if `usePlaceholders` is false. - Name placeholderNamespace = "placeholder"; + // The prefix of the namespaces from which to import placeholder functions + // into the primary module. Ignored if `usePlaceholders` is false. + Name placeholderNamespacePrefix = "placeholder"; // The prefix to attach to the name of any newly created exports. This can be // used to differentiate between "real" exports of the module and exports that // should only be consumed by the secondary module. diff --git a/src/tools/wasm-split/split-options.cpp b/src/tools/wasm-split/split-options.cpp index c47f11e589d..bcd7b1aa814 100644 --- a/src/tools/wasm-split/split-options.cpp +++ b/src/tools/wasm-split/split-options.cpp @@ -236,15 +236,25 @@ WasmSplitOptions::WasmSplitOptions() [&](Options* o, const std::string& argument) { importNamespace = argument; }) + .add("--placeholder-namespace-prefix", + "", + "The prefix for the namespaces from which to import placeholder " + "functions into the primary module. The namespaces will be " + "concatenations of the prefix and the module name.", + WasmSplitOption, + {Mode::Split, Mode::MultiSplit}, + Options::Arguments::One, + [&](Options* o, const std::string& argument) { + placeholderNamespacePrefix = argument; + }) .add("--placeholder-namespace", "", - "The namespace from which to import placeholder functions into " - "the primary module.", + "The same as --placeholder-namespace-prefix.", WasmSplitOption, {Mode::Split, Mode::MultiSplit}, Options::Arguments::One, [&](Options* o, const std::string& argument) { - placeholderNamespace = argument; + placeholderNamespacePrefix = argument; }) .add("--jspi", "", diff --git a/src/tools/wasm-split/split-options.h b/src/tools/wasm-split/split-options.h index 8f23928c322..52b59d0c646 100644 --- a/src/tools/wasm-split/split-options.h +++ b/src/tools/wasm-split/split-options.h @@ -67,7 +67,7 @@ struct WasmSplitOptions : ToolOptions { std::string secondaryOutput; std::string importNamespace; - std::string placeholderNamespace; + std::string placeholderNamespacePrefix; std::string secondaryMemoryName; std::string exportPrefix; diff --git a/src/tools/wasm-split/wasm-split.cpp b/src/tools/wasm-split/wasm-split.cpp index 47cba0e5ed4..1126c55be66 100644 --- a/src/tools/wasm-split/wasm-split.cpp +++ b/src/tools/wasm-split/wasm-split.cpp @@ -232,8 +232,8 @@ void setCommonSplitConfigs(ModuleSplitting::Config& config, if (options.exportPrefix.size()) { config.newExportPrefix = options.exportPrefix; } - if (options.placeholderNamespace.size()) { - config.placeholderNamespace = options.placeholderNamespace; + if (options.placeholderNamespacePrefix.size()) { + config.placeholderNamespacePrefix = options.placeholderNamespacePrefix; } } @@ -346,6 +346,7 @@ void splitModule(const WasmSplitOptions& options) { ModuleSplitting::Config config; setCommonSplitConfigs(config, options); config.secondaryFuncs.push_back(std::move(splitFuncs)); + config.secondaryNames.push_back("deferred"); config.jspi = options.jspi; auto splitResults = ModuleSplitting::splitFunctions(wasm, config); auto& secondary = *splitResults.secondaries.begin(); @@ -407,7 +408,6 @@ void multiSplitModule(const WasmSplitOptions& options) { std::string line; bool newSection = true; - std::vector moduleNames; std::unordered_set moduleNameSet; while (std::getline(manifest, line)) { if (line.empty()) { @@ -424,7 +424,7 @@ void multiSplitModule(const WasmSplitOptions& options) { } currModule = name; moduleNameSet.insert(currModule); - moduleNames.push_back(currModule); + config.secondaryNames.push_back(currModule); config.secondaryFuncs.emplace_back(std::set()); currFuncs = &config.secondaryFuncs.back(); newSection = false; @@ -448,10 +448,10 @@ void multiSplitModule(const WasmSplitOptions& options) { } auto splitResults = ModuleSplitting::splitFunctions(wasm, config); - assert(moduleNames.size() == splitResults.secondaries.size()); - for (Index i = 0, n = moduleNames.size(); i < n; i++) { + assert(config.secondaryNames.size() == splitResults.secondaries.size()); + for (Index i = 0, n = config.secondaryNames.size(); i < n; i++) { auto& secondary = *splitResults.secondaries[i]; - auto moduleName = options.outPrefix + moduleNames[i].toString() + + auto moduleName = options.outPrefix + config.secondaryNames[i].toString() + (options.emitBinary ? ".wasm" : ".wast"); if (options.symbolMap) { writeSymbolMap(secondary, moduleName + ".symbols"); diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index a2eeefa5366..2991c6158b3 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -84,9 +84,15 @@ ;; CHECK-NEXT: mode, refers to the namespace from which ;; CHECK-NEXT: to import the secondary memory, if any. ;; CHECK-NEXT: -;; CHECK-NEXT: --placeholder-namespace [split, multi-split] The namespace from -;; CHECK-NEXT: which to import placeholder functions -;; CHECK-NEXT: into the primary module. +;; CHECK-NEXT: --placeholder-namespace-prefix [split, multi-split] The prefix for the +;; CHECK-NEXT: namespaces from which to import +;; CHECK-NEXT: placeholder functions into the primary +;; CHECK-NEXT: module. The namespaces will be +;; CHECK-NEXT: concatenations of the prefix and the +;; CHECK-NEXT: module name. +;; CHECK-NEXT: +;; CHECK-NEXT: --placeholder-namespace [split, multi-split] The same as +;; CHECK-NEXT: --placeholder-namespace-prefix. ;; CHECK-NEXT: ;; CHECK-NEXT: --jspi [split] Transform the module to support ;; CHECK-NEXT: asynchronously loading the secondary diff --git a/test/lit/wasm-split/jspi-secondary-export.wast b/test/lit/wasm-split/jspi-secondary-export.wast index 43586343849..36ce76fad11 100644 --- a/test/lit/wasm-split/jspi-secondary-export.wast +++ b/test/lit/wasm-split/jspi-secondary-export.wast @@ -13,7 +13,7 @@ ;; PRIMARY: (import "env" "__load_secondary_module" (func $fimport$0)) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; PRIMARY: (global $global$0 (mut i32) (i32.const 0)) diff --git a/test/lit/wasm-split/jspi.wast b/test/lit/wasm-split/jspi.wast index d86775c8225..f821d4a2d2a 100644 --- a/test/lit/wasm-split/jspi.wast +++ b/test/lit/wasm-split/jspi.wast @@ -13,7 +13,7 @@ ;; PRIMARY: (import "env" "__load_secondary_module" (func $fimport$0)) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; PRIMARY: (global $global$0 (mut i32) (i32.const 0)) diff --git a/test/lit/wasm-split/multi-split-escape-names.wast b/test/lit/wasm-split/multi-split-escape-names.wast index 51de069fc77..91fc3196d43 100644 --- a/test/lit/wasm-split/multi-split-escape-names.wast +++ b/test/lit/wasm-split/multi-split-escape-names.wast @@ -169,11 +169,11 @@ (f32.const 0) ) ) -;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (result i64))) +;; PRIMARY: (import "placeholder.2" "0" (func $placeholder_0 (result i64))) -;; PRIMARY: (import "placeholder" "1" (func $placeholder_1 (result f32))) +;; PRIMARY: (import "placeholder.3" "1" (func $placeholder_1 (result f32))) -;; PRIMARY: (import "placeholder" "2" (func $placeholder_2 (result i32))) +;; PRIMARY: (import "placeholder.1" "2" (func $placeholder_2 (result i32))) ;; PRIMARY: (table $0 3 funcref) diff --git a/test/lit/wasm-split/multi-split.wast b/test/lit/wasm-split/multi-split.wast index 5a34304c861..a16049eca82 100644 --- a/test/lit/wasm-split/multi-split.wast +++ b/test/lit/wasm-split/multi-split.wast @@ -288,11 +288,11 @@ (f32.const 0) ) ) -;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (result i64))) +;; PRIMARY: (import "placeholder.2" "0" (func $placeholder_0 (result i64))) -;; PRIMARY: (import "placeholder" "1" (func $placeholder_1 (result f32))) +;; PRIMARY: (import "placeholder.3" "1" (func $placeholder_1 (result f32))) -;; PRIMARY: (import "placeholder" "2" (func $placeholder_2 (result i32))) +;; PRIMARY: (import "placeholder.1" "2" (func $placeholder_2 (result i32))) ;; PRIMARY: (table $0 3 funcref) @@ -354,11 +354,11 @@ ;; PRIMARY-OPTIONS-NEXT: ) ;; PRIMARY-OPTIONS-NEXT: ) -;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env" "0" (func $placeholder_0 (result i64))) +;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env.2" "0" (func $placeholder_0 (result i64))) -;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env" "1" (func $placeholder_1 (result f32))) +;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env.3" "1" (func $placeholder_1 (result f32))) -;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env" "2" (func $placeholder_2 (result i32))) +;; PRIMARY-PLACEHOLDER-NAMESPACE: (import "placeholder_env.1" "2" (func $placeholder_2 (result i32))) ;; PRIMARY-PLACEHOLDER-NAMESPACE: (table $0 3 funcref) diff --git a/test/lit/wasm-split/no-active-segment.wast b/test/lit/wasm-split/no-active-segment.wast index 507854730c6..4a044a8b846 100644 --- a/test/lit/wasm-split/no-active-segment.wast +++ b/test/lit/wasm-split/no-active-segment.wast @@ -24,7 +24,7 @@ ) ;; PRIMARY: (type $0 (func)) -;; PRIMARY: (import "placeholder" "0" (func $placeholder_0)) +;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0)) ;; PRIMARY: (table $0 1 funcref) diff --git a/test/lit/wasm-split/passive.wast b/test/lit/wasm-split/passive.wast index 9c6e1e98d0f..57cdbc18af0 100644 --- a/test/lit/wasm-split/passive.wast +++ b/test/lit/wasm-split/passive.wast @@ -9,7 +9,7 @@ ;; PRIMARY: (type $0 (func)) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (type $0))) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) ;; PRIMARY: (table $table 3 funcref) (table $table 3 funcref) diff --git a/test/lit/wasm-split/ref.func.wast b/test/lit/wasm-split/ref.func.wast index 952dc5c5ac0..ef36e44704c 100644 --- a/test/lit/wasm-split/ref.func.wast +++ b/test/lit/wasm-split/ref.func.wast @@ -10,9 +10,9 @@ (module ;; PRIMARY: (type $0 (func)) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (type $0))) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) - ;; PRIMARY: (import "placeholder" "1" (func $placeholder_1 (type $0))) + ;; PRIMARY: (import "placeholder.deferred" "1" (func $placeholder_1 (type $0))) ;; PRIMARY: (global $glob1 (ref func) (ref.func $prime)) diff --git a/test/lit/wasm-split/segments.wast b/test/lit/wasm-split/segments.wast index 215afd247fc..0cf119a871f 100644 --- a/test/lit/wasm-split/segments.wast +++ b/test/lit/wasm-split/segments.wast @@ -14,7 +14,7 @@ ;; PRIMARY: (type $elem-array (array externref)) (type $elem-array (array externref)) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0)) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0)) ;; PRIMARY: (memory $mem 0) (memory $mem 0) diff --git a/test/lit/wasm-split/trampoline.wast b/test/lit/wasm-split/trampoline.wast index b19ca1e9c4c..20711206afc 100644 --- a/test/lit/wasm-split/trampoline.wast +++ b/test/lit/wasm-split/trampoline.wast @@ -6,7 +6,7 @@ (module ;; PRIMARY: (type $0 (func (param i32) (result i32))) - ;; PRIMARY: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) + ;; PRIMARY: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; PRIMARY: (table $table 1 1 funcref) (table $table 1 1 funcref) From 3db6fc0960d816b4803115d0a7d735aeee6f5c2a Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 16 Oct 2025 22:34:02 +0000 Subject: [PATCH 2/5] Update example tests --- test/example/module-splitting.cpp | 2 ++ test/example/module-splitting.txt | 44 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp index 96b4101fc97..e09316acbef 100644 --- a/test/example/module-splitting.cpp +++ b/test/example/module-splitting.cpp @@ -52,6 +52,7 @@ void do_test(const std::set& keptFuncs, std::string&& module) { ModuleSplitting::Config config; config.secondaryFuncs.push_back(std::move(splitFuncs)); + config.secondaryNames.push_back("deferred"); config.newExportPrefix = "%"; auto results = splitFunctions(*primary, config); auto& secondary = *results.secondaries.begin(); @@ -477,6 +478,7 @@ void test_minimized_exports() { ModuleSplitting::Config config; config.secondaryFuncs.push_back({"call"}); + config.secondaryNames.push_back("deferred"); config.newExportPrefix = "%"; config.minimizeNewExportNames = true; diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index fa4eda78c1d..b312636bf10 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -333,7 +333,7 @@ Keeping: After: (module (type $0 (func (param i32) (result i32))) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $0 1 funcref) (elem $0 (i32.const 0) $placeholder_0) (export "foo" (func $trampoline_foo)) @@ -369,7 +369,7 @@ Keeping: After: (module (type $0 (func (param i32) (result i32))) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 1 funcref) (table $0 1 funcref) (elem $0 (table $table) (i32.const 0) func $trampoline_foo) @@ -407,7 +407,7 @@ Keeping: After: (module (type $0 (func (param i32) (result i32))) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 2 funcref) (table $0 1 funcref) (elem $0 (table $table) (i32.const 0) func $trampoline_foo $trampoline_foo) @@ -446,7 +446,7 @@ Keeping: After: (module (type $0 (func (param i32) (result i32))) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 1000 funcref) (table $0 1 funcref) (elem $0 (table $table) (i32.const 42) func $trampoline_foo) @@ -488,7 +488,7 @@ After: (module (type $0 (func (param i32) (result i32))) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 1000 funcref) (table $0 1 funcref) (elem $0 (table $table) (global.get $base) func $trampoline_foo) @@ -531,7 +531,7 @@ After: (module (type $0 (func (param i32) (result i32))) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 1000 funcref) (table $0 1 funcref) (elem $0 (table $table) (global.get $base) func $trampoline_foo $trampoline_foo) @@ -578,7 +578,7 @@ After: (type $0 (func)) (type $1 (func (param i32) (result i32))) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $1) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $1) (param i32) (result i32))) (table $table 1000 funcref) (table $0 1 funcref) (elem $0 (table $table) (global.get $base) func $null $trampoline_foo) @@ -671,7 +671,7 @@ Keeping: foo After: (module (type $0 (func)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) (table $0 1 funcref) (elem $0 (i32.const 0) $placeholder_0) (export "%table" (table $0)) @@ -726,7 +726,7 @@ Keeping: foo After: (module (type $0 (func)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) (table $0 1 funcref) (elem $0 (i32.const 0) $placeholder_0) (export "%foo" (func $trampoline_bar)) @@ -775,8 +775,8 @@ Keeping: bar, quux After: (module (type $0 (func)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) - (import "placeholder" "1" (func $placeholder_1 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "1" (func $placeholder_1 (type $0))) (table $table 4 funcref) (table $0 2 funcref) (elem $0 (table $table) (i32.const 0) func $trampoline_foo $bar $trampoline_baz $quux) @@ -838,8 +838,8 @@ After: (module (type $0 (func)) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) - (import "placeholder" "1" (func $placeholder_1 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "1" (func $placeholder_1 (type $0))) (table $table 4 funcref) (table $0 2 funcref) (elem $0 (table $table) (global.get $base) func $trampoline_foo $bar $trampoline_baz $quux) @@ -900,9 +900,9 @@ Keeping: baz After: (module (type $0 (func)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) - (import "placeholder" "1" (func $placeholder_1 (type $0))) - (import "placeholder" "2" (func $placeholder_2 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "1" (func $placeholder_1 (type $0))) + (import "placeholder.deferred" "2" (func $placeholder_2 (type $0))) (table $table 4 funcref) (table $0 3 funcref) (elem $0 (table $table) (i32.const 0) func $trampoline_foo $trampoline_bar $baz $trampoline_quux) @@ -969,9 +969,9 @@ After: (module (type $0 (func)) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) - (import "placeholder" "1" (func $placeholder_1 (type $0))) - (import "placeholder" "2" (func $placeholder_2 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "1" (func $placeholder_1 (type $0))) + (import "placeholder.deferred" "2" (func $placeholder_2 (type $0))) (table $table 4 funcref) (table $0 3 funcref) (elem $0 (table $table) (global.get $base) func $trampoline_foo $trampoline_bar $baz $trampoline_quux) @@ -1033,7 +1033,7 @@ After: (module (type $0 (func)) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) (table $table 2 funcref) (table $0 1 funcref) (elem $0 (table $table) (global.get $base) func $foo $trampoline_bar) @@ -1083,7 +1083,7 @@ Keeping: foo After: (module (type $0 (func (param i32) (result i32))) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) (table $table 1 1 funcref) (table $0 1 funcref) (elem $0 (table $table) (i32.const 0) func $foo) @@ -1124,7 +1124,7 @@ Keeping: After: (module (type $0 (func)) - (import "placeholder" "0" (func $placeholder_0 (type $0))) + (import "placeholder.deferred" "0" (func $placeholder_0 (type $0))) (table $0 1 funcref) (elem $0 (i32.const 0) $placeholder_0) (export "foo1" (func $trampoline_foo)) From 5f31c712cf25387a4d5a018fd49be2fe4693e843 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 Oct 2025 00:45:44 +0000 Subject: [PATCH 3/5] Test changes that were not autogenerated --- test/lit/wasm-split/basic.wast | 6 +++--- test/lit/wasm-split/table64-const-offset.wast | 4 ++-- test/lit/wasm-split/table64-global-offset.wast | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast index 9af64daedfa..ef0ce332c1b 100644 --- a/test/lit/wasm-split/basic.wast +++ b/test/lit/wasm-split/basic.wast @@ -70,7 +70,7 @@ ;; KEEP-NONE-PRIMARY: (module ;; KEEP-NONE-PRIMARY-NEXT: (type $0 (func (param i32) (result i32))) -;; KEEP-NONE-PRIMARY-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) +;; KEEP-NONE-PRIMARY-NEXT: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; KEEP-NONE-PRIMARY-NEXT: (table $table 1 1 funcref) ;; KEEP-NONE-PRIMARY-NEXT: (elem $0 (i32.const 0) $placeholder_0) ;; KEEP-NONE-PRIMARY-NEXT: (export "%table" (table $table)) @@ -97,7 +97,7 @@ ;; KEEP-FOO-PRIMARY: (module ;; KEEP-FOO-PRIMARY-NEXT: (type $0 (func (param i32) (result i32))) -;; KEEP-FOO-PRIMARY-NEXT: (import "placeholder" "1" (func $placeholder_1 (param i32) (result i32))) +;; KEEP-FOO-PRIMARY-NEXT: (import "placeholder.deferred" "1" (func $placeholder_1 (param i32) (result i32))) ;; KEEP-FOO-PRIMARY-NEXT: (table $table 2 2 funcref) ;; KEEP-FOO-PRIMARY-NEXT: (elem $0 (i32.const 0) $foo $placeholder_1) ;; KEEP-FOO-PRIMARY-NEXT: (export "%foo" (func $foo)) @@ -127,7 +127,7 @@ ;; KEEP-BAR-PRIMARY: (module ;; KEEP-BAR-PRIMARY-NEXT: (type $0 (func (param i32) (result i32))) -;; KEEP-BAR-PRIMARY-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) +;; KEEP-BAR-PRIMARY-NEXT: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; KEEP-BAR-PRIMARY-NEXT: (table $table 1 1 funcref) ;; KEEP-BAR-PRIMARY-NEXT: (elem $0 (i32.const 0) $placeholder_0) ;; KEEP-BAR-PRIMARY-NEXT: (export "%bar" (func $bar)) diff --git a/test/lit/wasm-split/table64-const-offset.wast b/test/lit/wasm-split/table64-const-offset.wast index 58bb33d6139..c3c584ad91a 100644 --- a/test/lit/wasm-split/table64-const-offset.wast +++ b/test/lit/wasm-split/table64-const-offset.wast @@ -19,7 +19,7 @@ ;; PRIMARY-NOREF: (module ;; PRIMARY-NOREF-NEXT: (type $0 (func (param i32) (result i32))) -;; PRIMARY-NOREF-NEXT: (import "placeholder" "1" (func $placeholder_1 (param i32) (result i32))) +;; PRIMARY-NOREF-NEXT: (import "placeholder.deferred" "1" (func $placeholder_1 (param i32) (result i32))) ;; PRIMARY-NOREF-NEXT: (table $table i64 2 2 funcref) ;; PRIMARY-NOREF-NEXT: (elem $0 (i64.const 0) $foo $placeholder_1) ;; PRIMARY-NOREF-NEXT: (export "%foo" (func $foo)) @@ -46,7 +46,7 @@ ;; PRIMARY-REF: (module ;; PRIMARY-REF-NEXT: (type $0 (func (param i32) (result i32))) -;; PRIMARY-REF-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) +;; PRIMARY-REF-NEXT: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; PRIMARY-REF-NEXT: (table $table i64 1 1 funcref) ;; PRIMARY-REF-NEXT: (table $1 1 funcref) ;; PRIMARY-REF-NEXT: (elem $0 (table $table) (i64.const 0) func $foo) diff --git a/test/lit/wasm-split/table64-global-offset.wast b/test/lit/wasm-split/table64-global-offset.wast index 7cacbe7de61..fb31e90e0ef 100644 --- a/test/lit/wasm-split/table64-global-offset.wast +++ b/test/lit/wasm-split/table64-global-offset.wast @@ -20,7 +20,7 @@ ;; PRIMARY-NOREF: (module ;; PRIMARY-NOREF-NEXT: (type $0 (func (param i32) (result i32))) ;; PRIMARY-NOREF-NEXT: (import "env" "g" (global $g i64)) -;; PRIMARY-NOREF-NEXT: (import "placeholder" "1" (func $placeholder_1 (param i32) (result i32))) +;; PRIMARY-NOREF-NEXT: (import "placeholder.deferred" "1" (func $placeholder_1 (param i32) (result i32))) ;; PRIMARY-NOREF-NEXT: (table $table i64 2 2 funcref) ;; PRIMARY-NOREF-NEXT: (elem $0 (global.get $g) $foo $placeholder_1) ;; PRIMARY-NOREF-NEXT: (export "%foo" (func $foo)) @@ -53,7 +53,7 @@ ;; PRIMARY-REF: (module ;; PRIMARY-REF-NEXT: (type $0 (func (param i32) (result i32))) ;; PRIMARY-REF-NEXT: (import "env" "g" (global $g i64)) -;; PRIMARY-REF-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) +;; PRIMARY-REF-NEXT: (import "placeholder.deferred" "0" (func $placeholder_0 (param i32) (result i32))) ;; PRIMARY-REF-NEXT: (table $table i64 1 1 funcref) ;; PRIMARY-REF-NEXT: (table $1 1 funcref) ;; PRIMARY-REF-NEXT: (elem $0 (table $table) (global.get $g) func $foo) From f736dfeeeabd7ab674b40928396693b40c166ad5 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 Oct 2025 04:12:24 +0000 Subject: [PATCH 4/5] dummy change to retrigger CI --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3809263edc..f817e3a78a4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![CI](https://github.com/WebAssembly/binaryen/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/WebAssembly/binaryen/actions/workflows/ci.yml?branch=main&event=push) - + # Binaryen Binaryen is a compiler and toolchain infrastructure library for WebAssembly, From 0ff1e9360f57280268b21ddadc0f5481231523fb Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 17 Oct 2025 04:12:37 +0000 Subject: [PATCH 5/5] Revert "dummy change to retrigger CI" This reverts commit f736dfeeeabd7ab674b40928396693b40c166ad5. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f817e3a78a4..b3809263edc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![CI](https://github.com/WebAssembly/binaryen/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/WebAssembly/binaryen/actions/workflows/ci.yml?branch=main&event=push) - + # Binaryen Binaryen is a compiler and toolchain infrastructure library for WebAssembly,