Uh oh!
There was an error while loading. Please reload this page.
[clr-interp] Use struct parameter for InvokeUnmanagedCalliWithTransition - #127543
[clr-interp] Use struct parameter for InvokeUnmanagedCalliWithTransition#127543clamp03 wants to merge 4 commits into
Conversation
On ARM32, bundling arguments in a struct forces register passing, ensuring the SP value saved by SAVE_THE_LOWEST_SP matches what stack walking reports.
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg |
am11
commented
Apr 29, 2026
@clamp03, if you get a chance, could you also run interpreter tests on riscv64? If something fails, please file an issue with build and test commands. I will take from there (I was struggling to figure out commands with --bootstrap earlier but code was ported to riscv64 to the extent that 'it just compiles' 😅) |
clamp03
commented
Apr 29, 2026
@am11 Okay, I'll check the interpreter tests on riscv64 after May 5th, as we have a holiday until then. Since I don't have an available riscv64 device now, I'll run the tests using QEMU. Thanks! |
clamp03
commented
May 6, 2026
@BrzVlad@davidwrighton@janvorli Could you please review this PR? Thank you. |
BrzVlad
commented
May 6, 2026
This seems fragile. Wouldn't it be better to save the FP instead and identify the native frame by this, given this wouldn't change and we wouldn't have to bother with updating every time sp changes ? @janvorli ? |
janvorli
commented
May 6, 2026
@BrzVlad we did that already for other cases, so this just adds another one. I agree it is ugly. Looking again at where we use the saved SP in the current state, there is one place where we pass it into a call that ends up ignoring it (which wasn't the case when we have decided to use this way of mitigating the SP issue) and then the only remaining one is the ResumeAfterCatch. It seems that one can be modified to use FP as you suggested since we compile with So it seems we can move to using FP instead and get rid of this passing via structs. |
janvorli
commented
May 6, 2026
jkotas
commented
May 7, 2026
That's fragile in a different way. |
janvorli
commented
May 7, 2026
@jkotas on Windows, you are right. We can keep using the SP. On Unix, it seems that it is required for the compiler to not to reuse FP for anything else when However, yesterday I have resumed work on changing the ResumeAfterCatch to get rid of the explicit native frames unwinding and using C++ exception like we do on WASM. That would remove the need for storing the SP or FP completely. |
jakobbotsch
commented
Jun 1, 2026
What is the status here? Did you land the change mentioned above @janvorli? |
janvorli
commented
Jun 1, 2026
@jakobbotsch the change is in PR #128728, I am still fixing some issues with it. |
clamp03
commented
Jun 2, 2026
I will close this PR once PR #128728 is merged. |
janvorli
commented
Jun 9, 2026
@clamp03 I've just merged my PR in. |
janvorli
commented
Jun 9, 2026
Thank you @clamp03! |
On ARM32, bundling arguments in a struct forces register passing, ensuring the SP value saved by SAVE_THE_LOWEST_SP matches what stack walking reports.