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

Commit f78693e

Browse files
committed
[ARM64] Align Compiler::lvaStressLclFldCB padding
1 parent 18b9048 commit f78693e

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/jit/codegencommon.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ void CodeGen::genAdjustStackLevel(BasicBlock* block)
16841684
#endif // !FEATURE_FIXED_OUT_ARGS
16851685
}
16861686

1687-
#ifdef _TARGET_ARM_
1687+
#ifdef _TARGET_ARMARCH_
16881688
// return size
16891689
// alignmentWB is out param
16901690
unsigned CodeGenInterface::InferOpSizeAlign(GenTreePtr op, unsigned* alignmentWB)
@@ -1724,19 +1724,22 @@ unsigned CodeGenInterface::InferStructOpSizeAlign(GenTreePtr op, unsigned* align
17241724
{
17251725
CORINFO_CLASS_HANDLE clsHnd = op->AsObj()->gtClass;
17261726
opSize = compiler->info.compCompHnd->getClassSize(clsHnd);
1727-
alignment = roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
1727+
alignment =
1728+
(unsigned)roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
17281729
}
17291730
else if (op->gtOper == GT_LCL_VAR)
17301731
{
17311732
unsigned varNum = op->gtLclVarCommon.gtLclNum;
17321733
LclVarDsc* varDsc = compiler->lvaTable + varNum;
17331734
assert(varDsc->lvType == TYP_STRUCT);
17341735
opSize = varDsc->lvSize();
1736+
#ifndef _TARGET_64BIT_
17351737
if (varDsc->lvStructDoubleAlign)
17361738
{
17371739
alignment = TARGET_POINTER_SIZE * 2;
17381740
}
17391741
else
1742+
#endif // !_TARGET_64BIT_
17401743
{
17411744
alignment = TARGET_POINTER_SIZE;
17421745
}
@@ -1750,13 +1753,13 @@ unsigned CodeGenInterface::InferStructOpSizeAlign(GenTreePtr op, unsigned* align
17501753
if (op2->IsIconHandle(GTF_ICON_CLASS_HDL))
17511754
{
17521755
CORINFO_CLASS_HANDLE clsHnd = (CORINFO_CLASS_HANDLE)op2->gtIntCon.gtIconVal;
1753-
opSize = roundUp(compiler->info.compCompHnd->getClassSize(clsHnd), TARGET_POINTER_SIZE);
1754-
alignment =
1755-
roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
1756+
opSize = (unsigned)roundUp(compiler->info.compCompHnd->getClassSize(clsHnd), TARGET_POINTER_SIZE);
1757+
alignment = (unsigned)roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd),
1758+
TARGET_POINTER_SIZE);
17561759
}
17571760
else
17581761
{
1759-
opSize = op2->gtIntCon.gtIconVal;
1762+
opSize = (unsigned)op2->gtIntCon.gtIconVal;
17601763
GenTreePtr op1 = op->gtOp.gtOp1;
17611764
assert(op1->OperGet() == GT_LIST);
17621765
GenTreePtr dstAddr = op1->gtOp.gtOp1;
@@ -1787,8 +1790,9 @@ unsigned CodeGenInterface::InferStructOpSizeAlign(GenTreePtr op, unsigned* align
17871790
{
17881791
CORINFO_CLASS_HANDLE clsHnd = op->gtArgPlace.gtArgPlaceClsHnd;
17891792
assert(clsHnd != 0);
1790-
opSize = roundUp(compiler->info.compCompHnd->getClassSize(clsHnd), TARGET_POINTER_SIZE);
1791-
alignment = roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
1793+
opSize = (unsigned)roundUp(compiler->info.compCompHnd->getClassSize(clsHnd), TARGET_POINTER_SIZE);
1794+
alignment =
1795+
(unsigned)roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
17921796
}
17931797
else
17941798
{
@@ -1804,7 +1808,7 @@ unsigned CodeGenInterface::InferStructOpSizeAlign(GenTreePtr op, unsigned* align
18041808
return opSize;
18051809
}
18061810

1807-
#endif // _TARGET_ARM_
1811+
#endif // _TARGET_ARMARCH_
18081812

18091813
/*****************************************************************************
18101814
*

src/jit/lclvars.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7300,13 +7300,13 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTreePtr* pTree, fgWalkData
73007300
// Calculate padding
73017301
unsigned padding = LCL_FLD_PADDING(lclNum);
73027302

7303-
#ifdef _TARGET_ARM_
7304-
// We need to support alignment requirements to access memory on ARM
7303+
#ifdef _TARGET_ARMARCH_
7304+
// We need to support alignment requirements to access memory on ARM ARCH
73057305
unsigned alignment = 1;
73067306
pComp->codeGen->InferOpSizeAlign(lcl, &alignment);
7307-
alignment = roundUp(alignment, TARGET_POINTER_SIZE);
7308-
padding = roundUp(padding, alignment);
7309-
#endif // _TARGET_ARM_
7307+
alignment = (unsigned)roundUp(alignment, TARGET_POINTER_SIZE);
7308+
padding = (unsigned)roundUp(padding, alignment);
7309+
#endif // _TARGET_ARMARCH_
73107310

73117311
// Change the variable to a TYP_BLK
73127312
if (varType != TYP_BLK)

0 commit comments

Comments
 (0)