Skip to content

Commit ddc0b20

Browse files
committed
Revert "Unpin locals (#70264)"
This reverts commit b1c2275.
1 parent 5c5e66e commit ddc0b20

File tree

3 files changed

+30
-57
lines changed

3 files changed

+30
-57
lines changed

src/coreclr/jit/compiler.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,6 @@ class LclVarDsc
614614
unsigned char lvSingleDefDisqualifyReason = 'H';
615615
#endif
616616

617-
unsigned char lvAllDefsAreNoGc : 1; // For pinned locals: true if all defs of this local are no-gc
618-
619617
#if FEATURE_MULTIREG_ARGS
620618
regNumber lvRegNumForSlot(unsigned slotNum)
621619
{

src/coreclr/jit/gentree.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,11 +1109,6 @@ struct GenTree
11091109
return true;
11101110
}
11111111

1112-
bool IsNotGcDef() const
1113-
{
1114-
return IsIntegralConst(0) || IsLocalAddrExpr();
1115-
}
1116-
11171112
// LIR flags
11181113
// These helper methods, along with the flag values they manipulate, are defined in lir.h
11191114
//

src/coreclr/jit/lclvars.cpp

Lines changed: 30 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4181,57 +4181,49 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
41814181

41824182
/* Is this an assignment to a local variable? */
41834183

4184-
if (op1->gtOper == GT_LCL_VAR)
4184+
if (op1->gtOper == GT_LCL_VAR && op2->gtType != TYP_BOOL)
41854185
{
4186-
LclVarDsc* varDsc = lvaGetDesc(op1->AsLclVarCommon());
4186+
/* Only simple assignments allowed for booleans */
41874187

4188-
if (varDsc->lvPinned && varDsc->lvAllDefsAreNoGc)
4188+
if (tree->gtOper != GT_ASG)
41894189
{
4190-
if (!op2->IsNotGcDef())
4191-
{
4192-
varDsc->lvAllDefsAreNoGc = false;
4193-
}
4190+
goto NOT_BOOL;
41944191
}
41954192

4196-
if (op2->gtType != TYP_BOOL)
4197-
{
4198-
/* Only simple assignments allowed for booleans */
4193+
/* Is the RHS clearly a boolean value? */
41994194

4200-
if (tree->gtOper != GT_ASG)
4201-
{
4202-
goto NOT_BOOL;
4203-
}
4195+
switch (op2->gtOper)
4196+
{
4197+
unsigned lclNum;
42044198

4205-
/* Is the RHS clearly a boolean value? */
4199+
case GT_CNS_INT:
42064200

4207-
switch (op2->gtOper)
4208-
{
4209-
case GT_CNS_INT:
4201+
if (op2->AsIntCon()->gtIconVal == 0)
4202+
{
4203+
break;
4204+
}
4205+
if (op2->AsIntCon()->gtIconVal == 1)
4206+
{
4207+
break;
4208+
}
42104209

4211-
if (op2->AsIntCon()->gtIconVal == 0)
4212-
{
4213-
break;
4214-
}
4215-
if (op2->AsIntCon()->gtIconVal == 1)
4216-
{
4217-
break;
4218-
}
4210+
// Not 0 or 1, fall through ....
4211+
FALLTHROUGH;
42194212

4220-
// Not 0 or 1, fall through ....
4221-
FALLTHROUGH;
4213+
default:
42224214

4223-
default:
4215+
if (op2->OperIsCompare())
4216+
{
4217+
break;
4218+
}
42244219

4225-
if (op2->OperIsCompare())
4226-
{
4227-
break;
4228-
}
4220+
NOT_BOOL:
42294221

4230-
NOT_BOOL:
4222+
lclNum = op1->AsLclVarCommon()->GetLclNum();
4223+
noway_assert(lclNum < lvaCount);
42314224

4232-
varDsc->lvIsBoolean = false;
4233-
break;
4234-
}
4225+
lvaTable[lclNum].lvIsBoolean = false;
4226+
break;
42354227
}
42364228
}
42374229
}
@@ -4286,8 +4278,7 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
42864278
{
42874279
if (lvaVarAddrExposed(lclNum))
42884280
{
4289-
varDsc->lvIsBoolean = false;
4290-
varDsc->lvAllDefsAreNoGc = false;
4281+
varDsc->lvIsBoolean = false;
42914282
}
42924283

42934284
if (tree->gtOper == GT_LCL_FLD)
@@ -4712,8 +4703,6 @@ void Compiler::lvaComputeRefCounts(bool isRecompute, bool setSlotNumbers)
47124703
varDsc->setLvRefCnt(0);
47134704
varDsc->setLvRefCntWtd(BB_ZERO_WEIGHT);
47144705

4715-
varDsc->lvAllDefsAreNoGc = true;
4716-
47174706
// Special case for some varargs params ... these must
47184707
// remain unreferenced.
47194708
const bool isSpecialVarargsParam = varDsc->lvIsParam && raIsVarargsStackArg(lclNum);
@@ -4761,8 +4750,6 @@ void Compiler::lvaComputeRefCounts(bool isRecompute, bool setSlotNumbers)
47614750
{
47624751
varDsc->lvSingleDef = varDsc->lvIsParam;
47634752
varDsc->lvSingleDefRegCandidate = varDsc->lvIsParam;
4764-
4765-
varDsc->lvAllDefsAreNoGc = true;
47664753
}
47674754
}
47684755

@@ -4881,13 +4868,6 @@ void Compiler::lvaComputeRefCounts(bool isRecompute, bool setSlotNumbers)
48814868
varDsc->lvImplicitlyReferenced = 1;
48824869
}
48834870
}
4884-
4885-
if (varDsc->lvPinned && varDsc->lvAllDefsAreNoGc)
4886-
{
4887-
varDsc->lvPinned = 0;
4888-
4889-
JITDUMP("V%02u was unpinned as all def candidates were local.\n", lclNum);
4890-
}
48914871
}
48924872
}
48934873

0 commit comments

Comments
 (0)