Skip to content

Commit 284db1c

Browse files
committed
Get rid of StackInfo.size
It doesn't seem like we will be needing it. Use constructor in more places
1 parent 31b367d commit 284db1c

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -578,11 +578,8 @@ bool InterpCompiler::CheckStackHelper(int n)
578578
void InterpCompiler::PushTypeExplicit(StackType stackType, CORINFO_CLASS_HANDLE clsHnd, int size)
579579
{
580580
EnsureStack(1);
581-
m_pStackPointer->type = stackType;
582-
m_pStackPointer->clsHnd = clsHnd;
583-
m_pStackPointer->size = ALIGN_UP_TO(size, INTERP_STACK_SLOT_SIZE);
584-
int var = CreateVarExplicit(g_interpTypeFromStackType[stackType], clsHnd, size);
585-
m_pStackPointer->var = var;
581+
int32_t var = CreateVarExplicit(g_interpTypeFromStackType[stackType], clsHnd, size);
582+
new (m_pStackPointer) StackInfo(stackType, clsHnd, var);
586583
m_pStackPointer++;
587584
}
588585

@@ -1286,7 +1283,7 @@ void InterpCompiler::EmitConv(StackInfo *sp, StackType type, InterpOpcode convOp
12861283

12871284
newInst->SetSVar(sp->var);
12881285
int32_t var = CreateVarExplicit(g_interpTypeFromStackType[type], NULL, INTERP_STACK_SLOT_SIZE);
1289-
new (sp) StackInfo(type, NULL, INTERP_STACK_SLOT_SIZE, var);
1286+
new (sp) StackInfo(type, NULL, var);
12901287
newInst->SetDVar(var);
12911288

12921289
// NOTE: We rely on m_pLastNewIns == newInst upon return from this function. Make sure you preserve that if you change anything.
@@ -1704,10 +1701,7 @@ bool InterpCompiler::InitializeClauseBuildingBlocks(CORINFO_METHOD_INFO* methodI
17041701
// Initialize the filter stack state. It initially contains the exception object.
17051702
pFilterBB->stackHeight = 1;
17061703
pFilterBB->pStackState = (StackInfo*)AllocMemPool(sizeof (StackInfo));
1707-
pFilterBB->pStackState[0].type = StackTypeO;
1708-
pFilterBB->pStackState[0].size = INTERP_STACK_SLOT_SIZE;
1709-
pFilterBB->pStackState[0].clsHnd = NULL;
1710-
pFilterBB->pStackState[0].var = pFilterBB->clauseVarIndex;
1704+
new (pFilterBB->pStackState) StackInfo(StackTypeO, NULL, pFilterBB->clauseVarIndex);
17111705

17121706
// Find and mark all basic blocks that are part of the filter region.
17131707
for (uint32_t j = clause.FilterOffset; j < clause.HandlerOffset; j++)
@@ -1736,10 +1730,7 @@ bool InterpCompiler::InitializeClauseBuildingBlocks(CORINFO_METHOD_INFO* methodI
17361730
// Initialize the catch / filtered handler stack state. It initially contains the exception object.
17371731
pCatchBB->stackHeight = 1;
17381732
pCatchBB->pStackState = (StackInfo*)AllocMemPool(sizeof (StackInfo));
1739-
pCatchBB->pStackState[0].type = StackTypeO;
1740-
pCatchBB->pStackState[0].size = INTERP_STACK_SLOT_SIZE;
1741-
pCatchBB->pStackState[0].var = pCatchBB->clauseVarIndex;
1742-
pCatchBB->pStackState[0].clsHnd = NULL;
1733+
new (pCatchBB->pStackState) StackInfo(StackTypeO, NULL, pCatchBB->clauseVarIndex);
17431734
}
17441735
}
17451736

@@ -2912,7 +2903,7 @@ void InterpCompiler::EmitBox(StackInfo* pStackInfo, CORINFO_CLASS_HANDLE clsHnd,
29122903
m_pLastNewIns->SetSVar(pStackInfo->var);
29132904

29142905
int32_t var = CreateVarExplicit(InterpTypeO, NULL, INTERP_STACK_SLOT_SIZE);
2915-
new (pStackInfo) StackInfo(StackTypeO, boxedClsHnd, INTERP_STACK_SLOT_SIZE, var);
2906+
new (pStackInfo) StackInfo(StackTypeO, boxedClsHnd, var);
29162907

29172908
m_pLastNewIns->SetDVar(pStackInfo->var);
29182909
m_pLastNewIns->data[0] = GetDataItemIndex(clsHnd);

src/coreclr/interpreter/compiler.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,15 @@ struct StackInfo
266266
{
267267
StackType type;
268268
CORINFO_CLASS_HANDLE clsHnd;
269-
// Size that this value will occupy on the interpreter stack. It is a multiple
270-
// of INTERP_STACK_SLOT_SIZE
271-
int size;
272269

273270
// The var associated with the value of this stack entry. Every time we push on
274271
// the stack a new var is created.
275272
int var;
276273

277-
StackInfo(StackType type, CORINFO_CLASS_HANDLE clsHnd, int size, int var)
274+
StackInfo(StackType type, CORINFO_CLASS_HANDLE clsHnd, int var)
278275
{
279276
this->type = type;
280277
this->clsHnd = clsHnd;
281-
this->size = size;
282278
this->var = var;
283279
}
284280
};

0 commit comments

Comments
 (0)