Skip to content

Commit de15637

Browse files
committed
Insert int3 after non-returning calls at the end of basic blocks.
This is a follow-up to dotnet#17501 that fixed #17398. #17398 was caused by a break in implicit contract between codegen and gc pointer reporting in fully-interruptible mode: the latter assumed that register gc pointer liveness doesn't change across calls while dotnet#6103 introduced codegen where it wasn't true. dotnet#17501 changed gc pointer reporting not to expect that register gc pointer liveness doesn't change across calls. This change inserts int3 after non-returning calls at the end of basic blocks so that gc pointer liveness doesn't change across calls. This is additional insurance in case any other place in runtime was dependent on that contract.
1 parent c29b30b commit de15637

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/jit/codegenlinear.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,20 @@ void CodeGen::genCodeForBBlist()
602602
{
603603
instGen(INS_BREAKPOINT); // This should never get executed
604604
}
605+
// Do likewise for blocks that end in DOES_NOT_RETURN calls
606+
// that were not caught by the above rules.
607+
else
608+
{
609+
GenTree* call = block->lastNode();
610+
611+
if ((call != nullptr) && (call->gtOper == GT_CALL))
612+
{
613+
if ((call->gtCall.gtCallMoreFlags & GTF_CALL_M_DOES_NOT_RETURN) != 0)
614+
{
615+
instGen(INS_BREAKPOINT); // This should never get executed
616+
}
617+
}
618+
}
605619

606620
break;
607621

0 commit comments

Comments
 (0)