-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Relax a SILVerifier assertion for immortal reference types #81614
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
@swift-ci please test |
a78d8ba
to
2b3263f
Compare
@swift-ci please test |
lib/SIL/Verifier/SILVerifier.cpp
Outdated
@@ -1059,7 +1059,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> { | |||
|
|||
auto objectTy = value->getType().unwrapOptionalType(); | |||
|
|||
require(objectTy.isReferenceCounted(F.getModule()), | |||
// C++ foreign reference types are represented as trivially lowered types |
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.
Nit:
// C++ foreign reference types are represented as trivially lowered types | |
// Immortal C++ foreign reference types are represented as trivially lowered types |
(because this isn't true for SWIFT_SHARED_REFERENCE
types, 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.
Good catch! Fixed.
require(objectTy.isReferenceCounted(F.getModule()), | ||
// C++ foreign reference types are represented as trivially lowered types | ||
// since they do not require retain/release calls. | ||
bool isImmortalFRT = objectTy.isForeignReferenceType() && |
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 also true for SWIFT_UNSAFE_REFERENCE
s?
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.
Yeap! From the compiler point of view, they're the same thing, except if strictly safe mode is enabled – both SWIFT_UNSAFE_REFERENCE
and SWIFT_IMMORTAL_REFERENCE
macros expand into retain:immortal
and release:immortal
.
Immortal C++ foreign reference types get TrivialTypeLowering instead of ReferenceTypeLowering, since they do not have retain/release lifetime operations. This was tripping up an assertion in SILVerifier. rdar://147251759 / resolves #80065
2b3263f
to
2e3df1c
Compare
@swift-ci please test |
1 similar comment
@swift-ci please test |
Immortal C++ foreign reference types get TrivialTypeLowering instead of ReferenceTypeLowering, since they do not have retain/release lifetime operations. This was tripping up an assertion in SILVerifier.
rdar://147251759 / resolves #80065