Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,9 @@ void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)
// Make sure that idAddrUnion is just a union of various pointer sized things
C_ASSERT(sizeof(CORINFO_FIELD_HANDLE) <= sizeof(void*));
C_ASSERT(sizeof(CORINFO_METHOD_HANDLE) <= sizeof(void*));
#ifdef TARGET_XARCH
C_ASSERT(sizeof(emitter::emitAddrMode) <= sizeof(void*));
#endif // TARGET_XARCH
C_ASSERT(sizeof(emitLclVarAddr) <= sizeof(void*));
C_ASSERT(sizeof(emitter::instrDesc) == (SMALL_IDSC_SIZE + sizeof(void*)));

Expand Down Expand Up @@ -3185,11 +3187,13 @@ emitter::instrDesc* emitter::emitNewInstrCallInd(int argCnt,
if (!VarSetOps::IsEmpty(emitComp, GCvars) || // any frame GCvars live
(gcRefRegsInScratch) || // any register gc refs live in scratch regs
(byrefRegs != 0) || // any register byrefs live
(disp < AM_DISP_MIN) || // displacement too negative
(disp > AM_DISP_MAX) || // displacement too positive
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
#ifdef TARGET_XARCH
(disp < AM_DISP_MIN) || // displacement too negative
(disp > AM_DISP_MAX) || // displacement too positive
#endif // TARGET_XARCH
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
MULTIREG_HAS_SECOND_GC_RET_ONLY(|| EA_IS_GCREF_OR_BYREF(secondRetSize)))
{
instrDescCGCA* id;
Expand Down Expand Up @@ -3219,9 +3223,11 @@ emitter::instrDesc* emitter::emitNewInstrCallInd(int argCnt,
/* Make sure we didn't waste space unexpectedly */
assert(!id->idIsLargeCns());

#ifdef TARGET_XARCH
/* Store the displacement and make sure the value fit */
id->idAddr()->iiaAddrMode.amDisp = disp;
assert(id->idAddr()->iiaAddrMode.amDisp == disp);
#endif // TARGET_XARCH

/* Save the the live GC registers in the unused register fields */
emitEncodeCallGCregs(gcrefRegs, id);
Expand Down
12 changes: 9 additions & 3 deletions src/coreclr/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ class emitter
IF_COUNT
};

#ifdef TARGET_XARCH

#define AM_DISP_BITS ((sizeof(unsigned) * 8) - 2 * (REGNUM_BITS + 1) - 2)
#define AM_DISP_BIG_VAL (-(1 << (AM_DISP_BITS - 1)))
#define AM_DISP_MIN (-((1 << (AM_DISP_BITS - 1)) - 1))
Expand All @@ -537,6 +539,8 @@ class emitter
int amDisp : AM_DISP_BITS;
};

#endif // TARGET_XARCH

#ifdef DEBUG // This information is used in DEBUG builds to display the method name for call instructions

struct instrDesc;
Expand Down Expand Up @@ -813,10 +817,12 @@ class emitter
#ifndef TARGET_ARM64
emitLclVarAddr iiaLclVar;
#endif
BasicBlock* iiaBBlabel;
insGroup* iiaIGlabel;
BYTE* iiaAddr;
BasicBlock* iiaBBlabel;
insGroup* iiaIGlabel;
BYTE* iiaAddr;
#ifdef TARGET_XARCH
emitAddrMode iiaAddrMode;
#endif // TARGET_XARCH

CORINFO_FIELD_HANDLE iiaFieldHnd; // iiaFieldHandle is also used to encode
// an offset into the JIT data constant area
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emitarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4746,7 +4746,7 @@ void emitter::emitIns_Call(EmitCallType callType,
{
/* Indirect call, virtual calls */

id = emitNewInstrCallInd(argCnt, disp, ptrVars, gcrefRegs, byrefRegs, retSize);
id = emitNewInstrCallInd(argCnt, 0 /* disp */, ptrVars, gcrefRegs, byrefRegs, retSize);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emitarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8587,7 +8587,7 @@ void emitter::emitIns_Call(EmitCallType callType,
{
/* Indirect call, virtual calls */

id = emitNewInstrCallInd(argCnt, disp, ptrVars, gcrefRegs, byrefRegs, retSize, secondRetSize);
id = emitNewInstrCallInd(argCnt, 0 /* disp */, ptrVars, gcrefRegs, byrefRegs, retSize, secondRetSize);
}
else
{
Expand Down