-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Preliminary SILGen support for address-only typed throws #69430
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
Preliminary SILGen support for address-only typed throws #69430
Conversation
@swift-ci Please smoke test |
AbstractionPattern::getErrorConvention(TypeConverter &TC) const { | ||
// Tuples should be destructured. | ||
if (isTuple()) { | ||
return Destructured; |
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.
We ban tuple types from being thrown up in the type checker now, and even if we allowed them there... I think we'd still pass them indirectly here, 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, I’ll remove this. It was just a copy and paste
@@ -713,6 +713,15 @@ bool SILModuleConventions::isPassedIndirectlyInSIL(SILType type, SILModule &M) { | |||
return false; | |||
} | |||
|
|||
bool SILModuleConventions::isThrownIndirectlyInSIL(SILType type, SILModule &M) { | |||
if (SILModuleConventions(M).loweredAddresses) { |
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.
if (SILModuleConventions(M).loweredAddresses) { | |
if (SILModuleConventions(M).useLoweredAddresses()) { |
52d69a9
to
581776b
Compare
@swift-ci Please smoke test |
If the thrown error type is address-only, our function type has an indirect error result. Handle this in type lowering and SILGen prolog/epilog emission.
Next steps are introducing a zero-operand
throw_addr
instruction to exit out of a block after initializing the thrown error result, and setting up a stack-allocated box to receive the indirect error result from a try_apply, all the conversions and re-abstraction support, etc.