-
Notifications
You must be signed in to change notification settings - Fork 800
[Stack Switching] Fix resuming of return calls #7860
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
test/lit/exec/cont_return_call.wast
Outdated
(return_call $sub) | ||
) |
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.
It might be worth adding another log after the return_call to test that it is never reached. It also might be worth adding a resume in the original function as well.
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.
Done.
test/lit/exec/cont_return_call.wast
Outdated
(call $log (i32.const 300)) | ||
(i32.const 0) |
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.
It might be worth having the tail-callee tail call yet another function that suspends to show that it works for more than one tail callee.
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.
Sure, done.
Co-authored-by: Thomas Lively <tlively123@gmail.com>
Co-authored-by: Thomas Lively <tlively123@gmail.com>
;; CHECK-NEXT: [LoggingExternalInterface logging 100] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 200] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 300] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 400] | ||
;; CHECK-NEXT: [LoggingExternalInterface logging 500] |
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.
Let's add logging to the main function to show that the suspends actually happen as well.
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.
Added.
A return call is a form of control flow, so we need to handle it. Specifically,
the original function is unwound before calling the next one, so when we
resume, we should just call the next one. To do that, save the call target
along with the locals during unwinding.