From 3358c62500c22797f373a40fda1482703a6088fb Mon Sep 17 00:00:00 2001 From: EgorBo Date: Sat, 30 Jul 2022 13:55:31 +0200 Subject: [PATCH 1/2] Handle objects from frozen segments in GCHeap::IsEphemeral --- src/coreclr/gc/gc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 5c5970d30ef2a..b8139f0f46f81 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -44690,6 +44690,13 @@ unsigned int GCHeap::GetGenerationWithRange (Object* object, uint8_t** ppStart, bool GCHeap::IsEphemeral (Object* object) { uint8_t* o = (uint8_t*)object; +#if defined(FEATURE_BASICFREEZE) && defined(USE_REGIONS) + if (!is_in_heap_range(o)) + { + // Objects in frozen segments are not ephemeral + return FALSE; + } +#endif gc_heap* hp = gc_heap::heap_of (o); return !!hp->ephemeral_pointer_p (o); } From 74ee89c045ef6c1b5660a8588387700e16bbaf85 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Sat, 30 Jul 2022 13:56:55 +0200 Subject: [PATCH 2/2] Formatting --- src/coreclr/gc/gc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index b8139f0f46f81..e278bba5005f3 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -44691,7 +44691,7 @@ bool GCHeap::IsEphemeral (Object* object) { uint8_t* o = (uint8_t*)object; #if defined(FEATURE_BASICFREEZE) && defined(USE_REGIONS) - if (!is_in_heap_range(o)) + if (!is_in_heap_range (o)) { // Objects in frozen segments are not ephemeral return FALSE;