Skip to content

Method descriptors #19067

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 6 commits into from
Aug 31, 2018
Merged

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Aug 30, 2018

Nominal type descriptors for protocols and classes contain an array of method descriptors. This PR defines symbols pointing at these descriptors, allowing them to be referenced from outside the module.

Method descriptors will be used in two places:

  • Resilient witness tables. Previously resilient witness tables used protocol dispatch thunks as keys, but this is problematic because we don't want to rely on function pointer identity.

  • Resilient method overrides. Here again we don't want to use dispatch thunks as keys; classes have the additional issue that resilient overrides are sometimes needed for methods that don't have dispatch thunks.

@slavapestov slavapestov changed the title Method descriptors [WIP] Method descriptors Aug 31, 2018
@slavapestov slavapestov requested a review from rjmccall August 31, 2018 04:10
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

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

One minor style comment, but otherwise good.

@@ -1207,12 +1218,14 @@ namespace {

SILVTable *VTable = nullptr;
unsigned VTableSize = 0;
bool isResilient;
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalized, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

When we define type metadata, the 'full' symbol points at the
entire struct, whereas the 'address point' symbol points at an
offset inside.

The logic for setting this up is a bit tricky because the
'address point' symbol may have been forward declared, and
has to be replaced.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

2 similar comments
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 123d27d into swiftlang:master Aug 31, 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.

2 participants