Fix one source of perf regression in GCHeap::Alloc. This impacts the System.Collectio...
authorPeter Sollich <petersol@microsoft.com>
Mon, 24 Jan 2022 08:24:38 +0000 (09:24 +0100)
committerGitHub <noreply@github.com>
Mon, 24 Jan 2022 08:24:38 +0000 (09:24 +0100)
These benchmarks manage to make GCHeap::Alloc into a hotspot, so the call to IsHeapPointer() at the end matters for performance.

src/coreclr/gc/gc.cpp

index e270bcd..9ab892a 100644 (file)
@@ -44081,12 +44081,8 @@ GCHeap::Alloc(gc_alloc_context* context, size_t size, uint32_t flags REQD_ALIGN_
     }
 
     CHECK_ALLOC_AND_POSSIBLY_REGISTER_FOR_FINALIZATION(newAlloc, size, flags & GC_ALLOC_FINALIZE);
-
 #ifdef USE_REGIONS
-    if (!IsHeapPointer (newAlloc))
-    {
-        GCToOSInterface::DebugBreak();
-    }
+    assert (IsHeapPointer (newAlloc));
 #endif //USE_REGIONS
 
     return newAlloc;