-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Implement stack probing using helpers #27184
Implement stack probing using helpers #27184
Conversation
…src/jit/codegenarm.cpp src/jit/codegencommon.cpp src/jit/compiler.h src/jit/target.h
This PR is ready for review. I collected the stack traces for the following test cases:
On win-arm the stack traces looks as I would expect them to be: win-arm - windbg - case 1:
win-arm - windbg - case 2:
On linux-arm in case 2 for some reason the debugger can not unwind beyond linux-arm - lldb - case 1:
linux-arm - lldb - case 2:
I also fixed the helpers as Jan suggested above so they would probe at the bottom of the pages (i.e. at addresses |
/azp run coreclr-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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, thank you!
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 with a few comment notes.
This partially addresses https://github.com/dotnet/coreclr/issues/26996
CodeGen::genAllocLclFrame
into Arm32 and Arm64 specific functionsImplementation of stack probing via helpers on Arm64 is complicated...
It is related to how we establish frame pointer in a function prolog and the fact that stack probing currently happens before
lr
is saved on stack.The latter means that we can not call any function until that moment - every call will previous value of
lr
.We also can not defer the stack probing until after we save the frame record (i.e.
fp
,lr
pair) on stack - some types of stack frames store the frame record at the lowest address on the stack.I tried to consider ways of calling the helper without advancing
sp
:bl
withb
). This requires computing return address manually and passing it to the helper. It seems we can't do this in JIT right now (at least I could not find a way to emit INS_adr and specify PCRelOffset). This approach would probably confuse unwinder when SO happens.lr
in red zone before call to the helper and restore original value oflr
inside the helper. It is not going to work - unwind codes on Arm64 doesn't support negative offsets.lr
into another register - not supported by unwind codes.The only choice I have left is to store
lr
on the stack, adjustsp
, call to the helper and restorelr
andsp
after the call (or in the helper).@dotnet/jit-contrib @janvorli I would value your feedback on the proposal. For now I would like to merge Arm32 stack probing logic only.