diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2016-03-31 10:02:12 -0700 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2016-03-31 11:10:26 -0700 |
commit | 1e9cadbd87fffbb4342a5090941b349a4d0a2fd9 (patch) | |
tree | b162bd2ca1cfe6dfed2dae0d61ac9e0745bc52a8 | |
parent | 4e2b9b6be2b59a2cbf6663cccd6bc1b6091f6eac (diff) | |
download | coreclr-1e9cadbd87fffbb4342a5090941b349a4d0a2fd9.tar.gz coreclr-1e9cadbd87fffbb4342a5090941b349a4d0a2fd9.tar.bz2 coreclr-1e9cadbd87fffbb4342a5090941b349a4d0a2fd9.zip |
Replace uses of _WIN64 with _HOST_64BIT_.
This terminology is more accurate. This change also corrects
a few bits of code that were making target-related decisions
based on the host's bitness.
-rw-r--r-- | src/jit/_typeinfo.h | 16 | ||||
-rw-r--r-- | src/jit/bitsetasshortlong.h | 2 | ||||
-rw-r--r-- | src/jit/codegencommon.cpp | 4 | ||||
-rw-r--r-- | src/jit/disasm.cpp | 4 | ||||
-rw-r--r-- | src/jit/disasm.h | 6 | ||||
-rw-r--r-- | src/jit/gentree.h | 4 | ||||
-rw-r--r-- | src/jit/instr.h | 8 | ||||
-rw-r--r-- | src/jit/jit.h | 11 | ||||
-rw-r--r-- | src/jit/jiteh.cpp | 2 | ||||
-rw-r--r-- | src/jit/morph.cpp | 2 | ||||
-rw-r--r-- | src/jit/typeinfo.cpp | 4 | ||||
-rw-r--r-- | src/jit/vartype.h | 2 |
12 files changed, 44 insertions, 21 deletions
diff --git a/src/jit/_typeinfo.h b/src/jit/_typeinfo.h index 23bf5c6b4c..c71294a8b8 100644 --- a/src/jit/_typeinfo.h +++ b/src/jit/_typeinfo.h @@ -312,6 +312,17 @@ private: CORINFO_METHOD_HANDLE m_method; }; + template<typename T> + static bool isInvalidHandle(const T handle) + { + static_assert(std::is_same<T, CORINFO_CLASS_HANDLE>::value || std::is_same<T, CORINFO_METHOD_HANDLE>::value, ""); +#ifdef _HOST_64BIT_ + return handle == reinterpret_cast<T>(0xcccccccccccccccc); +#else + return handle == reinterpret_cast<T>(0xcccccccc); +#endif + } + public: typeInfo():m_flags(TI_ERROR) { @@ -345,7 +356,7 @@ public: typeInfo(ti_types tiType, CORINFO_CLASS_HANDLE cls, bool typeVar = false) { assert(tiType == TI_STRUCT || tiType == TI_REF); - assert(cls != 0 && cls != CORINFO_CLASS_HANDLE(NOT_WIN64(0xcccccccc) WIN64_ONLY(0xcccccccccccccccc))); + assert(cls != 0 && !isInvalidHandle(cls)); m_flags = tiType; if (typeVar) m_flags |= TI_FLAG_GENERIC_TYPE_VAR; @@ -354,8 +365,7 @@ public: typeInfo(CORINFO_METHOD_HANDLE method) { - assert(method != 0 && method != CORINFO_METHOD_HANDLE(NOT_WIN64(0xcccccccc) - WIN64_ONLY(0xcccccccccccccccc))); + assert(method != 0 && !isInvalidHandle(method)); m_flags = TI_METHOD; m_method = method; } diff --git a/src/jit/bitsetasshortlong.h b/src/jit/bitsetasshortlong.h index b67cac0278..d81872eba3 100644 --- a/src/jit/bitsetasshortlong.h +++ b/src/jit/bitsetasshortlong.h @@ -432,7 +432,7 @@ public: { DWORD nextBit; BOOL hasBit; -#ifdef _WIN64 +#ifdef _HOST_64BIT_ static_assert_no_msg(sizeof(size_t) == 8); hasBit = BitScanForward64(&nextBit, m_bits); #else diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp index 4f8f8a9584..2349994ac4 100644 --- a/src/jit/codegencommon.cpp +++ b/src/jit/codegencommon.cpp @@ -4799,7 +4799,7 @@ void CodeGen::genFnPrologCalleeRegArgs(regNumber xtraReg, noway_assert(varDsc->lvIsParam && varDsc->lvIsRegArg); -#ifndef _WIN64 +#ifndef _TARGET_64BIT_ //Right now we think that incoming arguments are not pointer sized. When we eventually //understand the calling convention... this still won't be true. But maybe we'll have a better //idea of how to ignore it. @@ -4807,7 +4807,7 @@ void CodeGen::genFnPrologCalleeRegArgs(regNumber xtraReg, // On Arm, a long can be passed in register noway_assert(genTypeSize(genActualType(varDsc->TypeGet())) == sizeof(void *)); #endif -#endif //_WIN64 +#endif //_TARGET_64BIT_ noway_assert(varDsc->lvIsInReg() && !regArgTab[argNum].circular); diff --git a/src/jit/disasm.cpp b/src/jit/disasm.cpp index 9b8e0c3c47..28c03dc497 100644 --- a/src/jit/disasm.cpp +++ b/src/jit/disasm.cpp @@ -1314,7 +1314,9 @@ void DisAssembler::DisasmBuffer(FILE* pfile, return; } - WIN64_ONLY(pdis->SetAddr64(true)); +#ifdef _TARGET_64BIT_ + pdis->SetAddr64(true); +#endif // Store a pointer to the DisAssembler so that the callback functions // can get to it. diff --git a/src/jit/disasm.h b/src/jit/disasm.h index df2a797a42..18f40c3cc4 100644 --- a/src/jit/disasm.h +++ b/src/jit/disasm.h @@ -57,17 +57,17 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /*****************************************************************************/ -#ifdef _WIN64 +#ifdef _HOST_64BIT_ template<typename T> struct SizeTKeyFuncs: LargePrimitiveKeyFuncs<T> { }; -#else // !_WIN64 +#else // !_HOST_64BIT_ template<typename T> struct SizeTKeyFuncs: SmallPrimitiveKeyFuncs<T> { }; -#endif // !_WIN64 +#endif // _HOST_64BIT_ typedef SimplerHashTable<size_t, SizeTKeyFuncs<size_t>, CORINFO_METHOD_HANDLE, DefaultSimplerHashBehavior> AddrToMethodHandleMap; typedef SimplerHashTable<size_t, SizeTKeyFuncs<size_t>, size_t, DefaultSimplerHashBehavior> AddrToAddrMap; diff --git a/src/jit/gentree.h b/src/jit/gentree.h index d95c473e17..eb3bba52a7 100644 --- a/src/jit/gentree.h +++ b/src/jit/gentree.h @@ -247,7 +247,7 @@ struct GenTreeArgList; /*****************************************************************************/ -#ifndef _WIN64 +#ifndef _HOST_64BIT_ #include <pshpack4.h> #endif @@ -3748,7 +3748,7 @@ inline var_types& GenTree::CastToType() { return this->gtCast.gtCastType; } /*****************************************************************************/ -#ifndef _WIN64 +#ifndef _HOST_64BIT_ #include <poppack.h> #endif diff --git a/src/jit/instr.h b/src/jit/instr.h index ff73dd4a80..0a0e9326ff 100644 --- a/src/jit/instr.h +++ b/src/jit/instr.h @@ -246,8 +246,12 @@ DECLARE_TYPED_ENUM(emitAttr,unsigned) EA_32BYTE = 0x020, EA_SIZE_MASK = 0x03F, - EA_PTRSIZE = NOT_WIN64(EA_4BYTE) - WIN64_ONLY(EA_8BYTE), +#ifdef _TARGET_64BIT_ + EA_PTRSIZE = EA_8BYTE, +#else + EA_PTRSIZE = EA_4BYTE, +#endif + EA_OFFSET_FLG = 0x040, EA_OFFSET = EA_OFFSET_FLG | EA_PTRSIZE, /* size == 0 */ EA_GCREF_FLG = 0x080, diff --git a/src/jit/jit.h b/src/jit/jit.h index bfdb195e28..59863a41ae 100644 --- a/src/jit/jit.h +++ b/src/jit/jit.h @@ -90,6 +90,10 @@ #error Unsupported or unset host architecture #endif +#if defined(_HOST_AMD64_) || defined(_HOST_ARM64_) + #define _HOST_64BIT_ +#endif + #if defined(_TARGET_X86_) #if defined(_TARGET_ARM_) #error Cannot define both _TARGET_X86_ and _TARGET_ARM_ @@ -786,8 +790,11 @@ extern int jitNativeCode(CORINFO_METHOD_HANDLE methodHnd, void * inlineInfoPtr ); -const size_t DEAD_BEEF = NOT_WIN64(0xDEADBEEF) - WIN64_ONLY(0xDEADBEEFDEADBEEF); +#ifdef _HOST_64BIT_ +const size_t INVALID_POINTER_VALUE = 0xFEEDFACEABADF00D; +#else +const size_t INVALID_POINTER_VALUE = 0xFEEDFACE; +#endif // Constants for making sure size_t fit into smaller types. const size_t MAX_USHORT_SIZE_T = static_cast<size_t>(static_cast<unsigned short>(-1)); diff --git a/src/jit/jiteh.cpp b/src/jit/jiteh.cpp index 70c591ab90..531c17170f 100644 --- a/src/jit/jiteh.cpp +++ b/src/jit/jiteh.cpp @@ -1323,7 +1323,7 @@ void Compiler::fgRemoveEHTableEntry(unsigned XTnum) if (compHndBBtabCount == 0) { // No more entries remaining. - INDEBUG(compHndBBtab = (EHblkDsc *)DEAD_BEEF;) + INDEBUG(compHndBBtab = (EHblkDsc *)INVALID_POINTER_VALUE;) } else { diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 93f3aca7da..5be082dc98 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -13912,7 +13912,7 @@ void Compiler::fgMorphStmts(BasicBlock * block, #endif #ifdef DEBUG - compCurBB = (BasicBlock*)DEAD_BEEF; + compCurBB = (BasicBlock*)INVALID_POINTER_VALUE; #endif // Reset this back so that it doesn't leak out impacting other blocks diff --git a/src/jit/typeinfo.cpp b/src/jit/typeinfo.cpp index 13f23e1c14..097ad10cdf 100644 --- a/src/jit/typeinfo.cpp +++ b/src/jit/typeinfo.cpp @@ -217,7 +217,7 @@ BOOL typeInfo::tiCompatibleWith (COMP_HANDLE CompHnd, return tiCompatibleWithByRef(CompHnd, child, parent); } #ifdef _TARGET_64BIT_ - // In WIN64 we have precise representation for native int, so these rules + // On 64-bit targets we have precise representation for native int, so these rules // represent the fact that the ECMA spec permits the implicit conversion // between an int32 and a native int. else if (parent.IsType(TI_INT) && typeInfo::AreEquivalent(nativeInt(), child)) @@ -348,7 +348,7 @@ BOOL typeInfo::tiMergeToCommonParent (COMP_HANDLE CompHnd, typeInfo return tiCompatibleWithByRef(CompHnd, *pSrc, *pDest); } #ifdef _TARGET_64BIT_ - // In WIN64 we have precise representation for native int, so these rules + // On 64-bit targets we have precise representation for native int, so these rules // represent the fact that the ECMA spec permits the implicit conversion // between an int32 and a native int. else if (typeInfo::AreEquivalent(*pDest, typeInfo::nativeInt()) && pSrc->IsType(TI_INT)) diff --git a/src/jit/vartype.h b/src/jit/vartype.h index db358dad77..82ddd51f39 100644 --- a/src/jit/vartype.h +++ b/src/jit/vartype.h @@ -37,7 +37,7 @@ END_DECLARE_TYPED_ENUM(var_types,BYTE) * platform */ -#ifdef _WIN64 +#ifdef _TARGET_64BIT_ #define TYP_I_IMPL TYP_LONG #define TYP_U_IMPL TYP_ULONG #define TYPE_REF_IIM TYPE_REF_LNG |