From bdc7ce0fbb2373d0ce666782fdce88f3bd8d6f17 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 17 Sep 2024 14:42:56 -0700 Subject: [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. --- src/ir/module-splitting.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ir/module-splitting.cpp') 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; } -- cgit v1.2.3