-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix tailcall regression with compiled F# #41206
Conversation
@AndyAyersMS Is it possible to trigger the tailcall stress runs from the CI? |
Yes, it is one of the variations in runtime-coreclr jitstress. |
Nice! And a negative line diff. You can take |
@jkotas Once #41059 is merged, it would be good to rebase this one and run runtime-coreclr jitstress and runtime-coreclr libraries-jitstress on top of that change. #41059 forces all tail calls under tailcallstress to be helper-based calls. I'm just waiting for someone to review a test change in |
7c00593
to
3425dc3
Compare
@dotnet/jit-contrib This is blocked on #41059. Ready for review otherwise. |
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.
LGTM. Nice to see the optimizations also, that should remove a function call from the hot path.
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.
Changes LGTM.
Should we also make updates to the design doc?
I have read the design doc and I believe everything in the doc is still accurate. I like that the design doc is focused on the concept and it does not go into explaining every detail. Let me know if there is a specific fact that you would like to see captured. |
This change skips instantiating stubs for direct tailcalls and instead passes the inst argument directly to the target method. Fixes dotnet#40864
pCode->EmitCALL(METHOD__STUBHELPERS__NEXT_CALL_RETURN_ADDRESS, 0, 1); | ||
// All arguments are loaded on the stack, it is safe to disable the GC reporting of ArgBuffer now. | ||
// This is optimization to avoid extending argument lifetime unnecessarily. | ||
// We still need to report the inst argument of shared generic code to prevent it from being unloaded. The inst |
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.
FYI: I have noticed that nothing guarantees that the tailcall target function pointer is kept alive and thus it may be unloaded. It would be a very corner-case situation that is unlikely to be ever hit in a real-world. I have opened #41314 on it.
@jkotas I recommend also running runtime-coreclr libraries-jitstress. |
The test failure is #40916. libraries-jitstress and jitstress optional runs passed. |
/backport to release/5.0 |
Started backporting to release/5.0: https://github.com/dotnet/runtime/actions/runs/223822150 |
Fixes #40864