summaryrefslogtreecommitdiff
path: root/src/jit/lclvars.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2018-07-20 14:56:09 -0700
committerGitHub <noreply@github.com>2018-07-20 14:56:09 -0700
commit699028a7a033991f01a72211a88a534ef1360c3a (patch)
tree1106ee9a2cc4dfb4649ca4c6f6f702003b4af786 /src/jit/lclvars.cpp
parentc98addeee64e0bca467079c7e9b9c359818f144c (diff)
downloadcoreclr-699028a7a033991f01a72211a88a534ef1360c3a.tar.gz
coreclr-699028a7a033991f01a72211a88a534ef1360c3a.tar.bz2
coreclr-699028a7a033991f01a72211a88a534ef1360c3a.zip
JIT: handle implicit local var references via local var attribute bit (#19012)
Instead of relying on ref count bumps, add a new attribute bit to local vars to indicate that they may have implicit references (prolog, epilog, gc, eh) and may not have any IR references. Use this attribute bit to ensure that the ref count and weighted ref count for such variables are never reported as zero, and as a result that these variables end up being allocated and reportable. This is another preparatory step for #18969 and frees the jit to recompute explicit ref counts via an IR scan without having to special case the counts for these variables. The jit can no longer describe implicit counts other than 1 and implicit weights otehr than BB_UNITY_WEIGHT, but that currently doesn't seem to be very important. The new bit fits into an existing padding void so LclVarDsc remains at 128 bytes (for windows x64).
Diffstat (limited to 'src/jit/lclvars.cpp')
-rw-r--r--src/jit/lclvars.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index e72ae11cf5..00110b0e6a 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -4026,10 +4026,8 @@ void Compiler::lvaMarkLocalVars()
lvaTable[info.compLvFrameListRoot].lvType = TYP_I_IMPL;
- /* Set the refCnt, it is used in the prolog and return block(s) */
-
- lvaTable[info.compLvFrameListRoot].setLvRefCnt(2);
- lvaTable[info.compLvFrameListRoot].setLvRefCntWtd(2 * BB_UNITY_WEIGHT);
+ // This local has implicit prolog and epilog references
+ lvaTable[info.compLvFrameListRoot].lvImplicitlyReferenced = 1;
}
}
@@ -4148,16 +4146,16 @@ void Compiler::lvaMarkLocalVars()
}
#endif
- if (lvaKeepAliveAndReportThis() && lvaTable[0].lvRefCnt() == 0)
+ if (lvaKeepAliveAndReportThis())
{
- lvaTable[0].setLvRefCnt(1);
+ lvaTable[0].lvImplicitlyReferenced = 1;
// This isn't strictly needed as we will make a copy of the param-type-arg
// in the prolog. However, this ensures that the LclVarDsc corresponding to
// info.compTypeCtxtArg is valid.
}
- else if (lvaReportParamTypeArg() && lvaTable[info.compTypeCtxtArg].lvRefCnt() == 0)
+ else if (lvaReportParamTypeArg())
{
- lvaTable[info.compTypeCtxtArg].setLvRefCnt(1);
+ lvaTable[info.compTypeCtxtArg].lvImplicitlyReferenced = 1;
}
lvaLocalVarRefCounted = true;
@@ -4176,12 +4174,8 @@ void Compiler::lvaAllocOutgoingArgSpaceVar()
{
lvaOutgoingArgSpaceVar = lvaGrabTemp(false DEBUGARG("OutgoingArgSpace"));
- lvaTable[lvaOutgoingArgSpaceVar].lvType = TYP_LCLBLK;
-
- /* Set the refCnts */
-
- lvaTable[lvaOutgoingArgSpaceVar].setLvRefCnt(1);
- lvaTable[lvaOutgoingArgSpaceVar].setLvRefCntWtd(BB_UNITY_WEIGHT);
+ lvaTable[lvaOutgoingArgSpaceVar].lvType = TYP_LCLBLK;
+ lvaTable[lvaOutgoingArgSpaceVar].lvImplicitlyReferenced = 1;
}
noway_assert(lvaOutgoingArgSpaceVar >= info.compLocalsCount && lvaOutgoingArgSpaceVar < lvaCount);