summaryrefslogtreecommitdiff
path: root/src/ir/module-splitting.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-09-17 14:42:56 -0700
committerGitHub <noreply@github.com>2024-09-17 21:42:56 +0000
commitbdc7ce0fbb2373d0ce666782fdce88f3bd8d6f17 (patch)
tree1ae0fb7e052c5398bf763f99eb28342f33e493bb /src/ir/module-splitting.cpp
parentda5646961c61f21dbb1d6218e370325ba43be9f0 (diff)
downloadbinaryen-bdc7ce0fbb2373d0ce666782fdce88f3bd8d6f17.tar.gz
binaryen-bdc7ce0fbb2373d0ce666782fdce88f3bd8d6f17.tar.bz2
binaryen-bdc7ce0fbb2373d0ce666782fdce88f3bd8d6f17.zip
[wasm-split] Minimize non-function export names (#6951)
The module splitting utility has a configuration option for minimizing new export names, but it was previously applied only to newly exported functions. Using the new multi-split mode can produce lots of exported tables and splitting WasmGC programs can produce lots of exported globals, so minimizing these export names can have a big impact on code size.
Diffstat (limited to 'src/ir/module-splitting.cpp')
-rw-r--r--src/ir/module-splitting.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ir/module-splitting.cpp b/src/ir/module-splitting.cpp
index caa996b30..f299d7a35 100644
--- a/src/ir/module-splitting.cpp
+++ b/src/ir/module-splitting.cpp
@@ -826,8 +826,11 @@ void ModuleSplitter::shareImportableItems() {
if (exportIt != exports.end()) {
secondaryItem.base = exportIt->second;
} else {
- Name exportName = Names::getValidExportName(
- primary, config.newExportPrefix + genericExportName);
+ std::string baseName =
+ config.newExportPrefix + (config.minimizeNewExportNames
+ ? minified.getName()
+ : genericExportName);
+ Name exportName = Names::getValidExportName(primary, baseName);
primary.addExport(new Export{exportName, primaryItem.name, kind});
secondaryItem.base = exportName;
}