Skip to content

Commit

Permalink
JIT: capture class types when spilling a GDV arg (#110675)
Browse files Browse the repository at this point in the history
If we need to spill ref type args for a GDV, try to annotate the spilled
locals with type information.
  • Loading branch information
AndyAyersMS authored Dec 14, 2024
1 parent 14503a7 commit ed46aa2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/coreclr/jit/indirectcalltransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,21 @@ class IndirectCallTransformer
//
void SpillArgToTempBeforeGuard(CallArg* arg)
{
unsigned tmpNum = compiler->lvaGrabTemp(true DEBUGARG("guarded devirt arg temp"));
GenTree* store = compiler->gtNewTempStore(tmpNum, arg->GetNode());
unsigned tmpNum = compiler->lvaGrabTemp(true DEBUGARG("guarded devirt arg temp"));
GenTree* const argNode = arg->GetNode();
GenTree* store = compiler->gtNewTempStore(tmpNum, argNode);

if (argNode->TypeIs(TYP_REF))
{
bool isExact = false;
bool isNonNull = false;
CORINFO_CLASS_HANDLE cls = compiler->gtGetClassHandle(argNode, &isExact, &isNonNull);
if (cls != NO_CLASS_HANDLE)
{
compiler->lvaSetClass(tmpNum, cls, isExact);
}
}

Statement* storeStmt = compiler->fgNewStmtFromTree(store, stmt->GetDebugInfo());
compiler->fgInsertStmtAtEnd(checkBlock, storeStmt);

Expand Down

0 comments on commit ed46aa2

Please sign in to comment.