Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,11 @@ void CodeGen::genCodeForBBlist()
nonVarPtrRegs &= ~RBM_ASYNC_CONTINUATION_RET;
}

// For a tailcall arbitrary argument registers may be live into the
// For a tailcall arbitrary argument/target registers may be live into the
// epilog. Skip validating those.
if (block->HasFlag(BBF_HAS_JMP))
{
nonVarPtrRegs &= ~fullIntArgRegMask(CorInfoCallConvExtension::Managed);
nonVarPtrRegs = RBM_NONE;
}

if (nonVarPtrRegs)
Expand Down
15 changes: 15 additions & 0 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6052,6 +6052,21 @@ void CodeGen::genCall(GenTreeCall* call)
if (target->isContainedIndir())
{
genConsumeAddress(target->AsIndir()->Addr());

// Consuming these registers will ensure the registers containing the state we need are available here,
// but it assumes we will use them immediately and will thus kill the live state. Since these registers
// are live into the epilog we need to remark them as live.
// This logic is similar to what genCallPlaceRegArgs does above for argument registers.
GenTreeIndir* indir = target->AsIndir();
if (indir->HasBase() && indir->Base()->TypeIs(TYP_BYREF, TYP_REF))
{
gcInfo.gcMarkRegPtrVal(indir->Base()->GetRegNum(), indir->Base()->TypeGet());
}

if (indir->HasIndex() && indir->Index()->TypeIs(TYP_BYREF, TYP_REF))
{
gcInfo.gcMarkRegPtrVal(indir->Index()->GetRegNum(), indir->Index()->TypeGet());
}
}
else
{
Expand Down
Loading