Skip to content

[6.0] [PackageCMO] Support inlinability with [serialized_for_package] #73876

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

Closed
wants to merge 1 commit into from

Conversation

elsh
Copy link
Contributor

@elsh elsh commented May 24, 2024

  • Explanation: Supports a tri-state serialization kind with serialized_for_pkg. Adds a new inlinability rule depending on the caller and callee SerializedKind to allow more inlining during Package CMO.
  • Scope: Updates serialization bit in all SIL entry layouts. The entries should continue to be either serialized or not as before. Only when Package CMO is enabled, they'll be set to the new package serialization kind.
  • Original PR: Support inlinability with [serialized_for_package]  #73754
  • Risk: Low. The entries should continue to be either serialized or not as before. Only when Package CMO is enabled, they'll be set to the new package serialization kind.
  • Testing: Added new tests.
  • Issue: rdar://128406520&128647016
  • Reviewer: @aschwaighofer

[serialized_for_package] if Package CMO is enabled. The latter kind
allows a function to be serialized even if it contains loadable types,
if Package CMO is enabled. Renamed IsSerialized_t as SerializedKind_t.

The tri-state serialization kind requires validating inlinability
depending on the serialization kinds of callee vs caller; e.g. if the
callee is [serialized_for_package], the caller must be _not_ [serialized].
Renamed `hasValidLinkageForFragileInline` as `canBeInlinedIntoCaller`
that takes in its caller's SerializedKind as an argument. Another argument
`assumeFragileCaller` is also added to ensure that the calle sites of
this function know the caller is serialized unless it's called for SIL
inlining optimization passes.

The [serialized_for_package] attribute is allowed for SIL function, global var,
v-table, and witness-table.

Resolves rdar://128406520
@elsh elsh requested a review from a team as a code owner May 24, 2024 01:36
@elsh elsh changed the title [6.0] [PackageCMO] Support tri-state SerializedKind and their inlinability rule b/t callee/caller. [6.0] [PackageCMO] Support inlinability with [serialized_for_package] May 24, 2024
@elsh elsh added the swift 6.0 label May 24, 2024
@aschwaighofer
Copy link
Contributor

@elsh @nkcsgexi Instead of having multiple PRs up; should there be one PR with all the changes we have so far? might be easier to get through? I think some of the patches might be dependent on each other?

What do you think?

@elsh
Copy link
Contributor Author

elsh commented May 26, 2024

@elsh @nkcsgexi Instead of having multiple PRs up; should there be one PR with all the changes we have so far? might be easier to get through? I think some of the patches might be dependent on each other?

What do you think?

I was thinking the same. Some of the previous PRs contain changes that have gotten reverted due to further updates so it might be easier to squash all or at least into a few and cherry-pick those.

@elsh
Copy link
Contributor Author

elsh commented May 30, 2024

Included in #73993

@elsh elsh closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants