@@ -7905,6 +7905,32 @@ BOOL gc_heap::ephemeral_pointer_p (uint8_t* o)
7905
7905
#endif //USE_REGIONS
7906
7906
}
7907
7907
7908
+ // This needs to check the range that's covered by bookkeeping because find_object will
7909
+ // need to look at the brick table.
7910
+ inline
7911
+ bool gc_heap::is_in_find_object_range (uint8_t* o)
7912
+ {
7913
+ if (o == nullptr)
7914
+ {
7915
+ return false;
7916
+ }
7917
+ #if defined(USE_REGIONS) && defined(FEATURE_CONSERVATIVE_GC)
7918
+ return ((o >= g_gc_lowest_address) && (o < bookkeeping_covered_committed));
7919
+ #else //USE_REGIONS && FEATURE_CONSERVATIVE_GC
7920
+ if ((o >= g_gc_lowest_address) && (o < g_gc_highest_address))
7921
+ {
7922
+ #ifdef USE_REGIONS
7923
+ assert ((o >= g_gc_lowest_address) && (o < bookkeeping_covered_committed));
7924
+ #endif //USE_REGIONS
7925
+ return true;
7926
+ }
7927
+ else
7928
+ {
7929
+ return false;
7930
+ }
7931
+ #endif //USE_REGIONS && FEATURE_CONSERVATIVE_GC
7932
+ }
7933
+
7908
7934
#ifdef USE_REGIONS
7909
7935
// This assumes o is guaranteed to be in a region.
7910
7936
inline
@@ -7925,14 +7951,6 @@ bool gc_heap::is_in_condemned_gc (uint8_t* o)
7925
7951
return true;
7926
7952
}
7927
7953
7928
- // This needs to check the range that's covered by bookkeeping because find_object will
7929
- // need to look at the brick table.
7930
- inline
7931
- bool gc_heap::is_in_bookkeeping_range (uint8_t* o)
7932
- {
7933
- return ((o >= g_gc_lowest_address) && (o < bookkeeping_covered_committed));
7934
- }
7935
-
7936
7954
inline
7937
7955
bool gc_heap::should_check_brick_for_reloc (uint8_t* o)
7938
7956
{
@@ -25185,15 +25203,10 @@ void gc_heap::background_promote (Object** ppObject, ScanContext* sc, uint32_t f
25185
25203
25186
25204
uint8_t* o = (uint8_t*)*ppObject;
25187
25205
25188
- if (o == 0)
25189
- return;
25190
-
25191
- #if defined(FEATURE_CONSERVATIVE_GC) && defined(USE_REGIONS)
25192
- if (!is_in_bookkeeping_range (o))
25206
+ if (!is_in_find_object_range (o))
25193
25207
{
25194
25208
return;
25195
25209
}
25196
- #endif
25197
25210
25198
25211
#ifdef DEBUG_DestroyedHandleValue
25199
25212
// we can race with destroy handle during concurrent scan
@@ -35956,15 +35969,10 @@ void gc_heap::background_promote_callback (Object** ppObject, ScanContext* sc,
35956
35969
35957
35970
uint8_t* o = (uint8_t*)*ppObject;
35958
35971
35959
- if (o == 0)
35960
- return;
35961
-
35962
- #if defined(FEATURE_CONSERVATIVE_GC) && defined(USE_REGIONS)
35963
- if (!is_in_bookkeeping_range (o))
35972
+ if (!is_in_find_object_range (o))
35964
35973
{
35965
35974
return;
35966
35975
}
35967
- #endif
35968
35976
35969
35977
HEAP_FROM_THREAD;
35970
35978
@@ -45892,15 +45900,10 @@ void GCHeap::Promote(Object** ppObject, ScanContext* sc, uint32_t flags)
45892
45900
45893
45901
uint8_t* o = (uint8_t*)*ppObject;
45894
45902
45895
- if (o == 0)
45896
- return;
45897
-
45898
- #if defined(FEATURE_CONSERVATIVE_GC) && defined(USE_REGIONS)
45899
- if (!gc_heap::is_in_bookkeeping_range (o))
45903
+ if (!gc_heap::is_in_find_object_range (o))
45900
45904
{
45901
45905
return;
45902
45906
}
45903
- #endif
45904
45907
45905
45908
#ifdef DEBUG_DestroyedHandleValue
45906
45909
// we can race with destroy handle during concurrent scan
@@ -45967,19 +45970,16 @@ void GCHeap::Relocate (Object** ppObject, ScanContext* sc,
45967
45970
45968
45971
uint8_t* object = (uint8_t*)(Object*)(*ppObject);
45969
45972
45973
+ if (!gc_heap::is_in_find_object_range (object))
45974
+ {
45975
+ return;
45976
+ }
45977
+
45970
45978
THREAD_NUMBER_FROM_CONTEXT;
45971
45979
45972
45980
//dprintf (3, ("Relocate location %Ix\n", (size_t)ppObject));
45973
45981
dprintf (3, ("R: %Ix", (size_t)ppObject));
45974
45982
45975
- if (!object
45976
- #if defined(USE_REGIONS) && defined(FEATURE_CONSERVATIVE_GC)
45977
- || !gc_heap::is_in_bookkeeping_range (object))
45978
- #else //USE_REGIONS && FEATURE_CONSERVATIVE_GC
45979
- || !((object >= g_gc_lowest_address) && (object < g_gc_highest_address)))
45980
- #endif //USE_REGIONS && FEATURE_CONSERVATIVE_GC
45981
- return;
45982
-
45983
45983
gc_heap* hp = gc_heap::heap_of (object);
45984
45984
45985
45985
#ifdef _DEBUG
@@ -46429,12 +46429,10 @@ GCHeap::GetContainingObject (void *pInteriorPtr, bool fCollectedGenOnly)
46429
46429
{
46430
46430
uint8_t *o = (uint8_t*)pInteriorPtr;
46431
46431
46432
- #if defined(FEATURE_CONSERVATIVE_GC) && defined(USE_REGIONS)
46433
- if (!gc_heap::is_in_bookkeeping_range (o))
46432
+ if (!gc_heap::is_in_find_object_range (o))
46434
46433
{
46435
46434
return NULL;
46436
46435
}
46437
- #endif
46438
46436
46439
46437
gc_heap* hp = gc_heap::heap_of (o);
46440
46438
0 commit comments