Skip to content

[WIP] SIL: Don't include convenience initializers in vtables. #19073

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

Conversation

jckarter
Copy link
Contributor

They're never dynamically dispatched (unless required) [in theory], so this entry is never used.

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 95e05be52d44e91b0d43a4040e3aa946e4f8a2cc

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 95e05be52d44e91b0d43a4040e3aa946e4f8a2cc

@slavapestov
Copy link
Contributor

Looks like swiftpm exercises a corner case not in our test suite...

They're never dynamically dispatched (unless `required`), so this entry should never be used.
@jckarter jckarter force-pushed the no-convenience-vtable-entry branch from 95e05be to 81712c7 Compare August 31, 2018 20:32
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 95e05be52d44e91b0d43a4040e3aa946e4f8a2cc

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 95e05be52d44e91b0d43a4040e3aa946e4f8a2cc

// CHECK: @$S32convenience_init_peer_delegation1XCACycfc

// -- no unrequired convenience inits
// CHECK-NOT: @$S32convenience_init_peer_delegation1XC0A0ACyt_tcfC
Copy link
Contributor

Choose a reason for hiding this comment

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

CHECK-NOT feels fragile because if the mangling ever changes slightly, and the vtable entry re-appears, the test won't catch it. How about SILVerifier checks instead that non-required constructors don't show up in the vtable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, would it be safe to do a more general verifier check that SILVTables only include entries visited by the SILVTableVisitor?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, an entry should appear in the vtable iff its visited by the vtable visitor, but you also want the vtable visitor to only visit the right decls...

// Designated and/or required initializers have their initializing
// constructor in the vtable, which can be used by a convenience
// initializer.
if (cd->isDesignatedInit() || cd->isRequired()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition needs to be handled in AbstractFunctionDecl::computeNeedsNewVTableEntry rather than here, or else recovery when decls can't be deserialized won't work.

@jckarter
Copy link
Contributor Author

jckarter commented Sep 5, 2018

Closing this in favor of #19151, which bundles the vtable fix with the changes to use allocating entry points as vtable entries. It ended up being easier to fix both at the same time.

@jckarter jckarter closed this Sep 5, 2018
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