Skip to content

Serialization: Update -experimental-skip-non-inlinable-function-bodies SIL verification for @_backDeploy #62427

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Dec 7, 2022

SIL verification was failing for modules built with -experimental-skip-non-inlinable-function-bodies and containing functions with @_backDeploy because SILSkippingChecker expected the SILFunction corresponding to the resilient copy of back deployed function to be empty. Since the overall function declaration for a back deployed function is considered inlinable, the body will be typechecked and SIL emitted. However, the checker should expect to see two SILFunctions corresponding to each back deployed function: one for the client fallback copy (which passes the existing F.isSerialized() check) and a second representing the resilient copy of the function, which is not serialized. A specific exception is needed for that second function.

…es` SIL verification for `@_backDeploy`.

SIL verification was failing for modules containing functions with `@_backDeploy` because `SILSkippingChecker` expected the `SILFunction` corresponding to the resilient copy of back deployed function to be empty. Since the overall function declaration for a back deployed function is considered inlinable, the body will be typechecked and SILGen emits both the fallback copy of the function and the resilient copy of the function. The checker should therefore expect to see back deployed functions that are not marked as serialized.
@tshortli
Copy link
Contributor Author

tshortli commented Dec 7, 2022

@swift-ci please test

// second resilient SILFunction is also emitted for back deployed functions.
// Since the body of the function as written was not skipped, it's expected
// that we see the SILFunction for the resilient copy here.
if (func->isBackDeployed())
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems a little bit odd for me that we need to check BackDeployed specifically here but not for other attributes like @_alwaysEmitIntoClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@_backDeployed is special for the reasons described in the comment and in the PR description. Maybe there's a way I can describe this in a clearer way. @inlinable, AEIC, @_transparent are all handled by the if (F.isSerialized()) check at the top of this function. @_backDeployed causes two SILFunctions to be emitted. One of them passes the if (F.isSerialized()) check. The other (representing the resilient copy of the function) is the one we need to handle here.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, makes sense. Thank you for the clarification!

@tshortli tshortli merged commit 67cbe90 into swiftlang:main Dec 7, 2022
@tshortli tshortli deleted the back-deployed-attr-skip-noninlinable-function-bodies branch December 7, 2022 17:24
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