-
Notifications
You must be signed in to change notification settings - Fork 10.5k
ABI: Only store bitwise take-able values inline #16759
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
ABI: Only store bitwise take-able values inline #16759
Conversation
SR-343 rdar://31414907
@swift-ci Please test |
@swift-ci Please test |
Build failed |
Build failed |
Thanks! |
lib/IRGen/GenValueWitness.cpp
Outdated
@@ -1288,6 +1291,10 @@ FixedPacking TypeInfo::getFixedPacking(IRGenModule &IGM) const { | |||
if (!fixedTI) | |||
return FixedPacking::Dynamic; | |||
|
|||
// By convention we don't store bitwise takable values inline. |
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.
Is this comment wrong? We don't store non-bitwise takable values inline right?
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.
Yes. The comment is inverted.
What about resilience, where a value might be bitwise takable in one resilience domain but not in another? |
I'm assuming you can now optimize value witness functions for existentials to memcpy the inline buffer. Is that correct? Also more tests would be nice. In particular I'm worried about resilience here. If two different modules have a different idea of whether a struct is bitwise takable, will we generate invalid code if one module stores a struct into an existential and another one loads from it? |
Determining whether a resilient type can be stored inline in an existential buffer is already a dynamic judgment, since you don't know the size, so we should ask the type metadata the question dynamically. I agree it's worth adding tests for. |
If we access a value resiliently than we also have to accesss bitwise takability/isInline resiliently. I will add some more tests. |
Correct. I can now remove the existential value witness: initializeBufferWithTakeOfBuffer (i.e a move of an existential) and replace it with calls to memcpy. |
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test |
Build failed |
Build failed |
SR-343
rdar://31414907