-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Perform fragile layout for stored properties in classes #15720
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
Perform fragile layout for stored properties in classes #15720
Conversation
aeda303
to
a0a5d5c
Compare
@swift-ci Please test source compatibility |
1 similar comment
@swift-ci Please test source compatibility |
Sigh... this hack might not work out in practice. |
a0a5d5c
to
720134d
Compare
@swift-ci Please test source compatibility |
1 similar comment
@swift-ci Please test source compatibility |
720134d
to
b33cba3
Compare
@swift-ci Please test source compatibility |
1 similar comment
@swift-ci Please test source compatibility |
This allows us to perform fragile layout of resilient fields without completely disabling value type resilience.
Fixes <rdar://problem/38506059>.
b33cba3
to
852ee8d
Compare
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
Build failed |
852ee8d
to
d751dcc
Compare
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
Build failed |
Build failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an IRGen expert, but it looks good to me (well, as good as possible for this kind of workaround), and ready to go for the 4.2 branch. Glad the field access thing wasn't too bad.
@@ -245,6 +249,10 @@ namespace { | |||
} | |||
|
|||
if (superclass->hasClangNode()) { | |||
// Perform fragile layout if the class has @objc ancestry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment's out of date since we ended up deciding not to conditionalize on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is still valid. Note that we only set CompletelyFragileLayout if the superclass has a Clang node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. That's not sufficient; you could be the grandchild of an imported class. I'm…sorry for not catching that sooner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine. We walk all superclasses up to the root here.
TC.pushCompletelyFragile(); | ||
} | ||
|
||
CompletelyFragileScope(IRGenModule &IGM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: can you make these constructors explicit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I usually remember to do that. I'll make a follow up patch.
Fixes rdar://problem/38506059 and https://bugs.swift.org/browse/SR-7206.