Skip to content

Commit

Permalink
Revert "Make FailFast blocks cold" (#93835)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Oct 23, 2023
1 parent 7a0727e commit 2959e1a
Showing 5 changed files with 22 additions and 10 deletions.
7 changes: 5 additions & 2 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
@@ -631,8 +631,11 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
// Compare with the GC cookie constant
GetEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regGSConst, regGSValue);

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

//---------------------------------------------------------------------
8 changes: 6 additions & 2 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
@@ -5192,8 +5192,12 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
GetEmitter()->emitIns_R_S(INS_ld_d, EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);

// Compare with the GC cookie constant
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
GetEmitter()->emitIns_J_cond_la(INS_bne, codeDsc->acdDstBlk, regGSConst, regGSValue);
BasicBlock* gsCheckBlk = genCreateTempLabel();
GetEmitter()->emitIns_J_cond_la(INS_beq, gsCheckBlk, regGSConst, regGSValue);

// regGSConst and regGSValue aren't needed anymore, we can use them for helper call
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
genDefineTempLabel(gsCheckBlk);
}

//---------------------------------------------------------------------
8 changes: 6 additions & 2 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
@@ -4959,8 +4959,12 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
GetEmitter()->emitIns_R_S(INS_ld, EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);

// Compare with the GC cookie constant
Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
GetEmitter()->emitIns_J_cond_la(INS_bne, codeDsc->acdDstBlk, regGSConst, regGSValue);
BasicBlock* gsCheckBlk = genCreateTempLabel();
GetEmitter()->emitIns_J_cond_la(INS_beq, gsCheckBlk, regGSConst, regGSValue);

// regGSConst and regGSValue aren't needed anymore, we can use them for helper call
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
genDefineTempLabel(gsCheckBlk);
}

//---------------------------------------------------------------------
7 changes: 5 additions & 2 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
@@ -195,8 +195,11 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
GetEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, regGSCheck, compiler->lvaGSSecurityCookie, 0);
}

Compiler::AddCodeDsc* codeDsc = compiler->fgFindExcptnTarget(SpecialCodeKind::SCK_FAIL_FAST, 0);
inst_JMP(EJ_jne, codeDsc->acdDstBlk);
BasicBlock* gsCheckBlk = genCreateTempLabel();
inst_JMP(EJ_je, gsCheckBlk);
genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
genDefineTempLabel(gsCheckBlk);

genPopRegs(pushedRegs, byrefPushedRegs, norefPushedRegs);
}

2 changes: 0 additions & 2 deletions src/coreclr/jit/gschecks.cpp
Original file line number Diff line number Diff line change
@@ -30,8 +30,6 @@ PhaseStatus Compiler::gsPhase()
unsigned const prevBBCount = fgBBcount;
gsGSChecksInitCookie();

fgAddCodeRef(fgLastBB, SCK_FAIL_FAST);

if (compGSReorderStackLayout)
{
gsCopyShadowParams();

0 comments on commit 2959e1a

Please sign in to comment.