Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm-split] Configure split functions rather than kept functions #6949

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Sep 17, 2024

The configuration for the module splitting utility previous took a set
of functions to keep in the primary module. Change it to take a list of
functions to split into the secondary module instead. This improves the
code quality in multi-split mode because it keeps stub functions
generated by previous splits from being moved into secondary modules
during later splits.

Maintain the invariant that every defined functions belongs to either
the set of kept functions or the set of split functions. Functions are
kept by default except when --keep-funcs is specified without
--split-funcs on the command line. This is mostly NFC except that it
changes the default behavior when no arguments are specified on the
command line to keep all functions.

This will simplify a follow-on PR that switches from passing the kept
functions to the module splitting utility to passing the split
functions.
The configuration for the module splitting utility previous took a set
of functions to keep in the primary module. Change it to take a list of
functions to split into the secondary module instead. This improves the
code quality in multi-split mode because it keeps stub functions
generated by previous splits from being moved into secondary modules
during later splits.
@@ -7,8 +7,10 @@
;; RUN: wasm-dis %t3.wasm | filecheck %s --check-prefix=CHECK-C

(module
(type $ret-i32 (func (result i32)))
;; PRIMARY: (type $ret-i64 (func (result i64)))
Copy link
Member

Choose a reason for hiding this comment

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

Why is this not lined up with the declaration below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because $ret-i32 is in the way. output $ret-i64 < output $ret-i32 < input $ret-i32 < input $ret-i64.

Copy link
Member

Choose a reason for hiding this comment

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

But don't we now match the input order? Or does wasm-split reorder?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we decided to make all the tools reorder by default and preserve the input order only when --preserve-input-order is passed.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, sorry, I remembered that wrong then. Yeah, the issue was the reordered output was more optimal, and we didn't want to risk production builds.

Copy link
Member

Choose a reason for hiding this comment

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

Anyhow, using the flag might help here, but if it's just one line sgtm either way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll skip it for now because we would have to add --preserve-type-order to each of the 5 commands at the top, which I think would be more annoying than this one line.

Base automatically changed from wasm-split-simplify-args to main September 17, 2024 18:49
@tlively tlively merged commit da56469 into main Sep 17, 2024
13 checks passed
@tlively tlively deleted the wasm-split-config-split-funcs branch September 17, 2024 20:59
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