-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix the Effective Access Level of package Declarations #69709
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
swiftc mis-compiles package declarations today because it reports the effective access level of package declarations as less than public. There are a bunch of places in the optimizer that are checking the effective access level against an upper bound of public, so a lot of code winds up internalized or optimized as though it were internal when it definitely is not. Fixes rdar://118081829
Thank you for fixing this, @CodaFi ! |
Could you add a test case that package decls have public symbols? |
Sure thing. I was moving rather quickly - tests will follow shortly. |
Existing tests are rather wonky on my machine. @swift-ci smoke test |
@swift-ci smoke test |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix and adding the tests!
This accidentally started happening when I adjusted getEffectiveAccess to return `Public` for `Package` declarations in swiftlang#69709. As a result, the optimizer thought it had more opportunities to go after declarations that used to be opaque. Unfortunately, this resulted in a miscompile as the devirtualizer was able to look through now-serialized package (static) functions. In one specific instance, the optimizer created direct calls to hidden accessors instead of going through the dispatch thunk.
swiftc mis-compiles package declarations today because it reports the effective access level of package declarations as less than public. There are a bunch of places in the optimizer that are checking the effective access level against an upper bound of public, so a lot of code winds up internalized or optimized as though it were internal when it definitely is not.
Fixes rdar://118081829