src/share/vm/gc_implementation/g1/heapRegion.cpp

Print this page
rev 2722 : 7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
Summary: Declare GrainBytes, GrainWords, and CardsPerRegion as size_t.
Reviewed-by:

*** 33,45 **** #include "memory/iterator.hpp" #include "oops/oop.inline.hpp" int HeapRegion::LogOfHRGrainBytes = 0; int HeapRegion::LogOfHRGrainWords = 0; ! int HeapRegion::GrainBytes = 0; ! int HeapRegion::GrainWords = 0; ! int HeapRegion::CardsPerRegion = 0; HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, HeapRegion* hr, OopClosure* cl, CardTableModRefBS::PrecisionStyle precision, FilterKind fk) : --- 33,45 ---- #include "memory/iterator.hpp" #include "oops/oop.inline.hpp" int HeapRegion::LogOfHRGrainBytes = 0; int HeapRegion::LogOfHRGrainWords = 0; ! size_t HeapRegion::GrainBytes = 0; ! size_t HeapRegion::GrainWords = 0; ! size_t HeapRegion::CardsPerRegion = 0; HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, HeapRegion* hr, OopClosure* cl, CardTableModRefBS::PrecisionStyle precision, FilterKind fk) :
*** 347,361 **** LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize; guarantee(GrainBytes == 0, "we should only set it once"); // The cast to int is safe, given that we've bounded region_size by // MIN_REGION_SIZE and MAX_REGION_SIZE. ! GrainBytes = (int) region_size; guarantee(GrainWords == 0, "we should only set it once"); GrainWords = GrainBytes >> LogHeapWordSize; ! guarantee(1 << LogOfHRGrainWords == GrainWords, "sanity"); guarantee(CardsPerRegion == 0, "we should only set it once"); CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; } --- 347,361 ---- LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize; guarantee(GrainBytes == 0, "we should only set it once"); // The cast to int is safe, given that we've bounded region_size by // MIN_REGION_SIZE and MAX_REGION_SIZE. ! GrainBytes = (size_t)region_size; guarantee(GrainWords == 0, "we should only set it once"); GrainWords = GrainBytes >> LogHeapWordSize; ! guarantee((size_t)(1 << LogOfHRGrainWords) == GrainWords, "sanity"); guarantee(CardsPerRegion == 0, "we should only set it once"); CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; }
*** 404,415 **** if (clear_space) clear(SpaceDecorator::Mangle); } void HeapRegion::par_clear() { assert(used() == 0, "the region should have been already cleared"); ! assert(capacity() == (size_t) HeapRegion::GrainBytes, ! "should be back to normal"); HeapRegionRemSet* hrrs = rem_set(); hrrs->clear(); CardTableModRefBS* ct_bs = (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); ct_bs->clear(MemRegion(bottom(), end())); --- 404,414 ---- if (clear_space) clear(SpaceDecorator::Mangle); } void HeapRegion::par_clear() { assert(used() == 0, "the region should have been already cleared"); ! assert(capacity() == HeapRegion::GrainBytes, "should be back to normal"); HeapRegionRemSet* hrrs = rem_set(); hrrs->clear(); CardTableModRefBS* ct_bs = (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); ct_bs->clear(MemRegion(bottom(), end()));
*** 461,471 **** } else { // continues humongous assert(end() == _orig_end, "sanity"); } ! assert(capacity() == (size_t) HeapRegion::GrainBytes, "pre-condition"); _humongous_type = NotHumongous; _humongous_start_region = NULL; } bool HeapRegion::claimHeapRegion(jint claimValue) { --- 460,470 ---- } else { // continues humongous assert(end() == _orig_end, "sanity"); } ! assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); _humongous_type = NotHumongous; _humongous_start_region = NULL; } bool HeapRegion::claimHeapRegion(jint claimValue) {