Skip to content

Commit e912cc5

Browse files
committed
uniform ARM64's OSR offset to LA64/RV64.
1 parent 8fe1a21 commit e912cc5

File tree

3 files changed

+4
-46
lines changed

3 files changed

+4
-46
lines changed

src/coreclr/jit/codegencommon.cpp

+1-33
Original file line numberDiff line numberDiff line change
@@ -4086,39 +4086,7 @@ void CodeGen::genEnregisterOSRArgsAndLocals()
40864086

40874087
GetEmitter()->emitIns_R_AR(ins_Load(lclTyp), size, varDsc->GetRegNum(), genFramePointerReg(), offset);
40884088

4089-
#elif defined(TARGET_ARM64)
4090-
4091-
// Patchpoint offset is from top of Tier0 frame
4092-
//
4093-
// We need to determine the frame-pointer relative
4094-
// offset for this variable in the osr frame.
4095-
//
4096-
// First add the Tier0 frame size
4097-
//
4098-
const int tier0FrameSize = compiler->info.compPatchpointInfo->TotalFrameSize();
4099-
4100-
// then add the OSR frame size
4101-
//
4102-
const int osrFrameSize = genTotalFrameSize();
4103-
4104-
// then subtract OSR SP-FP delta
4105-
//
4106-
const int osrSpToFpDelta = genSPtoFPdelta();
4107-
4108-
// | => tier0 top of frame relative
4109-
// | + => tier0 bottom of frame relative
4110-
// | | + => osr bottom of frame (sp) relative
4111-
// | | | - => osr fp relative
4112-
// | | | |
4113-
const int offset = stkOffs + tier0FrameSize + osrFrameSize - osrSpToFpDelta;
4114-
4115-
JITDUMP("---OSR--- V%02u (reg) Tier0 virtual offset %d OSR frame size %d OSR sp-fp "
4116-
"delta %d total offset %d (0x%x)\n",
4117-
varNum, stkOffs, osrFrameSize, osrSpToFpDelta, offset, offset);
4118-
4119-
genInstrWithConstant(ins_Load(lclTyp), size, varDsc->GetRegNum(), genFramePointerReg(), offset, initReg);
4120-
*pInitRegZeroed = false;
4121-
#elif defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)
4089+
#elif defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) || defined(TARGET_ARM64)
41224090

41234091
// Patchpoint offset is from top of Tier0 frame
41244092
//

src/coreclr/jit/compiler.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -5834,13 +5834,7 @@ void Compiler::generatePatchpointInfo()
58345834
//
58355835
const int totalFrameSize = codeGen->genTotalFrameSize() + TARGET_POINTER_SIZE;
58365836
const int offsetAdjust = 0;
5837-
#elif defined(TARGET_ARM64)
5838-
// SP is not manipulated by calls so no frame size adjustment needed.
5839-
// Local Offsets may need adjusting, if FP is at bottom of frame.
5840-
//
5841-
const int totalFrameSize = codeGen->genTotalFrameSize();
5842-
const int offsetAdjust = codeGen->genSPtoFPdelta() - totalFrameSize;
5843-
#elif defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)
5837+
#elif defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) || defined(TARGET_ARM64)
58445838
// SP is not manipulated by calls so no frame size adjustment needed.
58455839
// Local Offsets are adjusted which relative to SP.
58465840
//

src/coreclr/jit/lclvars.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -5709,12 +5709,12 @@ void Compiler::lvaFixVirtualFrameOffsets()
57095709

57105710
if (opts.IsOSR())
57115711
{
5712-
#if defined(TARGET_AMD64) || defined(TARGET_ARM64)
5712+
#if defined(TARGET_AMD64)
57135713
// Stack offset includes Tier0 frame.
57145714
//
57155715
JITDUMP("--- delta bump %d for OSR + Tier0 frame\n", info.compPatchpointInfo->TotalFrameSize());
57165716
delta += info.compPatchpointInfo->TotalFrameSize();
5717-
#endif // TARGET_AMD64 || TARGET_ARM64
5717+
#endif // TARGET_AMD64
57185718
}
57195719

57205720
JITDUMP("--- virtual stack offset to actual stack offset delta is %d\n", delta);
@@ -6565,20 +6565,16 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
65656565
{
65666566
lvaTable[lvaRetAddrVar].SetStackOffset(stkOffs);
65676567
}
6568-
#endif
65696568

65706569
// If we are an OSR method, we "inherit" the frame of the original method
65716570
//
65726571
if (opts.IsOSR())
65736572
{
6574-
#if !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
65756573
originalFrameSize = info.compPatchpointInfo->TotalFrameSize();
65766574
originalFrameStkOffs = stkOffs;
65776575
stkOffs -= originalFrameSize;
6578-
#endif
65796576
}
65806577

6581-
#ifdef TARGET_XARCH
65826578
// TODO-AMD64-CQ: for X64 eventually this should be pushed with all the other
65836579
// calleeregs. When you fix this, you'll also need to fix
65846580
// the assert at the bottom of this method

0 commit comments

Comments
 (0)