Skip to content

Commit 2959e1a

Browse files
authored
Revert "Make FailFast blocks cold" (#93835)
1 parent 7a0727e commit 2959e1a

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

src/coreclr/jit/codegenarmarch.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,11 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
631631
// Compare with the GC cookie constant
632632
GetEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regGSConst, regGSValue);
633633

634-
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
635-
inst_JMP(EJ_ne, codeDsc->acdDstBlk);
634+
BasicBlock* gsCheckBlk = genCreateTempLabel();
635+
inst_JMP(EJ_eq, gsCheckBlk);
636+
// regGSConst and regGSValue aren't needed anymore, we can use them for helper call
637+
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
638+
genDefineTempLabel(gsCheckBlk);
636639
}
637640

638641
//---------------------------------------------------------------------

src/coreclr/jit/codegenloongarch64.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5192,8 +5192,12 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
51925192
GetEmitter()->emitIns_R_S(INS_ld_d, EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);
51935193

51945194
// Compare with the GC cookie constant
5195-
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
5196-
GetEmitter()->emitIns_J_cond_la(INS_bne, codeDsc->acdDstBlk, regGSConst, regGSValue);
5195+
BasicBlock* gsCheckBlk = genCreateTempLabel();
5196+
GetEmitter()->emitIns_J_cond_la(INS_beq, gsCheckBlk, regGSConst, regGSValue);
5197+
5198+
// regGSConst and regGSValue aren't needed anymore, we can use them for helper call
5199+
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
5200+
genDefineTempLabel(gsCheckBlk);
51975201
}
51985202

51995203
//---------------------------------------------------------------------

src/coreclr/jit/codegenriscv64.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4959,8 +4959,12 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
49594959
GetEmitter()->emitIns_R_S(INS_ld, EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);
49604960

49614961
// Compare with the GC cookie constant
4962-
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
4963-
GetEmitter()->emitIns_J_cond_la(INS_bne, codeDsc->acdDstBlk, regGSConst, regGSValue);
4962+
BasicBlock* gsCheckBlk = genCreateTempLabel();
4963+
GetEmitter()->emitIns_J_cond_la(INS_beq, gsCheckBlk, regGSConst, regGSValue);
4964+
4965+
// regGSConst and regGSValue aren't needed anymore, we can use them for helper call
4966+
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
4967+
genDefineTempLabel(gsCheckBlk);
49644968
}
49654969

49664970
//---------------------------------------------------------------------

src/coreclr/jit/codegenxarch.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,11 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
195195
GetEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, regGSCheck, compiler->lvaGSSecurityCookie, 0);
196196
}
197197

198-
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
199-
inst_JMP(EJ_jne, codeDsc->acdDstBlk);
198+
BasicBlock* gsCheckBlk = genCreateTempLabel();
199+
inst_JMP(EJ_je, gsCheckBlk);
200+
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
201+
genDefineTempLabel(gsCheckBlk);
202+
200203
genPopRegs(pushedRegs, byrefPushedRegs, norefPushedRegs);
201204
}
202205

src/coreclr/jit/gschecks.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ PhaseStatus Compiler::gsPhase()
3030
unsigned const prevBBCount = fgBBcount;
3131
gsGSChecksInitCookie();
3232

33-
fgAddCodeRef(fgLastBB, SCK_FAIL_FAST);
34-
3533
if (compGSReorderStackLayout)
3634
{
3735
gsCopyShadowParams();

0 commit comments

Comments
 (0)