-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[mono] Fix SwiftError
variable offset calculation
#103043
[mono] Fix SwiftError
variable offset calculation
#103043
Conversation
/azp run runtime-extra-platforms |
Tagging subscribers to this area: @lambdageek, @steveisok |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
@matouskozak @jkurdek Please take a look at these changes. |
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 changes LGTM! and overall the code looks much cleaner to me know.
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.
Looks good to me!
Description
This PR attempts to fix CryptoKit test failure encountered in #102583. The current approach always allocates a local var for
SwiftSelf
and doesn't set correct offset when the argument is passed via the stack to the wrapper.The idea is to allocate a new stack var for
SwiftError
only when it is passed to the wrapper via regs. IfSwiftError
is passed to the wrapper via the stack, the existing stack var could be used, instead of a local variable.In the wrapper prologue, if
SwiftError
is passed to the wrapper via regs, its value should be preserved in a local variable.This is determined by checking
ainfo->offset
which is set inget_call_info
. On amd64, ifSwiftError
is passed via regs,inreg
is set toFALSE
and is handled in the common block for all reg arguments. Reverse pinvoke wrappers should always allocate the local variable, as the pinvoke flag inget_call_info
is1
, whereas for direct pinvoke, it is0
.Validation
These changes should be verified using the
Interop/Swift
runtime tests and theSecurity.Cryptography
library tests.