Skip to content

Commit

Permalink
JIT: recognize we have exact type for this in constructors
Browse files Browse the repository at this point in the history
In constructors the exact type of `this` is known. Tracking this helps the
jit devirtualize calls made from chaining constructors.

Related discussion in #16198.
  • Loading branch information
AndyAyersMS committed Feb 6, 2018
1 parent 4e617da commit 1464a16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,9 @@ void Compiler::lvaInitThisPtr(InitVarDscInfo* varDscInfo)
}
else
{
varDsc->lvType = TYP_REF;
lvaSetClass(varDscInfo->varNum, info.compClassHnd);
const bool isExact = (info.compFlags & CORINFO_FLG_CONSTRUCTOR) != 0;
varDsc->lvType = TYP_REF;
lvaSetClass(varDscInfo->varNum, info.compClassHnd, isExact);
}

if (tiVerificationNeeded)
Expand Down

0 comments on commit 1464a16

Please sign in to comment.