From 3c6bee8b1ec083ad0dac77dc1e5b4c005565118e Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 11 May 2021 10:06:04 +0300 Subject: [PATCH 1/4] Replaces all BOOL to bool in RyuJIT Replaced all Windows' BOOL to bool in RyuJIT except for WIN API related cases. Fix #48317 --- src/coreclr/jit/_typeinfo.h | 46 ++++++++++++++--------------- src/coreclr/jit/bitsetasshortlong.h | 2 +- src/coreclr/jit/compiler.h | 36 +++++++++++----------- src/coreclr/jit/compiler.hpp | 4 +-- src/coreclr/jit/disasm.cpp | 2 +- src/coreclr/jit/ee_il_dll.cpp | 2 +- src/coreclr/jit/error.cpp | 2 +- src/coreclr/jit/fgbasic.cpp | 2 +- src/coreclr/jit/gcencode.cpp | 10 +++---- src/coreclr/jit/gentree.cpp | 6 ++-- src/coreclr/jit/host.h | 2 +- src/coreclr/jit/importer.cpp | 30 +++++++++---------- src/coreclr/jit/jithashtable.h | 2 +- src/coreclr/jit/lclvars.cpp | 4 +-- src/coreclr/jit/target.h | 4 +-- src/coreclr/jit/typeinfo.cpp | 42 +++++++++++++------------- src/coreclr/jit/unwind.h | 4 +-- src/coreclr/jit/unwindamd64.cpp | 4 +-- src/coreclr/jit/unwindarm.cpp | 6 ++-- src/coreclr/jit/unwindx86.cpp | 4 +-- 20 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/coreclr/jit/_typeinfo.h b/src/coreclr/jit/_typeinfo.h index 26173db3fae49..93782beb984c7 100644 --- a/src/coreclr/jit/_typeinfo.h +++ b/src/coreclr/jit/_typeinfo.h @@ -443,13 +443,13 @@ class typeInfo } #endif // DEBUG - static BOOL tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const typeInfo* pSrc, bool* changed); - static BOOL tiCompatibleWith(COMP_HANDLE CompHnd, + static bool tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const typeInfo* pSrc, bool* changed); + static bool tiCompatibleWith(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent, bool normalisedForStack); - static BOOL tiMergeCompatibleWith(COMP_HANDLE CompHnd, + static bool tiMergeCompatibleWith(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent, bool normalisedForStack); @@ -603,7 +603,7 @@ class typeInfo return (ti_types)(m_flags & TI_FLAG_DATA_MASK); } - BOOL IsType(ti_types type) const + bool IsType(ti_types type) const { assert(type != TI_ERROR); return (m_flags & (TI_FLAG_DATA_MASK | TI_FLAG_BYREF | TI_FLAG_BYREF_READONLY | TI_FLAG_BYREF_PERMANENT_HOME | @@ -611,58 +611,58 @@ class typeInfo } // Returns whether this is an objref - BOOL IsObjRef() const + bool IsObjRef() const { return IsType(TI_REF) || IsType(TI_NULL); } // Returns whether this is a by-ref - BOOL IsByRef() const + bool IsByRef() const { return (m_flags & TI_FLAG_BYREF); } // Returns whether this is the this pointer - BOOL IsThisPtr() const + bool IsThisPtr() const { return (m_flags & TI_FLAG_THIS_PTR); } - BOOL IsUnboxedGenericTypeVar() const + bool IsUnboxedGenericTypeVar() const { return !IsByRef() && (m_flags & TI_FLAG_GENERIC_TYPE_VAR); } - BOOL IsReadonlyByRef() const + bool IsReadonlyByRef() const { return IsByRef() && (m_flags & TI_FLAG_BYREF_READONLY); } - BOOL IsPermanentHomeByRef() const + bool IsPermanentHomeByRef() const { return IsByRef() && (m_flags & TI_FLAG_BYREF_PERMANENT_HOME); } // Returns whether this is a method desc - BOOL IsMethod() const + bool IsMethod() const { return GetType() == TI_METHOD; } - BOOL IsStruct() const + bool IsStruct() const { return IsType(TI_STRUCT); } // A byref value class is NOT a value class - BOOL IsValueClass() const + bool IsValueClass() const { return (IsStruct() || IsPrimitiveType()); } // Does not return true for primitives. Will return true for value types that behave // as primitives - BOOL IsValueClassWithClsHnd() const + bool IsValueClassWithClsHnd() const { if ((GetType() == TI_STRUCT) || (m_cls && GetType() != TI_REF && GetType() != TI_METHOD && @@ -680,7 +680,7 @@ class typeInfo // NOTE: Use NormaliseToPrimitiveType() if you think you may have a // System.Int32 etc., because those types are not considered number // types by this function. - BOOL IsNumberType() const + bool IsNumberType() const { ti_types Type = GetType(); @@ -694,7 +694,7 @@ class typeInfo // NOTE: Use NormaliseToPrimitiveType() if you think you may have a // System.Int32 etc., because those types are not considered number // types by this function. - BOOL IsIntegerType() const + bool IsIntegerType() const { ti_types Type = GetType(); @@ -705,7 +705,7 @@ class typeInfo } // Returns true whether this is an integer or a native int. - BOOL IsIntOrNativeIntType() const + bool IsIntOrNativeIntType() const { #ifdef TARGET_64BIT return (GetType() == TI_INT) || AreEquivalent(*this, nativeInt()); @@ -714,7 +714,7 @@ class typeInfo #endif } - BOOL IsNativeIntType() const + bool IsNativeIntType() const { return AreEquivalent(*this, nativeInt()); } @@ -722,7 +722,7 @@ class typeInfo // Returns whether this is a primitive type (not a byref, objref, // array, null, value class, invalid value) // May Need to normalise first (m/r/I4 --> I4) - BOOL IsPrimitiveType() const + bool IsPrimitiveType() const { DWORD Type = GetType(); @@ -732,7 +732,7 @@ class typeInfo } // Returns whether this is the null objref - BOOL IsNullObjRef() const + bool IsNullObjRef() const { return (IsType(TI_NULL)); } @@ -740,17 +740,17 @@ class typeInfo // must be for a local which is an object type (i.e. has a slot >= 0) // for primitive locals, use the liveness bitmap instead // Note that this works if the error is 'Byref' - BOOL IsDead() const + bool IsDead() const { return (m_flags & (TI_FLAG_DATA_MASK)) == TI_ERROR; } - BOOL IsUninitialisedObjRef() const + bool IsUninitialisedObjRef() const { return (m_flags & TI_FLAG_UNINIT_OBJREF); } - BOOL IsToken() const + bool IsToken() const { return IsMethod() && ((m_flags & TI_FLAG_TOKEN) != 0); } diff --git a/src/coreclr/jit/bitsetasshortlong.h b/src/coreclr/jit/bitsetasshortlong.h index 0eda55e1e1058..dce54d6a5ca3a 100644 --- a/src/coreclr/jit/bitsetasshortlong.h +++ b/src/coreclr/jit/bitsetasshortlong.h @@ -509,7 +509,7 @@ class BitSetOps -inline BOOL genMaxOneBit(T value) +inline bool genMaxOneBit(T value) { return (value & (value - 1)) == 0; } @@ -164,7 +164,7 @@ inline BOOL genMaxOneBit(T value) * Return true if the given 32-bit value has exactly zero or one bits set. */ -inline BOOL genMaxOneBit(unsigned value) +inline bool genMaxOneBit(unsigned value) { return (value & (value - 1)) == 0; } diff --git a/src/coreclr/jit/disasm.cpp b/src/coreclr/jit/disasm.cpp index 3d900a20b4602..9a91b457107d7 100644 --- a/src/coreclr/jit/disasm.cpp +++ b/src/coreclr/jit/disasm.cpp @@ -1197,7 +1197,7 @@ size_t CbDisassembleWithBytes(DIS* pdis, DIS::ADDR addr, const BYTE* pb, size_t for (pwzBytes = wzBytes; pwzBytes != NULL; pwzBytes = pwzNext) { - BOOL fFirst = (pwzBytes == wzBytes); + bool fFirst = (pwzBytes == wzBytes); cchBytes = wcslen(pwzBytes); diff --git a/src/coreclr/jit/ee_il_dll.cpp b/src/coreclr/jit/ee_il_dll.cpp index 3c4ce8bc8eef2..ab9ca0ca97d01 100644 --- a/src/coreclr/jit/ee_il_dll.cpp +++ b/src/coreclr/jit/ee_il_dll.cpp @@ -1015,7 +1015,7 @@ void Compiler::eeDispLineInfos() * (e.g., host AMD64, target ARM64), then VM will get confused anyway. */ -void Compiler::eeReserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwindSize) +void Compiler::eeReserveUnwindInfo(bool isFunclet, bool isColdCode, ULONG unwindSize) { #ifdef DEBUG if (verbose) diff --git a/src/coreclr/jit/error.cpp b/src/coreclr/jit/error.cpp index 2aec1be24da74..36aef2c5a0e4b 100644 --- a/src/coreclr/jit/error.cpp +++ b/src/coreclr/jit/error.cpp @@ -323,7 +323,7 @@ extern "C" void __cdecl assertAbort(const char* why, const char* file, unsigned } /*********************************************************************/ -BOOL vlogf(unsigned level, const char* fmt, va_list args) +bool vlogf(unsigned level, const char* fmt, va_list args) { return JitTls::GetLogEnv()->compHnd->logMsg(level, fmt, args); } diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 7992d3b696a31..6b1293b31c582 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -3091,7 +3091,7 @@ void Compiler::fgCheckBasicBlockControlFlow() * Consider removing this check here if we can do it cheaply during importing */ -void Compiler::fgControlFlowPermitted(BasicBlock* blkSrc, BasicBlock* blkDest, BOOL isLeave) +void Compiler::fgControlFlowPermitted(BasicBlock* blkSrc, BasicBlock* blkDest, bool isLeave) { assert(!fgNormalizeEHDone); // These rules aren't quite correct after EH normalization has introduced new blocks diff --git a/src/coreclr/jit/gcencode.cpp b/src/coreclr/jit/gcencode.cpp index 3c4007c6ad10b..575a89af5f0b8 100644 --- a/src/coreclr/jit/gcencode.cpp +++ b/src/coreclr/jit/gcencode.cpp @@ -2160,7 +2160,7 @@ size_t GCInfo::gcMakeRegPtrTable(BYTE* dest, int mask, const InfoHdr& header, un /* Start computing the total size of the table */ - BOOL emitArgTabOffset = (header.varPtrTableSize != 0 || header.untrackedCnt > SET_UNTRACKED_MAX); + bool emitArgTabOffset = (header.varPtrTableSize != 0 || header.untrackedCnt > SET_UNTRACKED_MAX); if (mask != 0 && emitArgTabOffset) { assert(*pArgTabOffset <= MAX_UNSIGNED_SIZE_T); @@ -4670,7 +4670,7 @@ void GCInfo::gcInfoRecordGCRegStateChange(GcInfoEncoder* gcInfoEncoder, } else { - BOOL b = m_regSlotMap->Lookup(rskey, ®SlotId); + bool b = m_regSlotMap->Lookup(rskey, ®SlotId); assert(b); // Should have been added in the first pass. gcInfoEncoderWithLog->SetSlotState(instrOffset, regSlotId, newState); } @@ -4770,7 +4770,7 @@ void GCInfo::gcMakeVarPtrTable(GcInfoEncoder* gcInfoEncoder, MakeRegPtrMode mode } else { - BOOL b = m_stackSlotMap->Lookup(sskey, &varSlotId); + bool b = m_stackSlotMap->Lookup(sskey, &varSlotId); assert(b); // Should have been added in the first pass. // Live from the beginning to the end. gcInfoEncoderWithLog->SetSlotState(begOffs, varSlotId, GC_SLOT_LIVE); @@ -4805,7 +4805,7 @@ void GCInfo::gcInfoRecordGCStackArgLive(GcInfoEncoder* gcInfoEncoder, MakeRegPtr } else { - BOOL b = m_stackSlotMap->Lookup(sskey, &varSlotId); + bool b = m_stackSlotMap->Lookup(sskey, &varSlotId); assert(b); // Should have been added in the first pass. // Live until the call. gcInfoEncoderWithLog->SetSlotState(genStackPtr->rpdOffs, varSlotId, GC_SLOT_LIVE); @@ -4843,7 +4843,7 @@ void GCInfo::gcInfoRecordGCStackArgsDead(GcInfoEncoder* gcInfoEncoder, StackSlotIdKey sskey(genRegPtrTemp->rpdPtrArg, FALSE, genRegPtrTemp->rpdGCtypeGet() == GCT_BYREF ? GC_SLOT_INTERIOR : GC_SLOT_BASE); GcSlotId varSlotId; - BOOL b = m_stackSlotMap->Lookup(sskey, &varSlotId); + bool b = m_stackSlotMap->Lookup(sskey, &varSlotId); assert(b); // Should have been added in the first pass. // Live until the call. gcInfoEncoderWithLog->SetSlotState(instrOffset, varSlotId, GC_SLOT_DEAD); diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 6548e15896629..82b4f7e8baca9 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -7387,10 +7387,10 @@ GenTree* Compiler::gtNewBitCastNode(var_types type, GenTree* arg) // Returns GT_ALLOCOBJ node that will be later morphed into an // allocation helper call or local variable allocation on the stack. -GenTreeAllocObj* Compiler::gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedToken, BOOL useParent) +GenTreeAllocObj* Compiler::gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool useParent) { - const BOOL mustRestoreHandle = TRUE; - BOOL* const pRuntimeLookup = nullptr; + const bool mustRestoreHandle = true; + bool* const pRuntimeLookup = nullptr; bool usingReadyToRunHelper = false; CorInfoHelpFunc helper = CORINFO_HELP_UNDEF; GenTree* opHandle = impTokenToHandle(pResolvedToken, pRuntimeLookup, mustRestoreHandle, useParent); diff --git a/src/coreclr/jit/host.h b/src/coreclr/jit/host.h index ea9abdddcc9c4..bf699a3c7777a 100644 --- a/src/coreclr/jit/host.h +++ b/src/coreclr/jit/host.h @@ -25,7 +25,7 @@ class LogEnv Compiler* const compiler; }; -BOOL vlogf(unsigned level, const char* fmt, va_list args); +bool vlogf(unsigned level, const char* fmt, va_list args); int vflogf(FILE* file, const char* fmt, va_list args); int logf(const char* fmt, ...); diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index c3bf24ce6d006..24a74e53c4a99 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -1974,9 +1974,9 @@ GenTree* Compiler::impNormStructVal(GenTree* structVal, // at compile-time. // GenTree* Compiler::impTokenToHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, - BOOL* pRuntimeLookup /* = NULL */, - BOOL mustRestoreHandle /* = FALSE */, - BOOL importParent /* = FALSE */) + bool* pRuntimeLookup /* = NULL */, + bool mustRestoreHandle /* = FALSE */, + bool importParent /* = FALSE */) { assert(!fgGlobalMorph); @@ -5912,7 +5912,7 @@ void Compiler::verVerifyCall(OPCODE opcode, if (actualMethodAttribs & CORINFO_FLG_PROTECTED) { - BOOL targetIsStatic = actualMethodAttribs & CORINFO_FLG_STATIC; + bool targetIsStatic = actualMethodAttribs & CORINFO_FLG_STATIC; Verify(targetIsStatic || !isOpenDelegate, "Unverifiable creation of an open instance delegate for a protected member."); @@ -6181,8 +6181,8 @@ typeInfo Compiler::verVerifyLDIND(const typeInfo& ptr, const typeInfo& instrType void Compiler::verVerifyField(CORINFO_RESOLVED_TOKEN* pResolvedToken, const CORINFO_FIELD_INFO& fieldInfo, const typeInfo* tiThis, - BOOL mutator, - BOOL allowPlainStructAsThis) + bool mutator, + bool allowPlainStructAsThis) { CORINFO_CLASS_HANDLE enclosingClass = pResolvedToken->hClass; unsigned fieldFlags = fieldInfo.fieldFlags; @@ -6716,7 +6716,7 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken) // the opcode stack becomes empty impBoxTempInUse = true; - const BOOL useParent = FALSE; + const bool useParent = false; op1 = gtNewAllocObjNode(pResolvedToken, useParent); if (op1 == nullptr) { @@ -7433,7 +7433,7 @@ GenTree* Compiler::impInitClass(CORINFO_RESOLVED_TOKEN* pResolvedToken) { return nullptr; } - BOOL runtimeLookup; + bool runtimeLookup; GenTree* node = impParentClassTokenToHandle(pResolvedToken, &runtimeLookup); @@ -8716,7 +8716,7 @@ var_types Compiler::impImportCall(OPCODE opcode, assert(opcode != CEE_CALLI); GenTree* instParam; - BOOL runtimeLookup; + bool runtimeLookup; // Instantiated generic method if (((SIZE_T)exactContextHnd & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_METHOD) @@ -14306,7 +14306,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) } else { - const BOOL useParent = TRUE; + const bool useParent = true; op1 = gtNewAllocObjNode(&resolvedToken, useParent); if (op1 == nullptr) { @@ -14544,8 +14544,8 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_LDSFLDA: { - BOOL isLoadAddress = (opcode == CEE_LDFLDA || opcode == CEE_LDSFLDA); - BOOL isLoadStatic = (opcode == CEE_LDSFLD || opcode == CEE_LDSFLDA); + bool isLoadAddress = (opcode == CEE_LDFLDA || opcode == CEE_LDSFLDA); + bool isLoadStatic = (opcode == CEE_LDSFLD || opcode == CEE_LDSFLDA); /* Get the CP_Fieldref index */ assertImp(sz == sizeof(unsigned)); @@ -14640,7 +14640,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (tiVerificationNeeded) { // You can also pass the unboxed struct to LDFLD - BOOL bAllowPlainValueTypeAsThis = FALSE; + bool bAllowPlainValueTypeAsThis = FALSE; if (opcode == CEE_LDFLD && impIsValueType(tiObj)) { bAllowPlainValueTypeAsThis = TRUE; @@ -14921,7 +14921,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_STSFLD: { - BOOL isStoreStatic = (opcode == CEE_STSFLD); + bool isStoreStatic = (opcode == CEE_STSFLD); CORINFO_CLASS_HANDLE fieldClsHnd; // class of the field (if it's a ref type) @@ -15706,7 +15706,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) JITDUMP(" %08X", resolvedToken.token); - BOOL runtimeLookup; + bool runtimeLookup; op2 = impTokenToHandle(&resolvedToken, &runtimeLookup); if (op2 == nullptr) { diff --git a/src/coreclr/jit/jithashtable.h b/src/coreclr/jit/jithashtable.h index 3713c4a19195d..636916239f440 100644 --- a/src/coreclr/jit/jithashtable.h +++ b/src/coreclr/jit/jithashtable.h @@ -555,7 +555,7 @@ class JitHashTable // begin - `true` to construct an "begin" iterator, // `false` to construct an "end" iterator // - KeyIterator(const JitHashTable* hash, BOOL begin) + KeyIterator(const JitHashTable* hash, bool begin) : m_table(hash->m_table) , m_node(nullptr) , m_tableSize(hash->m_tableSizeInfo.prime) diff --git a/src/coreclr/jit/lclvars.cpp b/src/coreclr/jit/lclvars.cpp index bd02935a4f7f6..372833bc9335a 100644 --- a/src/coreclr/jit/lclvars.cpp +++ b/src/coreclr/jit/lclvars.cpp @@ -2853,9 +2853,9 @@ void Compiler::lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, bool } #ifndef TARGET_64BIT - BOOL fDoubleAlignHint = FALSE; + bool fDoubleAlignHint = false; #ifdef TARGET_X86 - fDoubleAlignHint = TRUE; + fDoubleAlignHint = true; #endif if (info.compCompHnd->getClassAlignmentRequirement(typeHnd, fDoubleAlignHint) == 8) diff --git a/src/coreclr/jit/target.h b/src/coreclr/jit/target.h index 3c6b4970fb146..2317ce20cf1b1 100644 --- a/src/coreclr/jit/target.h +++ b/src/coreclr/jit/target.h @@ -1635,12 +1635,12 @@ extern void dspRegMask(regMaskTP regMask, size_t minSiz = 0); #endif #if CPU_HAS_BYTE_REGS -inline BOOL isByteReg(regNumber reg) +inline bool isByteReg(regNumber reg) { return (reg <= REG_EBX); } #else -inline BOOL isByteReg(regNumber reg) +inline bool isByteReg(regNumber reg) { return true; } diff --git a/src/coreclr/jit/typeinfo.cpp b/src/coreclr/jit/typeinfo.cpp index ea63e3af3d2db..d90d81b00cf64 100644 --- a/src/coreclr/jit/typeinfo.cpp +++ b/src/coreclr/jit/typeinfo.cpp @@ -158,7 +158,7 @@ static BOOL tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, co * */ -BOOL typeInfo::tiCompatibleWith(COMP_HANDLE CompHnd, +bool typeInfo::tiCompatibleWith(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent, bool normalisedForStack) @@ -168,28 +168,28 @@ BOOL typeInfo::tiCompatibleWith(COMP_HANDLE CompHnd, if (typeInfo::AreEquivalent(child, parent)) { - return TRUE; + return true; } if (parent.IsUnboxedGenericTypeVar() || child.IsUnboxedGenericTypeVar()) { - return (FALSE); // need to have had child == parent + return false; // need to have had child == parent } else if (parent.IsType(TI_REF)) { // An uninitialized objRef is not compatible to initialized. if (child.IsUninitialisedObjRef() && !parent.IsUninitialisedObjRef()) { - return FALSE; + return false; } if (child.IsNullObjRef()) { // NULL can be any reference type - return TRUE; + return true; } if (!child.IsType(TI_REF)) { - return FALSE; + return false; } return CompHnd->canCast(child.m_cls, parent.m_cls); @@ -198,17 +198,17 @@ BOOL typeInfo::tiCompatibleWith(COMP_HANDLE CompHnd, { if (!child.IsType(TI_METHOD)) { - return FALSE; + return false; } // Right now we don't bother merging method handles - return FALSE; + return false; } else if (parent.IsType(TI_STRUCT)) { if (!child.IsType(TI_STRUCT)) { - return FALSE; + return false; } // Structures are compatible if they are equivalent @@ -224,24 +224,24 @@ BOOL typeInfo::tiCompatibleWith(COMP_HANDLE CompHnd, // between an int32 and a native int. else if (parent.IsType(TI_INT) && typeInfo::AreEquivalent(nativeInt(), child)) { - return TRUE; + return true; } else if (typeInfo::AreEquivalent(nativeInt(), parent) && child.IsType(TI_INT)) { - return TRUE; + return true; } #endif // TARGET_64BIT - return FALSE; + return false; } -BOOL typeInfo::tiMergeCompatibleWith(COMP_HANDLE CompHnd, +bool typeInfo::tiMergeCompatibleWith(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent, bool normalisedForStack) { if (!child.IsPermanentHomeByRef() && parent.IsPermanentHomeByRef()) { - return FALSE; + return false; } return typeInfo::tiCompatibleWith(CompHnd, child, parent, normalisedForStack); @@ -280,7 +280,7 @@ BOOL typeInfo::tiMergeCompatibleWith(COMP_HANDLE CompHnd, * */ -BOOL typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const typeInfo* pSrc, bool* changed) +bool typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const typeInfo* pSrc, bool* changed) { assert(pSrc->IsDead() || typeInfo::AreEquivalent(::NormaliseForStack(*pSrc), *pSrc)); assert(pDest->IsDead() || typeInfo::AreEquivalent(::NormaliseForStack(*pDest), *pDest)); @@ -311,7 +311,7 @@ BOOL typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const // OK the main event. Merge the main types if (typeInfo::AreEquivalent(*pDest, *pSrc)) { - return (TRUE); + return true; } if (pDest->IsUnboxedGenericTypeVar() || pSrc->IsUnboxedGenericTypeVar()) @@ -323,7 +323,7 @@ BOOL typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const { if (pSrc->IsType(TI_NULL)) { // NULL can be any reference type - return TRUE; + return true; } if (!pSrc->IsType(TI_REF)) { @@ -337,7 +337,7 @@ BOOL typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const { *changed = true; } - return TRUE; + return true; } else if (pDest->IsType(TI_NULL)) { @@ -367,19 +367,19 @@ BOOL typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const // between an int32 and a native int. else if (typeInfo::AreEquivalent(*pDest, typeInfo::nativeInt()) && pSrc->IsType(TI_INT)) { - return TRUE; + return true; } else if (typeInfo::AreEquivalent(*pSrc, typeInfo::nativeInt()) && pDest->IsType(TI_INT)) { *pDest = *pSrc; *changed = true; - return TRUE; + return true; } #endif // TARGET_64BIT FAIL: *pDest = typeInfo(); - return FALSE; + return false; } #ifdef DEBUG diff --git a/src/coreclr/jit/unwind.h b/src/coreclr/jit/unwind.h index f510eb6f1d822..c578c30cb78d0 100644 --- a/src/coreclr/jit/unwind.h +++ b/src/coreclr/jit/unwind.h @@ -661,7 +661,7 @@ class UnwindFragmentInfo : public UnwindBase ufiPrologCodes.GetFinalInfo(ppUnwindBlock, pUnwindBlockSize); } - void Reserve(BOOL isFunclet, bool isHotCode); + void Reserve(bool isFunclet, bool isHotCode); void Allocate( CorJitFuncKind funKind, void* pHotCode, void* pColdCode, UNATIVE_OFFSET funcEndOffset, bool isHotCode); @@ -738,7 +738,7 @@ class UnwindInfo : public UnwindBase static void EmitSplitCallback(void* context, emitLocation* emitLoc); - void Reserve(BOOL isFunclet, bool isHotCode); + void Reserve(bool isFunclet, bool isHotCode); void Allocate(CorJitFuncKind funKind, void* pHotCode, void* pColdCode, bool isHotCode); diff --git a/src/coreclr/jit/unwindamd64.cpp b/src/coreclr/jit/unwindamd64.cpp index 927400ad4e1d6..caaf7c2dbe29b 100644 --- a/src/coreclr/jit/unwindamd64.cpp +++ b/src/coreclr/jit/unwindamd64.cpp @@ -712,8 +712,8 @@ void Compiler::unwindReserveFuncHelper(FuncInfoDsc* func, bool isHotCode) } } - BOOL isFunclet = (func->funKind != FUNC_ROOT); - BOOL isColdCode = isHotCode ? FALSE : TRUE; + bool isFunclet = (func->funKind != FUNC_ROOT); + bool isColdCode = !isHotCode; eeReserveUnwindInfo(isFunclet, isColdCode, unwindCodeBytes); } diff --git a/src/coreclr/jit/unwindarm.cpp b/src/coreclr/jit/unwindarm.cpp index 4ca2b3db5e254..e26d6e008f0bd 100644 --- a/src/coreclr/jit/unwindarm.cpp +++ b/src/coreclr/jit/unwindarm.cpp @@ -1615,13 +1615,13 @@ void UnwindFragmentInfo::Finalize(UNATIVE_OFFSET functionLength) // The unwind code words are already here, following the header, so we're done! } -void UnwindFragmentInfo::Reserve(BOOL isFunclet, bool isHotCode) +void UnwindFragmentInfo::Reserve(bool isFunclet, bool isHotCode) { assert(isHotCode || !isFunclet); // TODO-CQ: support hot/cold splitting in functions with EH MergeCodes(); - BOOL isColdCode = isHotCode ? FALSE : TRUE; + bool isColdCode = !isHotCode; ULONG unwindSize = Size(); @@ -1958,7 +1958,7 @@ void UnwindInfo::Split() // Reserve space for the unwind info for all fragments -void UnwindInfo::Reserve(BOOL isFunclet, bool isHotCode) +void UnwindInfo::Reserve(bool isFunclet, bool isHotCode) { assert(uwiInitialized == UWI_INITIALIZED_PATTERN); assert(isHotCode || !isFunclet); diff --git a/src/coreclr/jit/unwindx86.cpp b/src/coreclr/jit/unwindx86.cpp index fa6cbe8eeb5dd..aba58bc93b322 100644 --- a/src/coreclr/jit/unwindx86.cpp +++ b/src/coreclr/jit/unwindx86.cpp @@ -131,8 +131,8 @@ void Compiler::unwindReserveFunc(FuncInfoDsc* func) // void Compiler::unwindReserveFuncHelper(FuncInfoDsc* func, bool isHotCode) { - BOOL isFunclet = (func->funKind != FUNC_ROOT); - BOOL isColdCode = isHotCode ? FALSE : TRUE; + bool isFunclet = (func->funKind != FUNC_ROOT); + bool isColdCode = !isHotCode; eeReserveUnwindInfo(isFunclet, isColdCode, sizeof(UNWIND_INFO)); } From 7424de9d4501f1327e4f2e21492a990c0e190f87 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 11 May 2021 10:19:04 +0300 Subject: [PATCH 2/4] Replaced `TRUE` and `FALSE` constants Replaced `TRUE` with `true` and `FALSE` with `false` constants in RyuJIT except Windows-specific cases. --- src/coreclr/jit/_typeinfo.h | 4 +-- src/coreclr/jit/compiler.h | 12 ++++---- src/coreclr/jit/ee_il_dll.cpp | 4 +-- src/coreclr/jit/emit.cpp | 24 +++++++-------- src/coreclr/jit/fgbasic.cpp | 2 +- src/coreclr/jit/fgdiagnostic.cpp | 2 +- src/coreclr/jit/gcencode.cpp | 4 +-- src/coreclr/jit/gcinfo.cpp | 2 +- src/coreclr/jit/gschecks.cpp | 2 +- src/coreclr/jit/importer.cpp | 52 ++++++++++++++++---------------- src/coreclr/jit/jiteh.cpp | 2 +- src/coreclr/jit/jithashtable.h | 4 +-- src/coreclr/jit/lclvars.cpp | 2 +- src/coreclr/jit/morph.cpp | 2 +- src/coreclr/jit/simd.cpp | 2 +- src/coreclr/jit/typeinfo.cpp | 14 ++++----- 16 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/coreclr/jit/_typeinfo.h b/src/coreclr/jit/_typeinfo.h index 93782beb984c7..1ff10193edc93 100644 --- a/src/coreclr/jit/_typeinfo.h +++ b/src/coreclr/jit/_typeinfo.h @@ -668,11 +668,11 @@ class typeInfo (m_cls && GetType() != TI_REF && GetType() != TI_METHOD && GetType() != TI_ERROR)) // necessary because if byref bit is set, we return TI_ERROR) { - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 9223b59bc87e7..ecd192854ee47 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -4162,14 +4162,14 @@ class Compiler GenTree* impTokenToHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool* pRuntimeLookup = nullptr, - bool mustRestoreHandle = FALSE, - bool importParent = FALSE); + bool mustRestoreHandle = false, + bool importParent = false); GenTree* impParentClassTokenToHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool* pRuntimeLookup = nullptr, - bool mustRestoreHandle = FALSE) + bool mustRestoreHandle = false) { - return impTokenToHandle(pResolvedToken, pRuntimeLookup, mustRestoreHandle, TRUE); + return impTokenToHandle(pResolvedToken, pRuntimeLookup, mustRestoreHandle, true); } GenTree* impLookupToTree(CORINFO_RESOLVED_TOKEN* pResolvedToken, @@ -10123,7 +10123,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX void verInitCurrentState(); void verResetCurrentState(BasicBlock* block, EntryState* currentState); - // Merges the current verification state into the entry state of "block", return FALSE if that merge fails, + // Merges the current verification state into the entry state of "block", return false if that merge fails, // TRUE if it succeeds. Further sets "*changed" to true if this changes the entry state of "block". bool verMergeEntryStates(BasicBlock* block, bool* changed); @@ -10174,7 +10174,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX const CORINFO_FIELD_INFO& fieldInfo, const typeInfo* tiThis, bool mutator, - bool allowPlainStructAsThis = FALSE); + bool allowPlainStructAsThis = false); void verVerifyCond(const typeInfo& tiOp1, const typeInfo& tiOp2, unsigned opcode); void verVerifyThisPtrInitialised(); bool verIsCallToInitThisPtr(CORINFO_CLASS_HANDLE context, CORINFO_CLASS_HANDLE target); diff --git a/src/coreclr/jit/ee_il_dll.cpp b/src/coreclr/jit/ee_il_dll.cpp index ab9ca0ca97d01..cc1a70b51945d 100644 --- a/src/coreclr/jit/ee_il_dll.cpp +++ b/src/coreclr/jit/ee_il_dll.cpp @@ -1020,8 +1020,8 @@ void Compiler::eeReserveUnwindInfo(bool isFunclet, bool isColdCode, ULONG unwind #ifdef DEBUG if (verbose) { - printf("reserveUnwindInfo(isFunclet=%s, isColdCode=%s, unwindSize=0x%x)\n", isFunclet ? "TRUE" : "FALSE", - isColdCode ? "TRUE" : "FALSE", unwindSize); + printf("reserveUnwindInfo(isFunclet=%s, isColdCode=%s, unwindSize=0x%x)\n", isFunclet ? "true" : "false", + isColdCode ? "true" : "false", unwindSize); } #endif // DEBUG diff --git a/src/coreclr/jit/emit.cpp b/src/coreclr/jit/emit.cpp index b485b0f90cf21..d4dd337ea6936 100644 --- a/src/coreclr/jit/emit.cpp +++ b/src/coreclr/jit/emit.cpp @@ -7351,8 +7351,8 @@ void emitter::emitGCregLiveSet(GCtype gcType, regMaskTP regMask, BYTE* addr, boo regPtrNext->rpdGCtype = gcType; regPtrNext->rpdOffs = emitCurCodeOffs(addr); - regPtrNext->rpdArg = FALSE; - regPtrNext->rpdCall = FALSE; + regPtrNext->rpdArg = false; + regPtrNext->rpdCall = false; regPtrNext->rpdIsThis = isThis; regPtrNext->rpdCompiler.rpdAdd = (regMaskSmall)regMask; regPtrNext->rpdCompiler.rpdDel = 0; @@ -7381,9 +7381,9 @@ void emitter::emitGCregDeadSet(GCtype gcType, regMaskTP regMask, BYTE* addr) regPtrNext->rpdGCtype = gcType; regPtrNext->rpdOffs = emitCurCodeOffs(addr); - regPtrNext->rpdCall = FALSE; - regPtrNext->rpdIsThis = FALSE; - regPtrNext->rpdArg = FALSE; + regPtrNext->rpdCall = false; + regPtrNext->rpdIsThis = false; + regPtrNext->rpdArg = false; regPtrNext->rpdCompiler.rpdAdd = 0; regPtrNext->rpdCompiler.rpdDel = (regMaskSmall)regMask; } @@ -7740,12 +7740,12 @@ void emitter::emitGCvarLiveUpd(int offs, int varNum, GCtype gcType, BYTE* addr D regPtrDsc* regPtrNext = gcInfo->gcRegPtrAllocDsc(); regPtrNext->rpdGCtype = gcType; regPtrNext->rpdOffs = emitCurCodeOffs(addr); - regPtrNext->rpdArg = TRUE; - regPtrNext->rpdCall = FALSE; + regPtrNext->rpdArg = true; + regPtrNext->rpdCall = false; noway_assert(FitsIn(offs)); regPtrNext->rpdPtrArg = (unsigned short)offs; regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH; - regPtrNext->rpdIsThis = FALSE; + regPtrNext->rpdIsThis = false; } } else @@ -8202,15 +8202,15 @@ void emitter::emitStackPushLargeStk(BYTE* addr, GCtype gcType, unsigned count) regPtrNext->rpdGCtype = gcType; regPtrNext->rpdOffs = emitCurCodeOffs(addr); - regPtrNext->rpdArg = TRUE; - regPtrNext->rpdCall = FALSE; + regPtrNext->rpdArg = true; + regPtrNext->rpdCall = false; if (level.IsOverflow() || !FitsIn(level.Value())) { IMPL_LIMITATION("Too many/too big arguments to encode GC information"); } regPtrNext->rpdPtrArg = (unsigned short)level.Value(); regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH; - regPtrNext->rpdIsThis = FALSE; + regPtrNext->rpdIsThis = false; } /* This is an "interesting" argument push */ @@ -8340,7 +8340,7 @@ void emitter::emitStackPopLargeStk(BYTE* addr, bool isCall, unsigned char callIn #endif regPtrNext->rpdCallGCrefRegs = gcrefRegs; regPtrNext->rpdCallByrefRegs = byrefRegs; - regPtrNext->rpdArg = TRUE; + regPtrNext->rpdArg = true; regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_POP; regPtrNext->rpdPtrArg = argRecCnt.Value(); } diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 6b1293b31c582..8925091d6372d 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -3058,7 +3058,7 @@ void Compiler::fgCheckBasicBlockControlFlow() case BBJ_LEAVE: // block always jumps to the target, maybe out of guarded // region. Used temporarily until importing - fgControlFlowPermitted(blk, blk->bbJumpDest, TRUE); + fgControlFlowPermitted(blk, blk->bbJumpDest, true); break; diff --git a/src/coreclr/jit/fgdiagnostic.cpp b/src/coreclr/jit/fgdiagnostic.cpp index 3aefdcbb434f3..599d9cbd49fb7 100644 --- a/src/coreclr/jit/fgdiagnostic.cpp +++ b/src/coreclr/jit/fgdiagnostic.cpp @@ -2714,7 +2714,7 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef #ifndef JIT32_GCENCODER copiedForGenericsCtxt = ((info.compMethodInfo->options & CORINFO_GENERICS_CTXT_FROM_THIS) != 0); #else // JIT32_GCENCODER - copiedForGenericsCtxt = FALSE; + copiedForGenericsCtxt = false; #endif // JIT32_GCENCODER // This if only in support of the noway_asserts it contains. diff --git a/src/coreclr/jit/gcencode.cpp b/src/coreclr/jit/gcencode.cpp index 575a89af5f0b8..8c5fcd65b046d 100644 --- a/src/coreclr/jit/gcencode.cpp +++ b/src/coreclr/jit/gcencode.cpp @@ -4792,7 +4792,7 @@ void GCInfo::gcInfoRecordGCStackArgLive(GcInfoEncoder* gcInfoEncoder, MakeRegPtr GCENCODER_WITH_LOGGING(gcInfoEncoderWithLog, gcInfoEncoder); - StackSlotIdKey sskey(genStackPtr->rpdPtrArg, FALSE, + StackSlotIdKey sskey(genStackPtr->rpdPtrArg, false, GcSlotFlags(genStackPtr->rpdGCtypeGet() == GCT_BYREF ? GC_SLOT_INTERIOR : GC_SLOT_BASE)); GcSlotId varSlotId; if (mode == MAKE_REG_PTR_MODE_ASSIGN_SLOTS) @@ -4840,7 +4840,7 @@ void GCInfo::gcInfoRecordGCStackArgsDead(GcInfoEncoder* gcInfoEncoder, assert(genRegPtrTemp->rpdGCtypeGet() != GCT_NONE); assert(genRegPtrTemp->rpdArgTypeGet() == rpdARG_PUSH); - StackSlotIdKey sskey(genRegPtrTemp->rpdPtrArg, FALSE, + StackSlotIdKey sskey(genRegPtrTemp->rpdPtrArg, false, genRegPtrTemp->rpdGCtypeGet() == GCT_BYREF ? GC_SLOT_INTERIOR : GC_SLOT_BASE); GcSlotId varSlotId; bool b = m_stackSlotMap->Lookup(sskey, &varSlotId); diff --git a/src/coreclr/jit/gcinfo.cpp b/src/coreclr/jit/gcinfo.cpp index b75ddb1d86fb4..1b4d50fe875c5 100644 --- a/src/coreclr/jit/gcinfo.cpp +++ b/src/coreclr/jit/gcinfo.cpp @@ -328,7 +328,7 @@ GCInfo::regPtrDsc* GCInfo::gcRegPtrAllocDsc() regPtrNext = new (compiler, CMK_GC) regPtrDsc; - regPtrNext->rpdIsThis = FALSE; + regPtrNext->rpdIsThis = false; regPtrNext->rpdOffs = 0; regPtrNext->rpdNext = nullptr; diff --git a/src/coreclr/jit/gschecks.cpp b/src/coreclr/jit/gschecks.cpp index 9bf4207eb0bb8..3dc60f8e12d9a 100644 --- a/src/coreclr/jit/gschecks.cpp +++ b/src/coreclr/jit/gschecks.cpp @@ -333,7 +333,7 @@ bool Compiler::gsFindVulnerableParams() for (UINT lclNum = assignGroup->bitVectGetFirst(); lclNum != (unsigned)-1; lclNum = assignGroup->bitVectGetNext(lclNum)) { - lvaTable[lclNum].lvIsPtr = TRUE; + lvaTable[lclNum].lvIsPtr = true; propagated->bitVectSet(lclNum); } diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 24a74e53c4a99..f1beb1bcee8f5 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -1975,8 +1975,8 @@ GenTree* Compiler::impNormStructVal(GenTree* structVal, // GenTree* Compiler::impTokenToHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool* pRuntimeLookup /* = NULL */, - bool mustRestoreHandle /* = FALSE */, - bool importParent /* = FALSE */) + bool mustRestoreHandle /* = false */, + bool importParent /* = false */) { assert(!fgGlobalMorph); @@ -2626,7 +2626,7 @@ inline void Compiler::impSpillSideEffects(bool spillGlobEffects, unsigned chkLev GenTree* lclVarTree; if ((tree->gtFlags & spillFlags) != 0 || - (spillGlobEffects && // Only consider the following when spillGlobEffects == TRUE + (spillGlobEffects && // Only consider the following when spillGlobEffects == true !impIsAddressInLocal(tree, &lclVarTree) && // No need to spill the GT_ADDR node on a local. gtHasLocalsWithAddrOp(tree))) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or // lvAddrTaken flag. @@ -4018,7 +4018,7 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis, JITDUMP("Optimizing constrained box-this obj.getType() to direct type construction\n"); impPopStack(); GenTree* typeHandleOp = - impTokenToHandle(pConstrainedResolvedToken, nullptr, TRUE /* mustRestoreHandle */); + impTokenToHandle(pConstrainedResolvedToken, nullptr, true /* mustRestoreHandle */); if (typeHandleOp == nullptr) { assert(compDonotInline()); @@ -6174,7 +6174,7 @@ typeInfo Compiler::verVerifyLDIND(const typeInfo& ptr, const typeInfo& instrType } // Verify that the field is used properly. 'tiThis' is NULL for statics, -// 'fieldFlags' is the fields attributes, and mutator is TRUE if it is a +// 'fieldFlags' is the fields attributes, and mutator is true if it is a // ld*flda or a st*fld. // 'enclosingClass' is given if we are accessing a field in some specific type. @@ -6287,7 +6287,7 @@ void Compiler::verVerifyCond(const typeInfo& tiOp1, const typeInfo& tiOp2, unsig case CEE_CGT_UN: break; default: - Verify(FALSE, "Cond not allowed on object types"); + Verify(false, "Cond not allowed on object types"); } Verify(tiOp2.IsObjRef(), "Cond type mismatch"); } @@ -6794,7 +6794,7 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken) assert(operCls != nullptr); // Ensure that the value class is restored - op2 = impTokenToHandle(pResolvedToken, nullptr, TRUE /* mustRestoreHandle */); + op2 = impTokenToHandle(pResolvedToken, nullptr, true /* mustRestoreHandle */); if (op2 == nullptr) { // We must be backing out of an inline. @@ -8230,7 +8230,7 @@ var_types Compiler::impImportCall(OPCODE opcode, constraintCallThisTransform = callInfo->thisTransform; exactContextHnd = callInfo->contextHandle; - exactContextNeedsRuntimeLookup = callInfo->exactContextNeedsRuntimeLookup == TRUE; + exactContextNeedsRuntimeLookup = callInfo->exactContextNeedsRuntimeLookup; switch (callInfo->kind) { @@ -8748,7 +8748,7 @@ var_types Compiler::impImportCall(OPCODE opcode, } else { - instParam = impTokenToHandle(pResolvedToken, &runtimeLookup, TRUE /*mustRestoreHandle*/); + instParam = impTokenToHandle(pResolvedToken, &runtimeLookup, true /*mustRestoreHandle*/); if (instParam == nullptr) { assert(compDonotInline()); @@ -8803,12 +8803,12 @@ var_types Compiler::impImportCall(OPCODE opcode, // because pResolvedToken is an interface method and interface types make a poor generic context. if (pConstrainedResolvedToken) { - instParam = impTokenToHandle(pConstrainedResolvedToken, &runtimeLookup, TRUE /*mustRestoreHandle*/, - FALSE /* importParent */); + instParam = impTokenToHandle(pConstrainedResolvedToken, &runtimeLookup, true /*mustRestoreHandle*/, + false /* importParent */); } else { - instParam = impParentClassTokenToHandle(pResolvedToken, &runtimeLookup, TRUE /*mustRestoreHandle*/); + instParam = impParentClassTokenToHandle(pResolvedToken, &runtimeLookup, true /*mustRestoreHandle*/); } if (instParam == nullptr) @@ -14640,10 +14640,10 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (tiVerificationNeeded) { // You can also pass the unboxed struct to LDFLD - bool bAllowPlainValueTypeAsThis = FALSE; + bool bAllowPlainValueTypeAsThis = false; if (opcode == CEE_LDFLD && impIsValueType(tiObj)) { - bAllowPlainValueTypeAsThis = TRUE; + bAllowPlainValueTypeAsThis = true; } verVerifyField(&resolvedToken, fieldInfo, tiObj, isLoadAddress, bAllowPlainValueTypeAsThis); @@ -14995,7 +14995,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (tiVerificationNeeded) { - verVerifyField(&resolvedToken, fieldInfo, tiObj, TRUE); + verVerifyField(&resolvedToken, fieldInfo, tiObj, true); typeInfo fieldType = verMakeTypeInfo(ciType, fieldClsHnd); Verify(tiCompatibleWith(tiVal, fieldType.NormaliseForStack(), true), "type mismatch"); } @@ -15267,7 +15267,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (!opts.IsReadyToRun()) { // Need to restore array classes before creating array objects on the heap - op1 = impTokenToHandle(&resolvedToken, nullptr, TRUE /*mustRestoreHandle*/); + op1 = impTokenToHandle(&resolvedToken, nullptr, true /*mustRestoreHandle*/); if (op1 == nullptr) { // compDonotInline() return; @@ -15330,7 +15330,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) // Reason: performance (today, we'll always use the slow helper for the R2R generics case) // Need to restore array classes before creating array objects on the heap - op1 = impTokenToHandle(&resolvedToken, nullptr, TRUE /*mustRestoreHandle*/); + op1 = impTokenToHandle(&resolvedToken, nullptr, true /*mustRestoreHandle*/); if (op1 == nullptr) { // compDonotInline() return; @@ -15489,7 +15489,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (!opts.IsReadyToRun()) { - op2 = impTokenToHandle(&resolvedToken, nullptr, FALSE); + op2 = impTokenToHandle(&resolvedToken, nullptr, false); if (op2 == nullptr) { // compDonotInline() return; @@ -15536,7 +15536,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) // 3) Perform the 'is instance' check on the input object // Reason: performance (today, we'll always use the slow helper for the R2R generics case) - op2 = impTokenToHandle(&resolvedToken, nullptr, FALSE); + op2 = impTokenToHandle(&resolvedToken, nullptr, false); if (op2 == nullptr) { // compDonotInline() return; @@ -15661,7 +15661,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) tokenType = info.compCompHnd->getTokenTypeAsHandle(&resolvedToken); - op1 = impTokenToHandle(&resolvedToken, nullptr, TRUE); + op1 = impTokenToHandle(&resolvedToken, nullptr, true); if (op1 == nullptr) { // compDonotInline() return; @@ -16077,7 +16077,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) if (!opts.IsReadyToRun()) { - op2 = impTokenToHandle(&resolvedToken, nullptr, FALSE); + op2 = impTokenToHandle(&resolvedToken, nullptr, false); if (op2 == nullptr) { // compDonotInline() return; @@ -16131,7 +16131,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) // 3) Check the object on the stack for the type-cast // Reason: performance (today, we'll always use the slow helper for the R2R generics case) - op2 = impTokenToHandle(&resolvedToken, nullptr, FALSE); + op2 = impTokenToHandle(&resolvedToken, nullptr, false); if (op2 == nullptr) { // compDonotInline() return; @@ -16440,7 +16440,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) JITDUMP(" %08X", resolvedToken.token); - op2 = impTokenToHandle(&resolvedToken, nullptr, TRUE); + op2 = impTokenToHandle(&resolvedToken, nullptr, true); if (op2 == nullptr) { // compDonotInline() return; @@ -18494,7 +18494,7 @@ StackEntry* BasicBlock::bbStackOnEntry() void Compiler::verInitCurrentState() { - verTrackObjCtorInitState = FALSE; + verTrackObjCtorInitState = false; verCurrentState.thisInitialized = TIS_Bottom; if (tiVerificationNeeded) @@ -18502,7 +18502,7 @@ void Compiler::verInitCurrentState() // Track this ptr initialization if (!info.compIsStatic && (info.compFlags & CORINFO_FLG_CONSTRUCTOR) && lvaTable[0].lvVerTypeInfo.IsObjRef()) { - verTrackObjCtorInitState = TRUE; + verTrackObjCtorInitState = true; verCurrentState.thisInitialized = TIS_Uninit; } } @@ -18759,7 +18759,7 @@ bool Compiler::impIsValueType(typeInfo* pTypeInfo) * Check to see if the tree is the address of a local or the address of a field in a local. - *lclVarTreeOut will contain the GT_LCL_VAR tree when it returns TRUE. + *lclVarTreeOut will contain the GT_LCL_VAR tree when it returns true. */ diff --git a/src/coreclr/jit/jiteh.cpp b/src/coreclr/jit/jiteh.cpp index 3fefd70ab921b..f0adcfce6be18 100644 --- a/src/coreclr/jit/jiteh.cpp +++ b/src/coreclr/jit/jiteh.cpp @@ -3761,7 +3761,7 @@ void Compiler::verInsertEhNodeInTree(EHNodeDsc** ppRoot, EHNodeDsc* node) node->ehnChild = nullptr; node->ehnEquivalent = nullptr; - while (TRUE) + while (true) { if (*ppRoot == nullptr) { diff --git a/src/coreclr/jit/jithashtable.h b/src/coreclr/jit/jithashtable.h index 636916239f440..5b95afbd899ca 100644 --- a/src/coreclr/jit/jithashtable.h +++ b/src/coreclr/jit/jithashtable.h @@ -351,14 +351,14 @@ class JitHashTable // Get an iterator to the first key in the table. KeyIterator Begin() const { - KeyIterator i(this, TRUE); + KeyIterator i(this, true); return i; } // Get an iterator following the last key in the table. KeyIterator End() const { - return KeyIterator(this, FALSE); + return KeyIterator(this, false); } // Get the number of keys currently stored in the table. diff --git a/src/coreclr/jit/lclvars.cpp b/src/coreclr/jit/lclvars.cpp index 372833bc9335a..ff08e26067dd9 100644 --- a/src/coreclr/jit/lclvars.cpp +++ b/src/coreclr/jit/lclvars.cpp @@ -565,7 +565,7 @@ void Compiler::lvaInitRetBuffArg(InitVarDscInfo* varDscInfo, bool useFixedRetBuf assert(JITtype2varType(sigInfo.retType) == info.compRetType); // Else shouldn't have a ret buff. info.compRetBuffDefStack = - (info.compCompHnd->isStructRequiringStackAllocRetBuf(sigInfo.retTypeClass) == TRUE); + (info.compCompHnd->isStructRequiringStackAllocRetBuf(sigInfo.retTypeClass)); if (info.compRetBuffDefStack) { // If we're assured that the ret buff argument points into a callers stack, we will type it as diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index a241aac24647d..69a70508aaae0 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -8522,7 +8522,7 @@ GenTree* Compiler::getVirtMethodPointerTree(GenTree* thisPtr, GenTree* Compiler::getTokenHandleTree(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool parent) { CORINFO_GENERICHANDLE_RESULT embedInfo; - info.compCompHnd->embedGenericHandle(pResolvedToken, parent ? TRUE : FALSE, &embedInfo); + info.compCompHnd->embedGenericHandle(pResolvedToken, parent, &embedInfo); GenTree* result = getLookupTree(pResolvedToken, &embedInfo.lookup, gtTokenToIconFlags(pResolvedToken->token), embedInfo.compileTimeHandle); diff --git a/src/coreclr/jit/simd.cpp b/src/coreclr/jit/simd.cpp index 582e3b70bede0..ecded3a159a61 100644 --- a/src/coreclr/jit/simd.cpp +++ b/src/coreclr/jit/simd.cpp @@ -271,7 +271,7 @@ CorInfoType Compiler::getBaseJitTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeH WCHAR className[256] = {0}; WCHAR* pbuf = &className[0]; int len = _countof(className); - info.compCompHnd->appendClassName((char16_t**)&pbuf, &len, typeHnd, TRUE, FALSE, FALSE); + info.compCompHnd->appendClassName((char16_t**)&pbuf, &len, typeHnd, true, false, false); noway_assert(pbuf < &className[256]); JITDUMP("SIMD Candidate Type %S\n", className); diff --git a/src/coreclr/jit/typeinfo.cpp b/src/coreclr/jit/typeinfo.cpp index d90d81b00cf64..38ad9e00ee82d 100644 --- a/src/coreclr/jit/typeinfo.cpp +++ b/src/coreclr/jit/typeinfo.cpp @@ -77,7 +77,7 @@ bool Compiler::tiMergeToCommonParent(typeInfo* pDest, const typeInfo* pSrc, bool if (VERBOSE && tiVerificationNeeded) { printf(TI_DUMP_PADDING); - printf((mergeable == TRUE) ? "Merge successful" : "Couldn't merge types"); + printf(mergeable ? "Merge successful" : "Couldn't merge types"); if (*changed) { assert(mergeable); @@ -98,12 +98,12 @@ static BOOL tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, co if (!child.IsByRef()) { - return FALSE; + return false; } if (child.IsReadonlyByRef() && !parent.IsReadonlyByRef()) { - return FALSE; + return false; } // Byrefs are compatible if the underlying types are equivalent @@ -112,7 +112,7 @@ static BOOL tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, co if (typeInfo::AreEquivalent(childTarget, parentTarget)) { - return TRUE; + return true; } // Make sure that both types have a valid m_cls @@ -122,7 +122,7 @@ static BOOL tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, co return CompHnd->areTypesEquivalent(childTarget.GetClassHandle(), parentTarget.GetClassHandle()); } - return FALSE; + return false; } /***************************************************************************** @@ -345,7 +345,7 @@ bool typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const { *pDest = *pSrc; *changed = true; - return TRUE; + return true; } goto FAIL; } @@ -353,7 +353,7 @@ bool typeInfo::tiMergeToCommonParent(COMP_HANDLE CompHnd, typeInfo* pDest, const { if (pSrc->IsType(TI_STRUCT) && CompHnd->areTypesEquivalent(pDest->GetClassHandle(), pSrc->GetClassHandle())) { - return TRUE; + return true; } goto FAIL; } From b512a356f448f6a6e71311daa7f8259eef2bdb30 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 11 May 2021 11:12:35 +0300 Subject: [PATCH 3/4] A couple of BOOLs replaced to bool --- src/coreclr/jit/compiler.h | 2 +- src/coreclr/jit/typeinfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index ecd192854ee47..d82c27937c957 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -2966,7 +2966,7 @@ class Compiler GenTreeAllocObj* gtNewAllocObjNode( unsigned int helper, bool helperHasSideEffects, CORINFO_CLASS_HANDLE clsHnd, var_types type, GenTree* op1); - GenTreeAllocObj* gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedToken, BOOL useParent); + GenTreeAllocObj* gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool useParent); GenTree* gtNewRuntimeLookup(CORINFO_GENERIC_HANDLE hnd, CorInfoGenericHandleType hndTyp, GenTree* lookupTree); diff --git a/src/coreclr/jit/typeinfo.cpp b/src/coreclr/jit/typeinfo.cpp index 38ad9e00ee82d..07809e57268a2 100644 --- a/src/coreclr/jit/typeinfo.cpp +++ b/src/coreclr/jit/typeinfo.cpp @@ -92,7 +92,7 @@ bool Compiler::tiMergeToCommonParent(typeInfo* pDest, const typeInfo* pSrc, bool return mergeable; } -static BOOL tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent) +static bool tiCompatibleWithByRef(COMP_HANDLE CompHnd, const typeInfo& child, const typeInfo& parent) { assert(parent.IsByRef()); From 0f473102cdbf393292bcbeda266e833af4221866 Mon Sep 17 00:00:00 2001 From: WhiteBlackGoose Date: Tue, 11 May 2021 19:06:06 +0300 Subject: [PATCH 4/4] Format issue fixed Formatting patch applied according to the instruction. --- src/coreclr/jit/lclvars.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/jit/lclvars.cpp b/src/coreclr/jit/lclvars.cpp index ff08e26067dd9..e2039f930b7db 100644 --- a/src/coreclr/jit/lclvars.cpp +++ b/src/coreclr/jit/lclvars.cpp @@ -564,8 +564,7 @@ void Compiler::lvaInitRetBuffArg(InitVarDscInfo* varDscInfo, bool useFixedRetBuf info.compCompHnd->getMethodSig(info.compMethodHnd, &sigInfo); assert(JITtype2varType(sigInfo.retType) == info.compRetType); // Else shouldn't have a ret buff. - info.compRetBuffDefStack = - (info.compCompHnd->isStructRequiringStackAllocRetBuf(sigInfo.retTypeClass)); + info.compRetBuffDefStack = (info.compCompHnd->isStructRequiringStackAllocRetBuf(sigInfo.retTypeClass)); if (info.compRetBuffDefStack) { // If we're assured that the ret buff argument points into a callers stack, we will type it as