Skip to content

Add an option for wasm-merge to write a split manifest#8534

Merged
tlively merged 5 commits intomainfrom
merge-manifest
Mar 28, 2026
Merged

Add an option for wasm-merge to write a split manifest#8534
tlively merged 5 commits intomainfrom
merge-manifest

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Mar 27, 2026

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.

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.
@tlively tlively requested a review from aheejin March 27, 2026 01:54
@tlively tlively requested a review from a team as a code owner March 27, 2026 01:54
Copy link
Copy Markdown
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice feature!

Comment on lines +857 to +865
for (auto& func : merged.functions) {
if (!func->imported() && functionToModule[func->name] == moduleName) {
if (first) {
manifest << moduleName << "\n";
first = false;
}
manifest << func->name.str << "\n";
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just create moduleToFunc rather than funcToModule above (line 799-806) and print it here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, good point 👍

Copy link
Copy Markdown
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comments


// 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.)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we are only collecting this info for the first module.

You mean secondary modules, right?

Co-authored-by: Heejin Ahn <aheejin@gmail.com>
@tlively tlively enabled auto-merge (squash) March 28, 2026 01:54
@tlively tlively merged commit 6d47684 into main Mar 28, 2026
16 checks passed
@tlively tlively deleted the merge-manifest branch March 28, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants