summaryrefslogtreecommitdiff
path: root/src/jit/codegenlegacy.cpp
diff options
context:
space:
mode:
authorEgor Chesakov <Egor.Chesakov@microsoft.com>2017-12-15 20:30:58 -0800
committerJan Kotas <jkotas@microsoft.com>2017-12-15 23:30:58 -0500
commitef74ed68fdb108ed9432c40eb2acae4bf7c35bd3 (patch)
treeb9c498403c3296680a0df372b2a522ac839bc6da /src/jit/codegenlegacy.cpp
parent3c958f345832f649889973e84bdac2f215a0d0e3 (diff)
downloadcoreclr-ef74ed68fdb108ed9432c40eb2acae4bf7c35bd3.tar.gz
coreclr-ef74ed68fdb108ed9432c40eb2acae4bf7c35bd3.tar.bz2
coreclr-ef74ed68fdb108ed9432c40eb2acae4bf7c35bd3.zip
Clean up clrjit from using sizeof(void*) when meant TARGET_POINTER_SIZE (#15524)
Diffstat (limited to 'src/jit/codegenlegacy.cpp')
-rw-r--r--src/jit/codegenlegacy.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index d741a446e7..1b430031c5 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -5090,11 +5090,12 @@ void CodeGen::genCodeForTreeLeaf(GenTreePtr tree, regMaskTP destReg, regMaskTP b
// The last slot is reserved for ICodeManager::FixContext(ppEndRegion)
unsigned filterEndOffsetSlotOffs;
PREFIX_ASSUME(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) >
- sizeof(void*)); // below doesn't underflow.
- filterEndOffsetSlotOffs = (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - (sizeof(void*)));
+ TARGET_POINTER_SIZE); // below doesn't underflow.
+ filterEndOffsetSlotOffs =
+ (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - TARGET_POINTER_SIZE);
unsigned curNestingSlotOffs;
- curNestingSlotOffs = filterEndOffsetSlotOffs - ((finallyNesting + 1) * sizeof(void*));
+ curNestingSlotOffs = filterEndOffsetSlotOffs - ((finallyNesting + 1) * TARGET_POINTER_SIZE);
instGen_Store_Imm_Into_Lcl(TYP_I_IMPL, EA_PTRSIZE, 0, compiler->lvaShadowSPslotsVar, curNestingSlotOffs);
reg = REG_STK;
break;
@@ -13047,14 +13048,14 @@ void CodeGen::genCodeForBBlist()
// The last slot is reserved for ICodeManager::FixContext(ppEndRegion)
unsigned filterEndOffsetSlotOffs;
filterEndOffsetSlotOffs =
- (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - (sizeof(void*)));
+ (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - TARGET_POINTER_SIZE);
unsigned curNestingSlotOffs;
- curNestingSlotOffs = (unsigned)(filterEndOffsetSlotOffs - ((finallyNesting + 1) * sizeof(void*)));
+ curNestingSlotOffs = (unsigned)(filterEndOffsetSlotOffs - ((finallyNesting + 1) * TARGET_POINTER_SIZE));
// Zero out the slot for the next nesting level
instGen_Store_Imm_Into_Lcl(TYP_I_IMPL, EA_PTRSIZE, 0, compiler->lvaShadowSPslotsVar,
- curNestingSlotOffs - sizeof(void*));
+ curNestingSlotOffs - TARGET_POINTER_SIZE);
instGen_Store_Imm_Into_Lcl(TYP_I_IMPL, EA_PTRSIZE, LCL_FINALLY_MARK, compiler->lvaShadowSPslotsVar,
curNestingSlotOffs);
@@ -15977,7 +15978,8 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
addrReg = 0;
// Get the number of BYTES to copy to the stack
- opsz = roundUp(compiler->info.compCompHnd->getClassSize(arg->gtObj.gtClass), sizeof(void*));
+ opsz = roundUp(compiler->info.compCompHnd->getClassSize(arg->gtObj.gtClass),
+ TARGET_POINTER_SIZE);
size_t bytesToBeCopied = opsz;
// postponedFields is true if we have any postponed fields
@@ -16020,14 +16022,14 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
if (fieldVarDsc->lvStackAligned())
{
if (fieldVarDsc->lvExactSize != 2 * sizeof(unsigned) &&
- fieldVarDsc->lvFldOffset + sizeof(void*) != bytesToBeCopied)
+ fieldVarDsc->lvFldOffset + TARGET_POINTER_SIZE != bytesToBeCopied)
{
// Might need 4-bytes paddings for fields other than LONG and DOUBLE.
// Just push some junk (i.e EAX) on the stack.
inst_RV(INS_push, REG_EAX, TYP_INT);
genSinglePush();
- bytesToBeCopied -= sizeof(void*);
+ bytesToBeCopied -= TARGET_POINTER_SIZE;
}
// If we have an expectedAlignedOffset make sure that this push instruction
@@ -16060,11 +16062,11 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
}
else
{
- getEmitter()->emitIns_S(INS_push, EA_4BYTE, varNum, sizeof(void*));
+ getEmitter()->emitIns_S(INS_push, EA_4BYTE, varNum, TARGET_POINTER_SIZE);
genSinglePush();
}
- bytesToBeCopied -= sizeof(void*);
+ bytesToBeCopied -= TARGET_POINTER_SIZE;
}
// Push the "upper half" of DOUBLE var if it is not enregistered.
@@ -16073,11 +16075,11 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
{
if (!fieldVarDsc->lvRegister)
{
- getEmitter()->emitIns_S(INS_push, EA_4BYTE, varNum, sizeof(void*));
+ getEmitter()->emitIns_S(INS_push, EA_4BYTE, varNum, TARGET_POINTER_SIZE);
genSinglePush();
}
- bytesToBeCopied -= sizeof(void*);
+ bytesToBeCopied -= TARGET_POINTER_SIZE;
}
//
@@ -16156,7 +16158,7 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
genSinglePush();
}
- bytesToBeCopied -= sizeof(void*);
+ bytesToBeCopied -= TARGET_POINTER_SIZE;
}
else // not stack aligned
{
@@ -16171,11 +16173,12 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
// This should never change until it is set back to UINT_MAX by an aligned
// offset
noway_assert(expectedAlignedOffset ==
- roundUp(fieldVarDsc->lvFldOffset, sizeof(void*)) - sizeof(void*));
+ roundUp(fieldVarDsc->lvFldOffset, TARGET_POINTER_SIZE) -
+ TARGET_POINTER_SIZE);
}
expectedAlignedOffset =
- roundUp(fieldVarDsc->lvFldOffset, sizeof(void*)) - sizeof(void*);
+ roundUp(fieldVarDsc->lvFldOffset, TARGET_POINTER_SIZE) - TARGET_POINTER_SIZE;
noway_assert(expectedAlignedOffset < bytesToBeCopied);
@@ -16302,8 +16305,8 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
noway_assert(arg->gtObj.gtOp1->InReg());
regNumber reg = arg->gtObj.gtOp1->gtRegNum;
// Get the number of DWORDS to copy to the stack
- opsz = roundUp(compiler->info.compCompHnd->getClassSize(arg->gtObj.gtClass), sizeof(void*));
- unsigned slots = (unsigned)(opsz / sizeof(void*));
+ opsz = roundUp(compiler->info.compCompHnd->getClassSize(arg->gtObj.gtClass), sizeof(DWORD));
+ unsigned slots = (unsigned)(opsz / sizeof(DWORD));
BYTE* gcLayout = new (compiler, CMK_Codegen) BYTE[slots];
@@ -16355,7 +16358,7 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
if (opsz & 0x4)
{
- stkDisp -= sizeof(void*);
+ stkDisp -= TARGET_POINTER_SIZE;
getEmitter()->emitIns_AR_R(INS_push, EA_4BYTE, REG_NA, reg, stkDisp);
genSinglePush();
}
@@ -16367,7 +16370,7 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
{
getEmitter()->emitIns_R_AR(INS_movq, EA_8BYTE, xmmReg, reg, curDisp);
getEmitter()->emitIns_AR_R(INS_movq, EA_8BYTE, xmmReg, REG_SPBASE, curDisp);
- curDisp += 2 * sizeof(void*);
+ curDisp += 2 * TARGET_POINTER_SIZE;
}
noway_assert(curDisp == stkDisp);
}
@@ -16385,7 +16388,7 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
noway_assert(gcLayout[i] == TYPE_GC_BYREF);
fieldSize = EA_BYREF;
}
- getEmitter()->emitIns_AR_R(INS_push, fieldSize, REG_NA, reg, i * sizeof(void*));
+ getEmitter()->emitIns_AR_R(INS_push, fieldSize, REG_NA, reg, i * TARGET_POINTER_SIZE);
genSinglePush();
}
}
@@ -19290,7 +19293,7 @@ regMaskTP CodeGen::genCodeForCall(GenTreeCall* call, bool valUsed)
/* Keep track of ESP for EBP-less frames */
genSinglePush();
- argSize += sizeof(void*);
+ argSize += REGSIZE_BYTES;
#elif defined(_TARGET_ARM_)
@@ -19683,16 +19686,16 @@ regMaskTP CodeGen::genCodeForCall(GenTreeCall* call, bool valUsed)
// Push the count of the incoming stack arguments
unsigned nOldStkArgs =
- (unsigned)((compiler->compArgSize - (intRegState.rsCalleeRegArgCount * sizeof(void*))) / sizeof(void*));
+ (unsigned)((compiler->compArgSize - (intRegState.rsCalleeRegArgCount * REGSIZE_BYTES)) / REGSIZE_BYTES);
getEmitter()->emitIns_I(INS_push, EA_4BYTE, nOldStkArgs);
genSinglePush(); // Keep track of ESP for EBP-less frames
- args += sizeof(void*);
+ args += REGSIZE_BYTES;
// Push the count of the outgoing stack arguments
- getEmitter()->emitIns_I(INS_push, EA_4BYTE, argSize / sizeof(void*));
+ getEmitter()->emitIns_I(INS_push, EA_4BYTE, argSize / REGSIZE_BYTES);
genSinglePush(); // Keep track of ESP for EBP-less frames
- args += sizeof(void*);
+ args += REGSIZE_BYTES;
// Push info about the callee-saved registers to be restored
// For now, we always spill all registers if compiler->compTailCallUsed
@@ -19701,13 +19704,13 @@ regMaskTP CodeGen::genCodeForCall(GenTreeCall* call, bool valUsed)
(fTailCallTargetIsVSD ? 0x2 : 0x0); // Stub dispatch flag
getEmitter()->emitIns_I(INS_push, EA_4BYTE, calleeSavedRegInfo);
genSinglePush(); // Keep track of ESP for EBP-less frames
- args += sizeof(void*);
+ args += REGSIZE_BYTES;
// Push the address of the target function
getEmitter()->emitIns_R(INS_push, EA_4BYTE, REG_TAILCALL_ADDR);
genSinglePush(); // Keep track of ESP for EBP-less frames
- args += sizeof(void*);
+ args += REGSIZE_BYTES;
#else // _TARGET_X86_