Skip to content

Commit 68831a7

Browse files
committed
amend the code format for LoongArch64.
1 parent 9f0fb4c commit 68831a7

File tree

1 file changed

+27
-59
lines changed

1 file changed

+27
-59
lines changed

src/coreclr/jit/lclvars.cpp

+27-59
Original file line numberDiff line numberDiff line change
@@ -6162,8 +6162,27 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
61626162
}
61636163
#elif defined(TARGET_LOONGARCH64)
61646164

6165+
int PSP_MonAcquire_Size = 0;
61656166
assert(compCalleeRegsPushed >= 2);
61666167
stkOffs = (compCalleeRegsPushed << 3);
6168+
if (lvaMonAcquired != BAD_VAR_NUM)
6169+
{
6170+
originalFrameStkOffs += lvaLclSize(lvaMonAcquired);
6171+
if (!opts.IsOSR())
6172+
{
6173+
PSP_MonAcquire_Size = lvaLclSize(lvaMonAcquired);
6174+
stkOffs += lvaLclSize(lvaMonAcquired);
6175+
}
6176+
}
6177+
6178+
#if FEATURE_EH_FUNCLETS
6179+
if (lvaPSPSym != BAD_VAR_NUM)
6180+
{
6181+
PSP_MonAcquire_Size += TARGET_POINTER_SIZE;
6182+
originalFrameStkOffs += TARGET_POINTER_SIZE;
6183+
stkOffs += TARGET_POINTER_SIZE;
6184+
}
6185+
#endif
61676186

61686187
#elif defined(TARGET_RISCV64)
61696188

@@ -6266,59 +6285,6 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
62666285
}
62676286
#endif // TARGET_AMD64
62686287

6269-
#if defined(TARGET_LOONGARCH64)
6270-
// For LoongArch64, after the `lvaAssignVirtualFrameOffsetsToLocals`, there is no need
6271-
// to recompute the LclVarDsc's StackOffset within the `lvaFixVirtualFrameOffsets`.
6272-
assert(codeGen->isFramePointerUsed());
6273-
int PSP_MonAcquire_Size = 0;
6274-
#if FEATURE_EH_FUNCLETS
6275-
if (lvaPSPSym != BAD_VAR_NUM)
6276-
{
6277-
// If we need a PSPSym, allocate it first, before anything else, including
6278-
// padding (so we can avoid computing the same padding in the funclet
6279-
// frame). Note that there is no special padding requirement for the PSPSym.
6280-
noway_assert(codeGen->isFramePointerUsed()); // We need an explicit frame pointer
6281-
stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaPSPSym, TARGET_POINTER_SIZE, stkOffs + TARGET_POINTER_SIZE);
6282-
PSP_MonAcquire_Size += TARGET_POINTER_SIZE;
6283-
}
6284-
#endif // FEATURE_EH_FUNCLETS
6285-
6286-
if (lvaMonAcquired != BAD_VAR_NUM)
6287-
{
6288-
// For OSR we use the flag set up by the original method.
6289-
if (opts.IsOSR())
6290-
{
6291-
originalFrameStkOffs += lvaLclSize(lvaMonAcquired);
6292-
assert(info.compPatchpointInfo->HasMonitorAcquired());
6293-
int originalOffset = info.compPatchpointInfo->MonitorAcquiredOffset();
6294-
int offset = originalFrameStkOffs + PSP_MonAcquire_Size + originalOffset;
6295-
6296-
JITDUMP(
6297-
"---OSR--- V%02u (on tier0 frame, monitor acquired) tier0 FP-rel offset %d tier0 frame offset %d new "
6298-
"virt offset %d\n",
6299-
lvaMonAcquired, originalOffset, originalFrameStkOffs + PSP_MonAcquire_Size, offset);
6300-
6301-
lvaTable[lvaMonAcquired].SetStackOffset(offset);
6302-
}
6303-
else
6304-
{
6305-
// This var must go first, in what is called the 'frame header' for EnC so that it is
6306-
// preserved when remapping occurs. See vm\eetwain.cpp for detailed comment specifying frame
6307-
// layout requirements for EnC to work.
6308-
stkOffs = stkOffs + PSP_MonAcquire_Size + lvaLclSize(lvaMonAcquired);
6309-
stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaMonAcquired, lvaLclSize(lvaMonAcquired), stkOffs);
6310-
stkOffs -= PSP_MonAcquire_Size;
6311-
PSP_MonAcquire_Size += lvaLclSize(lvaMonAcquired);
6312-
}
6313-
}
6314-
if (opts.IsOSR())
6315-
{
6316-
originalFrameStkOffs += PSP_MonAcquire_Size;
6317-
originalFrameSize = originalFrameStkOffs;
6318-
}
6319-
stkOffs = stkOffs - (compCalleeRegsPushed << 3);
6320-
6321-
#else
63226288
if (lvaMonAcquired != BAD_VAR_NUM)
63236289
{
63246290
// For OSR we use the flag set up by the original method.
@@ -6344,9 +6310,8 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
63446310
stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaMonAcquired, lvaLclSize(lvaMonAcquired), stkOffs);
63456311
}
63466312
}
6347-
#endif
63486313

6349-
#if defined(FEATURE_EH_FUNCLETS) && (defined(TARGET_ARMARCH) || defined(TARGET_RISCV64))
6314+
#if defined(FEATURE_EH_FUNCLETS) && (defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64))
63506315
if (lvaPSPSym != BAD_VAR_NUM)
63516316
{
63526317
// On ARM/ARM64, if we need a PSPSym we allocate it early since funclets
@@ -6355,7 +6320,12 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
63556320
noway_assert(codeGen->isFramePointerUsed()); // We need an explicit frame pointer
63566321
stkOffs = lvaAllocLocalAndSetVirtualOffset(lvaPSPSym, TARGET_POINTER_SIZE, stkOffs);
63576322
}
6358-
#endif // FEATURE_EH_FUNCLETS && (TARGET_ARMARCH || TARGET_RISCV64)
6323+
#endif // FEATURE_EH_FUNCLETS && (TARGET_ARMARCH || TARGET_LOONGARCH64 || TARGET_RISCV64)
6324+
6325+
#if defined(TARGET_LOONGARCH64)
6326+
// From here, all the stack local values are below the FP, so the offset is negative.
6327+
stkOffs = 0;
6328+
#endif
63596329

63606330
if (mustDoubleAlign)
63616331
{
@@ -6973,9 +6943,7 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
69736943
#endif // FEATURE_FIXED_OUT_ARGS
69746944

69756945
#if defined(TARGET_LOONGARCH64)
6976-
noway_assert(compLclFrameSize + originalFrameSize ==
6977-
(unsigned)(originalFrameStkOffs + PSP_MonAcquire_Size - stkOffs));
6978-
6946+
noway_assert(compLclFrameSize == (unsigned)(PSP_MonAcquire_Size - stkOffs));
69796947
#else
69806948

69816949
#if defined(TARGET_RISCV64)

0 commit comments

Comments
 (0)