Add an option for wasm-merge to write a split manifest#8534
Conversation
This manifest can later be given to wasm-split to split the merged module back up such that each function appears in its originating module. This can help simplify a merge-optimize-split workflow.
src/tools/wasm-merge.cpp
Outdated
| for (auto& func : merged.functions) { | ||
| if (!func->imported() && functionToModule[func->name] == moduleName) { | ||
| if (first) { | ||
| manifest << moduleName << "\n"; | ||
| first = false; | ||
| } | ||
| manifest << func->name.str << "\n"; | ||
| } | ||
| } |
There was a problem hiding this comment.
Can't we just create moduleToFunc rather than funcToModule above (line 799-806) and print it here?
|
|
||
| // The functions in the module have been renamed and copied rather than | ||
| // moved, so we can get their final names directly. (We don't need this | ||
| // for the first module because it does not appear in the manifest.) |
There was a problem hiding this comment.
I see we don't print this for the first module, but we are still collecting it for the first module, given that we start from 0 in the for loop above, no?
for (Index i = 0; i < inputFiles.size(); i++) {If not excluding the first module here was intentional, the comment is confusing. Also we can probably exclude the first module here, given that it won't be used.
There was a problem hiding this comment.
No, because we are in the else branch of the if (!laterInput), so we are only collecting this info for the first module. The comment is explaining why we don't need this in the other arm as well.
There was a problem hiding this comment.
so we are only collecting this info for the first module.
You mean secondary modules, right?
Co-authored-by: Heejin Ahn <aheejin@gmail.com>
This manifest can later be given to wasm-split to split the merged module back up such that each function appears in its originating module. This can help simplify a merge-optimize-split workflow.