Skip to content

Fix register conflict between freeing large stack frames and fast tailcalls on arm32 - #66588

Merged
jakobbotsch merged 4 commits into
dotnet:mainfrom
jakobbotsch:fix-free-large-lcl-frames-tailcalls-arm32
Mar 15, 2022
Merged

jakobbotsch merged 4 commits into
dotnet:mainfrom
jakobbotsch:fix-free-large-lcl-frames-tailcalls-arm32

Conversation

@jakobbotsch

@jakobbotsch jakobbotsch commented Mar 14, 2022 •

Copy link
Copy Markdown
Member

Freeing large stack frames on ARM32 requires a helper register, so it is natural to use r12 which is the only volatile non-argument register available. However this register is used for fast tailcalls as well resulting in a conflict.
Since we always spill lr and it will be restored after this point in the epilog we can use lr instead to free up the conflict. It already seems lr is the primary register used as a scratch register in codegen.

This did not repro in our own test runs but I found it in a Fuzzlyn test run.

Fix #66585

cc @dotnet/jit-contrib @clamp03 PTAL @BruceForstall

@ghost ghost assigned jakobbotsch Mar 14, 2022
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 14, 2022
@ghost

ghost commented Mar 14, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

Freeing large stack frames on ARM32 requires a helper register, so it is natural to use r12 which is the only volatile non-argument register available. However this register is used for fast tailcalls as well resulting in a conflict.
Since we always spill lr and it will be restored after this point in the epilog we can use lr instead to free up the conflict. It already seems lr is the primary register used as a scratch register in codegen.

This did not repro in our own test runs but I found it in a Fuzzlyn test run.

cc @dotnet/jit-contrib @clamp03 PTAL @BruceForstall

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch changed the title Fix free large lcl frames tailcalls arm32 Fix register conflict between freeing large stack frames and fast tailcalls on arm32 Mar 14, 2022

@BruceForstall BruceForstall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a test!

@jakobbotsch
jakobbotsch merged commit 3eea15a into dotnet:main Mar 15, 2022
@jakobbotsch
jakobbotsch deleted the fix-free-large-lcl-frames-tailcalls-arm32 branch March 15, 2022 20:40
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Mar 30, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARM32 register conflict for large stack frames and tailcalls

3 participants