Skip to content

Commit

Permalink
handle delegates
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Jul 19, 2024
1 parent 50828c3 commit ebfe419
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/coreclr/jit/objectalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,12 +999,23 @@ bool ObjectAllocator::CanLclVarEscapeViaParentStack(ArrayStack<GenTree*>* parent

case GT_CALL:
{
GenTreeCall* asCall = parent->AsCall();
GenTreeCall* const call = parent->AsCall();

if (asCall->IsHelperCall())
if (call->IsHelperCall())
{
canLclVarEscapeViaParentStack =
!Compiler::s_helperCallProperties.IsNoEscape(comp->eeGetHelperNum(asCall->gtCallMethHnd));
!Compiler::s_helperCallProperties.IsNoEscape(comp->eeGetHelperNum(call->gtCallMethHnd));
}
else if (call->gtCallType == CT_USER_FUNC)
{
// Delegate invoke won't escape the delegate which is passed as "this"
// And gets expanded inline later.
//
if ((call->gtCallMoreFlags & GTF_CALL_M_DELEGATE_INV) != 0)
{
GenTree* const thisArg = call->gtArgs.GetThisArg()->GetNode();
canLclVarEscapeViaParentStack = thisArg != tree;
}
}
break;
}
Expand Down

0 comments on commit ebfe419

Please sign in to comment.