Skip to content

Commit 9f93631

Browse files
authored
[wasm-split] Support --no-placeholders option in multi-split (#7789)
This supports `--no-placeholders` option with `--multi-split`. Currently `--multi-split` does not accept `--no-placeholders` option and set it to true by default internally. Because `--no-placeholders` is false by default and this has been the case for the default two-way split, this means this PR is a breaking change for multi-split users. https://github.com/WebAssembly/binaryen/blob/8ad26cbaca2a3a8982789b25d9a279dc26e85f15/src/tools/wasm-split/split-options.cpp#L210-L218 But it will be inconsistent if we set the option by default to true in case of two-way split and false in case of multi-split. About the test: - This changes `CHECK-A`, `CHECK-B`, and `CHECK-C` to `MOD1`, `MOD2`, and `MOD3` - Because previously `--no-placeholders` was the default, the expectation lines for `PRIMARY` didn't have any placeholders. Now it does. - `***-OPTIONS` check lines now test both options, `--import-namespace` and `--no-placeholders`.
1 parent 8ad26cb commit 9f93631

File tree

5 files changed

+280
-210
lines changed

5 files changed

+280
-210
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ full changeset diff at the end of each section.
1515
Current Trunk
1616
-------------
1717

18+
- `wasm-split`'s `--multi-split` mode now supports more options:
19+
`--no-placeholders`, `--import-namespace`, `--emit-module-names`, and
20+
`--emit-text`. Because `--no-placeholders` is false by default and until now
21+
`--multi-split` didn't use placeholders at all, this is a breaking change. If
22+
you want to continue to do multi-split without placeholders, you need to
23+
explicitly specify `--no-placeholders`.
1824
- Add a `--string-lifting` pass that raises imported string operations and
1925
constants into stringref in Binaryen IR (which can then be fully optimized,
2026
and typically lowered back down with `--string-lowering`).

src/tools/wasm-split/split-options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ WasmSplitOptions::WasmSplitOptions()
213213
"Do not import placeholder functions. Calls to secondary functions will "
214214
"fail before the secondary module has been instantiated.",
215215
WasmSplitOption,
216-
{Mode::Split},
216+
{Mode::Split, Mode::MultiSplit},
217217
Options::Arguments::Zero,
218218
[&](Options* o, const std::string& argument) { usePlaceholders = false; })
219219
.add(

src/tools/wasm-split/wasm-split.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ void multiSplitModule(const WasmSplitOptions& options) {
415415
}
416416

417417
ModuleSplitting::Config config;
418-
config.usePlaceholders = false;
418+
config.usePlaceholders = options.usePlaceholders;
419419
config.importNamespace = options.importNamespace;
420420
config.minimizeNewExportNames = !options.passOptions.debugInfo;
421421
if (options.emitModuleNames && !wasm.name) {

test/lit/help/wasm-split.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
;; CHECK-NEXT: --symbolmap [split] Write a symbol map file for each
6868
;; CHECK-NEXT: of the output modules.
6969
;; CHECK-NEXT:
70-
;; CHECK-NEXT: --no-placeholders [split] Do not import placeholder
71-
;; CHECK-NEXT: functions. Calls to secondary functions
72-
;; CHECK-NEXT: will fail before the secondary module has
73-
;; CHECK-NEXT: been instantiated.
70+
;; CHECK-NEXT: --no-placeholders [split, multi-split] Do not import
71+
;; CHECK-NEXT: placeholder functions. Calls to secondary
72+
;; CHECK-NEXT: functions will fail before the secondary
73+
;; CHECK-NEXT: module has been instantiated.
7474
;; CHECK-NEXT:
7575
;; CHECK-NEXT: --placeholdermap [split] Write a file mapping placeholder
7676
;; CHECK-NEXT: indices to the function names.

0 commit comments

Comments
 (0)