Skip to content

IRGen: lazy initialize ForeignClassMetadata #22857

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 1 commit into from
Mar 8, 2019

Conversation

compnerd
Copy link
Member

This is needed for Windows which does not support cross-module data
references without indirection. By lazy initializing the data, we can
indirect through the IAT for the data pointer and fill in the parent
pointer.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

CC: @slavapestov

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

This needs tests.

@compnerd compnerd force-pushed the foreign-imports branch 2 times, most recently from 475dc39 to a655b1c Compare February 27, 2019 17:06
@compnerd
Copy link
Member Author

CC: @mikeash

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.

I think we could reasonably have the constructor for ForeignMetadataCacheEntry set the VWT if it's currently null. We should not try to initialize this in the completion function; I'm pretty sure the runtime assumes that the VWT will be set to something after allocation.

@jckarter
Copy link
Contributor

jckarter commented Mar 1, 2019

My concern with that would be that not every foreign metadata is a CF class. It feels brittle to me to assume that, if no VWT is set, the one for foreign classes is always the best one to fill in.

@compnerd
Copy link
Member Author

compnerd commented Mar 2, 2019

@rjmccall I did try to do that, but, it is currently marked as rdata, and Im trying to track down why that is. @jckarter - hmm, we could use the VWT entry itself for storage to figure out if we should overwrite it. I imagine that no OS that we care about ATM would use anything in the first page, so that gives us a good range to play with.

@jckarter
Copy link
Contributor

jckarter commented Mar 2, 2019

Hm, maybe it's fine if we check that the type context descriptor describes a class, and set the VWT during foreign metadata setup if it is.

@compnerd compnerd force-pushed the foreign-imports branch 2 times, most recently from 40f4b68 to 1a646cc Compare March 3, 2019 18:31
@compnerd
Copy link
Member Author

compnerd commented Mar 3, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 3, 2019

Build failed
Swift Test Linux Platform
Git Sha - a655b1cf59c8414b5c6d10ce1ac0add4e145a3f0

@swift-ci
Copy link
Contributor

swift-ci commented Mar 3, 2019

Build failed
Swift Test OS X Platform
Git Sha - a655b1cf59c8414b5c6d10ce1ac0add4e145a3f0

@compnerd
Copy link
Member Author

compnerd commented Mar 4, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 4, 2019

Build failed
Swift Test Linux Platform
Git Sha - 1a646ccf7e1cfae620334ebf181873ebb59d61fa

@swift-ci
Copy link
Contributor

swift-ci commented Mar 4, 2019

Build failed
Swift Test OS X Platform
Git Sha - 1a646ccf7e1cfae620334ebf181873ebb59d61fa

@compnerd
Copy link
Member Author

compnerd commented Mar 4, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 4, 2019

Build failed
Swift Test OS X Platform
Git Sha - 116755522cef735caa83d1416c8988501c08279d

@swift-ci
Copy link
Contributor

swift-ci commented Mar 4, 2019

Build failed
Swift Test Linux Platform
Git Sha - 116755522cef735caa83d1416c8988501c08279d

@compnerd compnerd force-pushed the foreign-imports branch 2 times, most recently from d536b71 to 8fff736 Compare March 5, 2019 16:52
@compnerd
Copy link
Member Author

compnerd commented Mar 6, 2019

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Mar 6, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - aef7b94a681a94457ec72d24b808cd983a33990e

@compnerd
Copy link
Member Author

compnerd commented Mar 6, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 6, 2019

Build failed
Swift Test OS X Platform
Git Sha - aef7b94a681a94457ec72d24b808cd983a33990e

@swift-ci
Copy link
Contributor

swift-ci commented Mar 7, 2019

Build failed
Swift Test Linux Platform
Git Sha - 0c700ebdb1fdc9392fd5407fac4c73be7648ec76

@compnerd
Copy link
Member Author

compnerd commented Mar 7, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Mar 7, 2019

Build failed
Swift Test OS X Platform
Git Sha - 0c700ebdb1fdc9392fd5407fac4c73be7648ec76

@compnerd
Copy link
Member Author

compnerd commented Mar 7, 2019

@swift-ci please test macOS platform

@ghost
Copy link

ghost commented Mar 7, 2019

https://bugs.swift.org/browse/SR-NNNN is a 404

@compnerd
Copy link
Member Author

compnerd commented Mar 7, 2019

@rjmccall, @jckarter, @slavapestov - okay, so then this is good to merge? I will try to create a test case for the root protocol conformance, and then come back around to the SwiftRuntime work.

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.

Just a bunch of comment requests, but otherwise this LGTM.

This is needed for Windows which does not support cross-module data
references without indirection.  By lazy initializing the data, we can
indirect through the IAT for the data pointer and fill in the parent
pointer.
@compnerd
Copy link
Member Author

compnerd commented Mar 8, 2019

@swift-ci please test and merge

@swift-ci
Copy link
Contributor

swift-ci commented Mar 8, 2019

Build failed
Swift Test OS X Platform
Git Sha - 0c700ebdb1fdc9392fd5407fac4c73be7648ec76

@compnerd
Copy link
Member Author

compnerd commented Mar 8, 2019

@swift-ci please test macOS platform

@compnerd compnerd merged commit d4757d4 into swiftlang:master Mar 8, 2019
@compnerd compnerd deleted the foreign-imports branch March 8, 2019 05:34
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.

5 participants