@@ -3377,6 +3377,13 @@ size_t size_seg_mapping_table_of (uint8_t* from, uint8_t* end)
3377
3377
return sizeof (seg_mapping)*((end - from) / gc_heap::min_segment_size);
3378
3378
}
3379
3379
3380
+ // for seg_mapping_table we want it to start from a pointer sized address.
3381
+ inline
3382
+ size_t align_for_seg_mapping_table (size_t size)
3383
+ {
3384
+ return ((size + (sizeof (uint8_t*) - 1)) &~ (sizeof (uint8_t*) - 1));
3385
+ }
3386
+
3380
3387
inline
3381
3388
size_t seg_mapping_word_of (uint8_t* add)
3382
3389
{
@@ -6910,6 +6917,10 @@ uint32_t* gc_heap::make_card_table (uint8_t* start, uint8_t* end)
6910
6917
6911
6918
#ifdef GROWABLE_SEG_MAPPING_TABLE
6912
6919
size_t st = size_seg_mapping_table_of (g_lowest_address, g_highest_address);
6920
+ size_t st_table_offset = sizeof(card_table_info) + cs + bs + cb + wws;
6921
+ size_t st_table_offset_aligned = align_for_seg_mapping_table (st_table_offset);
6922
+
6923
+ st += (st_table_offset_aligned - st_table_offset);
6913
6924
#else //GROWABLE_SEG_MAPPING_TABLE
6914
6925
size_t st = 0;
6915
6926
#endif //GROWABLE_SEG_MAPPING_TABLE
@@ -6958,7 +6969,7 @@ uint32_t* gc_heap::make_card_table (uint8_t* start, uint8_t* end)
6958
6969
#endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
6959
6970
6960
6971
#ifdef GROWABLE_SEG_MAPPING_TABLE
6961
- seg_mapping_table = (seg_mapping*)((uint8_t*)card_table_brick_table (ct) + bs + cb + wws );
6972
+ seg_mapping_table = (seg_mapping*)(mem + st_table_offset_aligned );
6962
6973
seg_mapping_table = (seg_mapping*)((uint8_t*)seg_mapping_table -
6963
6974
size_seg_mapping_table_of (0, (align_lower_segment (g_lowest_address))));
6964
6975
#endif //GROWABLE_SEG_MAPPING_TABLE
@@ -7098,6 +7109,9 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
7098
7109
7099
7110
#ifdef GROWABLE_SEG_MAPPING_TABLE
7100
7111
size_t st = size_seg_mapping_table_of (saved_g_lowest_address, saved_g_highest_address);
7112
+ size_t st_table_offset = sizeof(card_table_info) + cs + bs + cb + wws;
7113
+ size_t st_table_offset_aligned = align_for_seg_mapping_table (st_table_offset);
7114
+ st += (st_table_offset_aligned - st_table_offset);
7101
7115
#else //GROWABLE_SEG_MAPPING_TABLE
7102
7116
size_t st = 0;
7103
7117
#endif //GROWABLE_SEG_MAPPING_TABLE
@@ -7120,7 +7134,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
7120
7134
dprintf (GC_TABLE_LOG, ("Table alloc for %Id bytes: [%Ix, %Ix[",
7121
7135
alloc_size, (size_t)mem, (size_t)((uint8_t*)mem+alloc_size)));
7122
7136
7123
- {
7137
+ {
7124
7138
// mark array will be committed separately (per segment).
7125
7139
size_t commit_size = alloc_size - ms;
7126
7140
@@ -7160,7 +7174,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
7160
7174
7161
7175
#ifdef GROWABLE_SEG_MAPPING_TABLE
7162
7176
{
7163
- seg_mapping* new_seg_mapping_table = (seg_mapping*)((uint8_t*)card_table_brick_table (ct) + bs + cb + wws );
7177
+ seg_mapping* new_seg_mapping_table = (seg_mapping*)(mem + st_table_offset_aligned );
7164
7178
new_seg_mapping_table = (seg_mapping*)((uint8_t*)new_seg_mapping_table -
7165
7179
size_seg_mapping_table_of (0, (align_lower_segment (saved_g_lowest_address))));
7166
7180
memcpy(&new_seg_mapping_table[seg_mapping_word_of(g_lowest_address)],
0 commit comments