-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Distributed] Fix _executeDistributedFunction
resume and result buffer
#40814
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
Since this is a special function, `calleeContext` doesn't point to a direct parent but instead both parent context (uninitialized) and resume function are passed as last arguments which means that `callContext` has to act as an intermediate context in call to accessor.
…utedTarget` `RawPointer?` is lowered into a two arguments since it's a struct, to make it easy let's just allocate an empty pointer for `Void` result.
…ferent result types
@swift-ci please test |
@@ -277,7 +274,7 @@ func _executeDistributedTarget( | |||
on actor: AnyObject, // DistributedActor | |||
_ targetName: UnsafePointer<UInt8>, _ targetNameLength: UInt, | |||
argumentBuffer: Builtin.RawPointer, // HeterogeneousBuffer of arguments | |||
resultBuffer: Builtin.RawPointer? | |||
resultBuffer: Builtin.RawPointer |
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.
Gotcha, noted 👍
callContext->Parent = callerContext; | ||
callContext->ResumeParent = resumeFunc; | ||
|
||
calleeContext->Parent = callContext; |
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 tricky... thanks a lot for digging through!
Build failed |
@swift-ci please test macOS platform |
Looking good, let's merge 👍 I'll send a mini PR for the parameters :) |
swift_distributed_execute_target
resume back to the correct fame.Since
swift_distributed_execute_target
is not a regular async function, it needs to do some extrabookkeeping before accessor could be called.
Drop optionality from result buffer, works fine with
Void
and makes it simpler to implement the accessor.Add some more tests to make sure that different result types are handled correctly.