Skip to content

Class metadata fix for Windows [5.0, ABI] #20790

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

slavapestov
Copy link
Contributor

On Windows we can't reference the runtime's Builtin.NativeObject value witness table directly from class metadata. Instead fill it in at runtime for singleton metadata initialization.

Do this on all platforms, even though its not needed on Linux or Darwin, for simplicity. A subsequent Windows-specific change will force the use of singleton metadata initialization for all classes, even when the class is otherwise fixed.

This reverts commit b3a50ea9fdd6fb8cb0cbcba059dcb5b8029db7c4.
IRGen always just emits a simple implementation that immediately
calls swift_relocateClassMetadata(); so allow the function to be
null in this case to save on code size.
…ton metadata initialization

On Windows the image format does not support cross-image absolute
data symbol references. One case where we emit these is in class
metadata, because the value witness table always points at the
value witness table for Builtin.NativeObject, defined in the
runtime.

Instead, fill in the value witness table at runtime when doing
singleton metadata initialization.

Another change that will come later is to force use of singleton
metadata initialization on Windows, even if the class is otherwise
completely fixed.
@slavapestov slavapestov changed the base branch from master to swift-5.0-branch November 27, 2018 04:26
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov requested a review from a team November 27, 2018 04:27
@AnnaZaks
Copy link
Contributor

Convergence: no; ABI impact: yes

@slavapestov slavapestov changed the title Class metadata fix for Windows [5.0] Class metadata fix for Windows [5.0, ABI] Nov 27, 2018
@AnnaZaks
Copy link
Contributor

I am merging this as it's a low risk ABI change.

@AnnaZaks AnnaZaks merged commit 1ae6946 into swiftlang:swift-5.0-branch Nov 29, 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