1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Jun 11 12:40:00 2009 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Jun 11 17:19:33 2009 -0700 1.3 @@ -1535,6 +1535,15 @@ 1.4 guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq"); 1.5 guarantee(_cur_alloc_region == NULL, "from constructor"); 1.6 1.7 + // 6843694 - ensure that the maximum region index can fit 1.8 + // in the remembered set structures. 1.9 + const size_t max_region_idx = ((size_t)1 << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1; 1.10 + guarantee((max_regions() - 1) <= max_region_idx, "too many regions"); 1.11 + 1.12 + const size_t cards_per_region = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift; 1.13 + size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1; 1.14 + guarantee(cards_per_region < max_cards_per_region, "too many cards per region"); 1.15 + 1.16 _bot_shared = new G1BlockOffsetSharedArray(_reserved, 1.17 heap_word_size(init_byte_size)); 1.18