From 5d91c4d2cc8fe60bad20cdfdf2e5f239bc024061 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 14 Dec 2017 16:15:49 -0500 Subject: [PATCH] Change non-exclusive Check postconditions to null checks (#15523) The Check macro is trying to be helpful and trigger DebugBreak when the condition is false and debugger is attached. It makes it hard to exercise the recent jump stub changes with debugger attached. The fix is to change the non-exclusive Check postconditions to a simple null check. --- src/vm/codeman.cpp | 8 ++++---- src/vm/dynamicmethod.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp index b1e6746..2fe8b14 100644 --- a/src/vm/codeman.cpp +++ b/src/vm/codeman.cpp @@ -2099,7 +2099,7 @@ HeapList* LoaderCodeHeap::CreateCodeHeap(CodeHeapRequestInfo *pInfo, LoaderHeap CONTRACT(HeapList *) { THROWS; GC_NOTRIGGER; - POSTCONDITION(CheckPointer(RETVAL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); + POSTCONDITION((RETVAL != NULL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); } CONTRACT_END; size_t * pPrivatePCLBytes = NULL; @@ -2303,7 +2303,7 @@ HeapList* EEJitManager::NewCodeHeap(CodeHeapRequestInfo *pInfo, DomainCodeHeapLi THROWS; GC_NOTRIGGER; PRECONDITION(m_CodeHeapCritSec.OwnedByCurrentThread()); - POSTCONDITION(CheckPointer(RETVAL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); + POSTCONDITION((RETVAL != NULL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); } CONTRACT_END; size_t initialRequestSize = pInfo->getRequestSize(); @@ -2422,7 +2422,7 @@ void* EEJitManager::allocCodeRaw(CodeHeapRequestInfo *pInfo, THROWS; GC_NOTRIGGER; PRECONDITION(m_CodeHeapCritSec.OwnedByCurrentThread()); - POSTCONDITION(CheckPointer(RETVAL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); + POSTCONDITION((RETVAL != NULL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); } CONTRACT_END; pInfo->setRequestSize(header+blockSize+(align-1)+pInfo->getReserveForJumpStubs()); @@ -2897,7 +2897,7 @@ JumpStubBlockHeader * EEJitManager::allocJumpStubBlock(MethodDesc* pMD, DWORD n GC_NOTRIGGER; PRECONDITION(loAddr < hiAddr); PRECONDITION(pLoaderAllocator != NULL); - POSTCONDITION(CheckPointer(RETVAL) || !throwOnOutOfMemoryWithinRange); + POSTCONDITION((RETVAL != NULL) || !throwOnOutOfMemoryWithinRange); } CONTRACT_END; _ASSERTE((sizeof(JumpStubBlockHeader) % CODE_SIZE_ALIGN) == 0); diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp index aa9b73e..c997565 100644 --- a/src/vm/dynamicmethod.cpp +++ b/src/vm/dynamicmethod.cpp @@ -322,7 +322,7 @@ HeapList* HostCodeHeap::CreateCodeHeap(CodeHeapRequestInfo *pInfo, EEJitManager GC_NOTRIGGER; MODE_ANY; INJECT_FAULT(COMPlusThrowOM()); - POSTCONDITION(CheckPointer(RETVAL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); + POSTCONDITION((RETVAL != NULL) || !pInfo->getThrowOnOutOfMemoryWithinRange()); } CONTRACT_END; -- 2.7.4