Uh oh!
There was an error while loading. Please reload this page.
Adjust the calleeSavedRegs on top frame for LoongArch64/RISCV64 - #100962
Conversation
6ec45e3 to
855fdb3Comparef94cc0d to
cf69c78Comparecf69c78 to
8601cfcCompareshushanhf
commented
Apr 16, 2024
@jakobbotsch@clamp03 |
clamp03
commented
Apr 16, 2024
@bartlomiejko Can you review and test this PR? |
jakobbotsch
commented
Apr 16, 2024
How is the stack frame layout changed compared to previously? What was the layout before this change? Why didn't it support GS cookie? |
Only changed the calledSavedRegs, especially the FP/RA for LA64/RV64. The layout liking this PR's first comment description #100962 (comment) .
Before this PR, the FP/RA at bottom of frame which under the GSCookie, the FP/RA can be overwritten. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jakobbotsch
commented
Apr 16, 2024
Where does FP point to in your picture? Where did it point to before? |
shushanhf
commented
Apr 16, 2024
The new FP is pointing to the the old FP saved slot.
|
jakobbotsch
commented
Apr 16, 2024
Before this change, the comment in codegenloongarch64.cpp gives the following layout: The GS cookie exists between the locals and FP/RA pair. I do not see how FP/RA can be overwritten without hitting the GS cookie. Was the comment wrong? Do you mean that the FP/RA of caller's frame can be overwritten? |
jakobbotsch
commented
Apr 16, 2024
If I understand correctly, the change here means you have to use negative offsets from FP to access locals more often. Does LA64/RV64 allow encoding as many negative offsets as it allows positive offsets? |
The GS Cookie is only used liking the localalloc. After finished the frame allocation, when using the localalloc to allocate a new stack space, the new space maybe overwritten the new real size allocated while the GSCookie is used to recognize this case. |
shushanhf
commented
Apr 16, 2024
yes |
8601cfc to
23fc354Compareb78f2e0 to
c237762Compareshushanhf
commented
Apr 19, 2024
I think the CI went wrong. e.g. but format-patch is empty. |
c237762 to
feaa635Comparejakobbotsch
commented
Apr 19, 2024
You can run jit-format locally, see the docs at https://github.com/dotnet/jitutils and https://github.com/dotnet/jitutils/blob/main/doc/formatting.md. |
am11
commented
Apr 19, 2024
The underlying error shows up on Windows leg:
started happening after #100650 merge. cc @lambdageek |
jakobbotsch
left a comment
There was a problem hiding this comment.
This change looks good to me now. Thanks for addressing all the feedback! I will give RISC-V folks some time to review as well.
feaa635 to
3092323CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
to support the GSCookie. The frame layout: | | |-----------------------| | incoming arguments | +=======================+ <---- Caller's SP | Varargs regs space | // Only for varargs main functions; not used for LA64. |-----------------------| | MonitorAcquired | // 8 bytes; for synchronized methods |-----------------------| | PSP slot | // 8 bytes (omitted in NativeAOT ABI) |-----------------------| |Callee saved registers | // multiple of 8 bytes, not includting FP/RA |-----------------------| | Saved RA | // 8 bytes |-----------------------| | Saved FP | // 8 bytes |-----------------------| | possible GS cookie | |-----------------------| | locals, temps, etc. | |-----------------------| | possible GS cookie | |-----------------------| | Outgoing arg space | // multiple of 8 bytes; if required (i.e., #outsz != 0) |-----------------------| <---- Ambient SP | | | ~ | Stack grows ~ | | downward |
3092323 to
e254dd6Comparejakobbotsch
commented
Apr 22, 2024
@shushanhf Can you please avoid amending/force pushing to PRs? It makes it hard for us to see exactly what changed and to review the new changes. If you can push them as new commits that makes it much easier. We squash every PR on merge, so the history will be cleaned up anyway. |
rzsc
commented
Apr 22, 2024
PR tested on |
Ok, thanks, I will.
Sorry, I didn't know this. |
jakobbotsch
commented
Apr 23, 2024
Thanks for helping me understand the motivation for the change, and for making LA64/RV64 more similar to ARM64 around OSR. |
jakobbotsch
commented
Apr 23, 2024
@BruceForstall If you have any feedback around this then please feel free to leave it. To sum up the motivation of the change you can see #100962 (comment). |
…et#100962) The frame layout: | | |-----------------------| | incoming arguments | +=======================+ <---- Caller's SP | Varargs regs space | // Only for varargs main functions; not used for LA64. |-----------------------| | MonitorAcquired | // 8 bytes; for synchronized methods |-----------------------| | PSP slot | // 8 bytes (omitted in NativeAOT ABI) |-----------------------| |Callee saved registers | // multiple of 8 bytes, not includting FP/RA |-----------------------| | Saved RA | // 8 bytes |-----------------------| | Saved FP | // 8 bytes |-----------------------| | possible GS cookie | |-----------------------| | locals, temps, etc. | |-----------------------| | possible GS cookie | |-----------------------| | Outgoing arg space | // multiple of 8 bytes; if required (i.e., #outsz != 0) |-----------------------| <---- Ambient SP | | | ~ | Stack grows ~ | | downward |
…et#100962) The frame layout: | | |-----------------------| | incoming arguments | +=======================+ <---- Caller's SP | Varargs regs space | // Only for varargs main functions; not used for LA64. |-----------------------| | MonitorAcquired | // 8 bytes; for synchronized methods |-----------------------| | PSP slot | // 8 bytes (omitted in NativeAOT ABI) |-----------------------| |Callee saved registers | // multiple of 8 bytes, not includting FP/RA |-----------------------| | Saved RA | // 8 bytes |-----------------------| | Saved FP | // 8 bytes |-----------------------| | possible GS cookie | |-----------------------| | locals, temps, etc. | |-----------------------| | possible GS cookie | |-----------------------| | Outgoing arg space | // multiple of 8 bytes; if required (i.e., #outsz != 0) |-----------------------| <---- Ambient SP | | | ~ | Stack grows ~ | | downward |
Adjust the calleeSavedRegs on top frame for LoongArch64/RISCV64 to support the GSCookie.