From e9ddb2e5667120f27d92e38f391e7d74ebf5a9f8 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 17 Mar 2015 07:32:03 -0700 Subject: Fix some of the issues found by Viva64 static analyser --- src/vm/dynamicmethod.cpp | 14 +++++++------- src/vm/object.inl | 2 +- src/vm/threadsuspend.cpp | 12 +++--------- src/vm/util.cpp | 8 +++----- src/vm/zapsig.cpp | 2 +- 5 files changed, 15 insertions(+), 23 deletions(-) (limited to 'src/vm') diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp index 4ee41faecd..662c3893c7 100644 --- a/src/vm/dynamicmethod.cpp +++ b/src/vm/dynamicmethod.cpp @@ -799,13 +799,13 @@ void HostCodeHeap::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) size_t size = dac_cast(m_pLastAvailableCommittedAddr) - addr; #if (_DEBUG) - // Test hook: when testing on debug builds, we want an easy way to test that the while - // correctly terminates in the face of ridiculous stuff from the target. - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget) == 1) - { - // Pretend the object is very large. - size |= 0xefefefef << 28; - } + // Test hook: when testing on debug builds, we want an easy way to test that the while + // correctly terminates in the face of ridiculous stuff from the target. + if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget) == 1) + { + // Pretend the object is very large. + size |= 0xf0000000; + } #endif // (_DEBUG) while (size) diff --git a/src/vm/object.inl b/src/vm/object.inl index d9de9e7c71..14bb8079a6 100644 --- a/src/vm/object.inl +++ b/src/vm/object.inl @@ -92,7 +92,7 @@ inline void Object::EnumMemoryRegions(void) if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget) == 1) { // Pretend all objects are incredibly large. - size |= 0xefefefef << 28; + size |= 0xf0000000; } #endif // defined (_DEBUG) diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp index 5c110d8114..7558581b5e 100644 --- a/src/vm/threadsuspend.cpp +++ b/src/vm/threadsuspend.cpp @@ -2459,15 +2459,9 @@ LPrepareRetry: void Thread::SetRudeAbortEndTimeFromEEPolicy() { LIMITED_METHOD_CONTRACT; - DWORD timeout; - if (HasLockInCurrentDomain()) - { - timeout = GetEEPolicy()->GetTimeout(OPR_ThreadRudeAbortInCriticalRegion); - } - else - { - timeout = GetEEPolicy()->GetTimeout(OPR_ThreadRudeAbortInCriticalRegion); - } + + DWORD timeout = GetEEPolicy()->GetTimeout(OPR_ThreadRudeAbortInCriticalRegion); + ULONGLONG newEndTime; if (timeout == INFINITE) { diff --git a/src/vm/util.cpp b/src/vm/util.cpp index f9f8718a22..faeb2002d7 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -652,13 +652,11 @@ bool operator ==(const ICorDebugInfo::VarLoc &varLoc1, varLoc1.vlStkReg.vlsrReg == varLoc2.vlStkReg.vlsrReg; case ICorDebugInfo::VLT_STK2: - // @TODO : VLT_STK(2) is overloaded to also indicate valueclasses - // which should be VLT_STK_n. Just have a parameterized VLT_STK_n. - return varLoc1.vlStk2.vls2BaseReg == varLoc1.vlStk2.vls2BaseReg && - varLoc1.vlStk2.vls2Offset == varLoc1.vlStk2.vls2Offset; + return varLoc1.vlStk2.vls2BaseReg == varLoc2.vlStk2.vls2BaseReg && + varLoc1.vlStk2.vls2Offset == varLoc2.vlStk2.vls2Offset; case ICorDebugInfo::VLT_FPSTK: - return varLoc1.vlFPstk.vlfReg == varLoc1.vlFPstk.vlfReg; + return varLoc1.vlFPstk.vlfReg == varLoc2.vlFPstk.vlfReg; default: _ASSERTE(!"Bad vlType"); return false; diff --git a/src/vm/zapsig.cpp b/src/vm/zapsig.cpp index 7560958256..a0146aeb7d 100644 --- a/src/vm/zapsig.cpp +++ b/src/vm/zapsig.cpp @@ -169,7 +169,7 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, // Can we encode the type using a short ET encoding? // - CorElementType elemType = elemType = TryEncodeUsingShortcut(pMT); + CorElementType elemType = TryEncodeUsingShortcut(pMT); if (elemType != ELEMENT_TYPE_END) { _ASSERTE(pMT->IsTypicalTypeDefinition()); -- cgit v1.2.3