Skip to content

SILGen: Fix generated vtable thunk when a final override is more visible than the base [5.1] #25679

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

Conversation

slavapestov
Copy link
Contributor

Don't re-dispatch to the override's vtable slot if the override
is final; there's no vtable slot and this will result in an
infinite loop.

Fixes rdar://problem/52006394.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 98295375b5a1a8b54e581ba3beb51665ddf5e24a

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 98295375b5a1a8b54e581ba3beb51665ddf5e24a

@tkremenek
Copy link
Member

The test failure looks like a minor difference in expected output:

// CHECK-NEXT: #Base.privateMethod3!1: <T> (Base<T>) -> (Int) -> () : @$s17vtables_multifile12FinalDerivedC14privateMethod3yySiSgFAA4BaseCAD33_63E5F2521A3C787F5F9EFD57FB9237EALLyySiFTV [override] // vtable thunk for Base.privateMethod3(_:) dispatching to FinalDerived.privateMethod3(_:)
               ^
<stdin>:872:2: note: scanning from here
 #Base.privateMethod3!1: <T> (Base<T>) -> (Int) -> () : hidden @$s17vtables_multifile12FinalDerivedC14privateMethod3yySiSgFAA4BaseCAD33_63E5F2521A3C787F5F9EFD57FB9237EALLyySiFTV [override] // vtable thunk for Base.privateMethod3(_:) dispatching to FinalDerived.privateMethod3(_:)

Note the hidden after the <T> (Base<T>) -> (Int) -> () : which is not in the expected output.

…ble than the base

Don't re-dispatch to the override's vtable slot if the override
is final; there's no vtable slot and this will result in an
infinite loop.

Fixes <rdar://problem/52006394>.
@slavapestov slavapestov force-pushed the vtable-thunk-final-bug-5.1 branch from 9829537 to 8544df2 Compare June 23, 2019 00:52
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 98295375b5a1a8b54e581ba3beb51665ddf5e24a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 98295375b5a1a8b54e581ba3beb51665ddf5e24a

@najacque najacque merged commit 733f918 into swiftlang:swift-5.1-branch Jun 23, 2019
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.

4 participants