diff --git a/src/coreclr/jit/emit.cpp b/src/coreclr/jit/emit.cpp index ba4ab8f7b6caab..c5ca3255d54fbf 100644 --- a/src/coreclr/jit/emit.cpp +++ b/src/coreclr/jit/emit.cpp @@ -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*))); @@ -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; @@ -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); diff --git a/src/coreclr/jit/emit.h b/src/coreclr/jit/emit.h index ade4f7c3ca2c12..47daad7798fc20 100644 --- a/src/coreclr/jit/emit.h +++ b/src/coreclr/jit/emit.h @@ -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)) @@ -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; @@ -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 diff --git a/src/coreclr/jit/emitarm.cpp b/src/coreclr/jit/emitarm.cpp index 0b11fcc742b263..7009826610fa10 100644 --- a/src/coreclr/jit/emitarm.cpp +++ b/src/coreclr/jit/emitarm.cpp @@ -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 { diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index 5aade83cbda17c..70d127ce3d1727 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -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 {