From 406c0766e224b73803b65335f613cb855a2392f0 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Mon, 26 Jul 2021 18:32:17 -0700 Subject: [PATCH 1/2] We should check against alloc_allocated instead of heap_segment_allocated for ephemeral segment --- src/SOS/Strike/eeheap.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SOS/Strike/eeheap.cpp b/src/SOS/Strike/eeheap.cpp index 9651fe234b..b92bff130a 100644 --- a/src/SOS/Strike/eeheap.cpp +++ b/src/SOS/Strike/eeheap.cpp @@ -700,7 +700,12 @@ BOOL GCObjInSegment(TADDR taddrObj, const GCHeapDetails &heap, ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; } - if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < TO_TADDR(dacpSeg.allocated)) + TADDR allocated = TO_TADDR(dacpSeg.allocated); + if (taddrSeg == TO_TADDR(heap.ephemeral_heap_segment)) + { + allocated = TO_TADDR(heap.alloc_allocated); + } + if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < allocated) { rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; rngSeg.start = (TADDR)dacpSeg.mem; From 56a60bd893ef59f3c46a5db1f142a62f7092e44c Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Tue, 27 Jul 2021 11:24:02 -0700 Subject: [PATCH 2/2] Avoid unnecessary check --- src/SOS/Strike/eeheap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SOS/Strike/eeheap.cpp b/src/SOS/Strike/eeheap.cpp index b92bff130a..3fcec03829 100644 --- a/src/SOS/Strike/eeheap.cpp +++ b/src/SOS/Strike/eeheap.cpp @@ -705,7 +705,7 @@ BOOL GCObjInSegment(TADDR taddrObj, const GCHeapDetails &heap, { allocated = TO_TADDR(heap.alloc_allocated); } - if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < allocated) + if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj < allocated) { rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; rngSeg.start = (TADDR)dacpSeg.mem; @@ -781,7 +781,7 @@ BOOL GCObjInLargeSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR_SEGINF ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; } - if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < TO_TADDR(dacpSeg.allocated)) + if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj < TO_TADDR(dacpSeg.allocated)) { rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; rngSeg.start = (TADDR)dacpSeg.mem; @@ -814,7 +814,7 @@ BOOL GCObjInPinnedObjectSegment(TADDR taddrObj, const GCHeapDetails &heap, TADDR ExtOut("Error requesting heap segment %p\n", SOS_PTR(taddrSeg)); return FALSE; } - if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj && taddrObj < TO_TADDR(dacpSeg.allocated)) + if (taddrObj >= TO_TADDR(dacpSeg.mem) && taddrObj < TO_TADDR(dacpSeg.allocated)) { rngSeg.segAddr = (TADDR)dacpSeg.segmentAddr; rngSeg.start = (TADDR)dacpSeg.mem;