Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
JIT: Fix crossgen failure in gtTryRemoveBoxUpstreamEffects (#14016)
Browse files Browse the repository at this point in the history
In some R2R expansions the type handle is not an explicit operand to
the newobj helper. So we must bail out of removal attempts when the
type handle is desired and we see such an expansion.

Closes #13942.
Also likely will fix #13930.
  • Loading branch information
AndyAyersMS authored Sep 15, 2017
1 parent 776b2bf commit a38aa24
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12538,9 +12538,19 @@ GenTree* Compiler::gtTryRemoveBoxUpstreamEffects(GenTree* op, BoxRemovalOptions
}
else if (asgSrcOper == GT_CALL)
{
GenTreeCall* newobjCall = asgSrc->AsCall();
GenTreeArgList* newobjArgs = newobjCall->gtCallArgs->AsArgList();
boxTypeHandle = newobjArgs->Current();
GenTreeCall* newobjCall = asgSrc->AsCall();
GenTree* newobjArgs = newobjCall->gtCallArgs;

// In R2R expansions the handle may not be an explicit operand to the helper,
// so we can't remove the box.
if (newobjArgs == nullptr)
{
assert(newobjCall->IsHelperCall(this, CORINFO_HELP_READYTORUN_NEW));
JITDUMP("bailing; newobj via R2R helper\n");
return nullptr;
}

boxTypeHandle = newobjArgs->AsArgList()->Current();
}
else
{
Expand Down

0 comments on commit a38aa24

Please sign in to comment.