Skip to content

Commit 5aee1fa

Browse files
committed
Avoid referring to mark_array_element outside of background gc
1 parent 3660825 commit 5aee1fa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8801,8 +8801,8 @@ uint32_t* gc_heap::make_card_table (uint8_t* start, uint8_t* end)
88018801
}
88028802
bookkeeping_covered_committed = global_region_allocator.get_left_used_unsafe();
88038803
#else
8804-
// mark array will be committed separately (per segment).
8805-
size_t commit_size = card_table_element_layout[mark_array_element];
8804+
// in case of background gc, the mark array will be committed separately (per segment).
8805+
size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1];
88068806

88078807
if (!virtual_commit (mem, commit_size, gc_oh_num::none))
88088808
{
@@ -8940,7 +8940,6 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
89408940
uint32_t* saved_g_card_bundle_table = g_gc_card_bundle_table;
89418941
#endif
89428942
get_card_table_element_layout(saved_g_lowest_address, saved_g_highest_address, card_table_element_layout);
8943-
size_t alloc_size = card_table_element_layout[total_bookkeeping_elements];
89448943
size_t cb = 0;
89458944
uint32_t* ct = 0;
89468945
uint32_t* translated_ct = 0;
@@ -8958,6 +8957,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
89588957
}
89598958
#endif //CARD_BUNDLE
89608959

8960+
size_t alloc_size = card_table_element_layout[total_bookkeeping_elements];
89618961
uint8_t* mem = (uint8_t*)GCToOSInterface::VirtualReserve (alloc_size, 0, virtual_reserve_flags);
89628962

89638963
if (!mem)
@@ -8970,8 +8970,8 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
89708970
alloc_size, (size_t)mem, (size_t)((uint8_t*)mem+alloc_size)));
89718971

89728972
{
8973-
// mark array will be committed separately (per segment).
8974-
size_t commit_size = card_table_element_layout[total_bookkeeping_elements - 1];
8973+
// in case of background gc, the mark array will be committed separately (per segment).
8974+
size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1];
89758975

89768976
if (!virtual_commit (mem, commit_size, gc_oh_num::none))
89778977
{

0 commit comments

Comments
 (0)