Skip to content

Commit 15a290a

Browse files
authored
[LoongArch64] Adjust the order of genPopCalleeSavedRegisters() and instGen_Set_Reg_To_Imm() in Epilog to fix the GC interruptible range. (#117305)
1 parent 794a7ee commit 15a290a

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/coreclr/jit/codegenloongarch64.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ void CodeGen::genFnEpilog(BasicBlock* block)
632632

633633
compiler->unwindBegEpilog();
634634

635+
genPopCalleeSavedRegisters();
636+
635637
if (jmpEpilog)
636638
{
637639
SetHasTailCalls(true);
@@ -644,7 +646,6 @@ void CodeGen::genFnEpilog(BasicBlock* block)
644646
#if !FEATURE_FASTTAILCALL
645647
noway_assert(jmpNode->OperIs(GT_JMP));
646648
#else // FEATURE_FASTTAILCALL
647-
// armarch
648649
// If jmpNode is GT_JMP then gtNext must be null.
649650
// If jmpNode is a fast tail call, gtNext need not be null since it could have embedded stmts.
650651
noway_assert(!jmpNode->OperIs(GT_JMP) || (jmpNode->gtNext == nullptr));
@@ -699,28 +700,20 @@ void CodeGen::genFnEpilog(BasicBlock* block)
699700
NO_WAY("Unsupported JMP indirection");
700701
}
701702

702-
/* Simply emit a jump to the methodHnd. This is similar to a call so we can use
703-
* the same descriptor with some minor adjustments.
704-
*/
705-
706-
genPopCalleeSavedRegisters(true);
707-
703+
// Simply emit a jump to the methodHnd. This is similar to a call so we can use
704+
// the same descriptor with some minor adjustments.
708705
params.isJump = true;
709-
710706
genEmitCallWithCurrentGC(params);
711707
}
712708
#if FEATURE_FASTTAILCALL
713709
else
714710
{
715-
genPopCalleeSavedRegisters(true);
716711
genCallInstruction(jmpNode->AsCall());
717712
}
718713
#endif // FEATURE_FASTTAILCALL
719714
}
720715
else
721716
{
722-
genPopCalleeSavedRegisters(false);
723-
724717
GetEmitter()->emitIns_R_R_I(INS_jirl, EA_PTRSIZE, REG_R0, REG_RA, 0);
725718
compiler->unwindReturn(REG_RA);
726719
}

0 commit comments

Comments
 (0)