Skip to content

[SIL][PackageCMO] Fix dispatch thunk linker error and update table serialization #74070

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

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

elsh
Copy link
Contributor

@elsh elsh commented Jun 1, 2024

  • Do not use [serialized_for_package] for witness method before Package CMO.
  • Update v-table and witness-table and their entry serialization; allow non-serialized but visible entries in a serialized table so they can be optimized by other SIL opt passes.
  • Only serialize MethodInst and KeyPathInst if it has the right visibility.

Resolves rdar://129089105&129088935

* Do not use [serialized_for_package] for witness method before Package CMO.
* Update v-table and witness-table and their entry serialization.
  -- Allow non-serialized but visible entries in a serialized table so they
    can be optimized by other SIL opt passes.
* Only serialize MethodInst if it has the right visibility.

Resolves rdar://129089105&129088935
@elsh
Copy link
Contributor Author

elsh commented Jun 1, 2024

@swift-ci test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me.

acknowleding that there will be a future patch that:

  • does not set the serialized attribute for package serialization in SILGen
  • implement a systematic way (refactoring a type and a decl visitor for instructions as @slavapestov has eluded to earlier) to find instructions that block package serialization

this can be done in later PRs

return !method->hasValidLinkageForFragileRef(getRightSerializedKind(M));
});
if (!containsInternal)
wt.setSerializedKind(getRightSerializedKind(M));
Copy link
Contributor

Choose a reason for hiding this comment

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

the logics for serializing v-table and w-table are very much alike. Can we extract a common function to handle both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of these checks might not be necessary but added as a caution as mentioned in the comments; will follow up and remove them if found to be unnecessary.

Update lambda in table serialization.
Add more tests.
@elsh
Copy link
Contributor Author

elsh commented Jun 4, 2024

@swift-ci test

@aschwaighofer
Copy link
Contributor

Does this PR #73902 need to be merged first? It seems this PR would have a dependency on it.

@elsh
Copy link
Contributor Author

elsh commented Jun 4, 2024

Does this PR #73902 need to be merged first? It seems this PR would have a dependency on it.

yup, merged.

@elsh
Copy link
Contributor Author

elsh commented Jun 4, 2024

@swift-ci test

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.

3 participants