Skip to content

Commit

Permalink
keep existing code for x86
Browse files Browse the repository at this point in the history
  • Loading branch information
VSadov committed Aug 3, 2024
1 parent 7529e47 commit c78b323
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
24 changes: 24 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,30 @@ void CodeGen::genExitCode(BasicBlock* block)
GetEmitter()->emitDisableGC();
#endif
genEmitGSCookieCheck(jmpEpilog);
#ifndef JIT32_GCENCODER
if (jmpEpilog)
{
// Dev10 642944 -
// The GS cookie check created a temp label that has no live
// incoming GC registers, we need to fix that

unsigned varNum;
LclVarDsc* varDsc;

/* Figure out which register parameters hold pointers */

for (varNum = 0, varDsc = compiler->lvaTable; varNum < compiler->lvaCount && varDsc->lvIsRegArg;
varNum++, varDsc++)
{
noway_assert(varDsc->lvIsParam);

gcInfo.gcMarkRegPtrVal(varDsc->GetArgReg(), varDsc->TypeGet());
}

GetEmitter()->emitThisGCrefRegs = GetEmitter()->emitInitGCrefRegs = gcInfo.gcRegGCrefSetCur;
GetEmitter()->emitThisByrefRegs = GetEmitter()->emitInitByrefRegs = gcInfo.gcRegByrefSetCur;
}
#endif
}

genReserveEpilog(block);
Expand Down
34 changes: 6 additions & 28 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,38 +113,16 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
}
else
{
if (compiler->info.compRetNativeType == TYP_REF)
{
gcInfo.gcRegGCrefSetCur |= RBM_INTRET;
}
else if (compiler->info.compRetNativeType == TYP_BYREF)
ReturnTypeDesc retTypeDesc = compiler->compRetTypeDesc;
const unsigned regCount = retTypeDesc.GetReturnRegCount();

for (unsigned i = 0; i < regCount; ++i)
{
gcInfo.gcRegByrefSetCur |= RBM_INTRET;
gcInfo.gcMarkRegPtrVal(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv),
retTypeDesc.GetReturnRegType(i));
}
}
}
else
{
// Dev10 642944 -
// The GS cookie check created a temp label that has no live
// incoming GC registers, we need to fix that

unsigned varNum;
LclVarDsc* varDsc;

/* Figure out which register parameters hold pointers */

for (varNum = 0, varDsc = compiler->lvaTable; varNum < compiler->lvaCount && varDsc->lvIsRegArg;
varNum++, varDsc++)
{
noway_assert(varDsc->lvIsParam);

gcInfo.gcMarkRegPtrVal(varDsc->GetArgReg(), varDsc->TypeGet());
}

GetEmitter()->emitThisGCrefRegs = GetEmitter()->emitInitGCrefRegs = gcInfo.gcRegGCrefSetCur;
GetEmitter()->emitThisByrefRegs = GetEmitter()->emitInitByrefRegs = gcInfo.gcRegByrefSetCur;
}
#else
assert(GetEmitter()->emitGCDisabled());
#endif
Expand Down

0 comments on commit c78b323

Please sign in to comment.