comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 3986:65a8ff39a6da

7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t Summary: Declare GrainBytes, GrainWords, and CardsPerRegion as size_t. Reviewed-by: jcoomes, tonyp, jmasa
author johnc
date Wed, 05 Oct 2011 08:44:10 -0700
parents 811ec3d0833b
children c6a6e936dc68
comparison
equal deleted inserted replaced
3985:c63b928b212b 3986:65a8ff39a6da
31 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" 31 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
32 #include "memory/genOopClosures.inline.hpp" 32 #include "memory/genOopClosures.inline.hpp"
33 #include "memory/iterator.hpp" 33 #include "memory/iterator.hpp"
34 #include "oops/oop.inline.hpp" 34 #include "oops/oop.inline.hpp"
35 35
36 int HeapRegion::LogOfHRGrainBytes = 0; 36 int HeapRegion::LogOfHRGrainBytes = 0;
37 int HeapRegion::LogOfHRGrainWords = 0; 37 int HeapRegion::LogOfHRGrainWords = 0;
38 int HeapRegion::GrainBytes = 0; 38 size_t HeapRegion::GrainBytes = 0;
39 int HeapRegion::GrainWords = 0; 39 size_t HeapRegion::GrainWords = 0;
40 int HeapRegion::CardsPerRegion = 0; 40 size_t HeapRegion::CardsPerRegion = 0;
41 41
42 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, 42 HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1,
43 HeapRegion* hr, OopClosure* cl, 43 HeapRegion* hr, OopClosure* cl,
44 CardTableModRefBS::PrecisionStyle precision, 44 CardTableModRefBS::PrecisionStyle precision,
45 FilterKind fk) : 45 FilterKind fk) :
320 LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize; 320 LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize;
321 321
322 guarantee(GrainBytes == 0, "we should only set it once"); 322 guarantee(GrainBytes == 0, "we should only set it once");
323 // The cast to int is safe, given that we've bounded region_size by 323 // The cast to int is safe, given that we've bounded region_size by
324 // MIN_REGION_SIZE and MAX_REGION_SIZE. 324 // MIN_REGION_SIZE and MAX_REGION_SIZE.
325 GrainBytes = (int) region_size; 325 GrainBytes = (size_t)region_size;
326 326
327 guarantee(GrainWords == 0, "we should only set it once"); 327 guarantee(GrainWords == 0, "we should only set it once");
328 GrainWords = GrainBytes >> LogHeapWordSize; 328 GrainWords = GrainBytes >> LogHeapWordSize;
329 guarantee(1 << LogOfHRGrainWords == GrainWords, "sanity"); 329 guarantee((size_t)(1 << LogOfHRGrainWords) == GrainWords, "sanity");
330 330
331 guarantee(CardsPerRegion == 0, "we should only set it once"); 331 guarantee(CardsPerRegion == 0, "we should only set it once");
332 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; 332 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
333 } 333 }
334 334
377 if (clear_space) clear(SpaceDecorator::Mangle); 377 if (clear_space) clear(SpaceDecorator::Mangle);
378 } 378 }
379 379
380 void HeapRegion::par_clear() { 380 void HeapRegion::par_clear() {
381 assert(used() == 0, "the region should have been already cleared"); 381 assert(used() == 0, "the region should have been already cleared");
382 assert(capacity() == (size_t) HeapRegion::GrainBytes, 382 assert(capacity() == HeapRegion::GrainBytes, "should be back to normal");
383 "should be back to normal");
384 HeapRegionRemSet* hrrs = rem_set(); 383 HeapRegionRemSet* hrrs = rem_set();
385 hrrs->clear(); 384 hrrs->clear();
386 CardTableModRefBS* ct_bs = 385 CardTableModRefBS* ct_bs =
387 (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set(); 386 (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set();
388 ct_bs->clear(MemRegion(bottom(), end())); 387 ct_bs->clear(MemRegion(bottom(), end()));
434 } else { 433 } else {
435 // continues humongous 434 // continues humongous
436 assert(end() == _orig_end, "sanity"); 435 assert(end() == _orig_end, "sanity");
437 } 436 }
438 437
439 assert(capacity() == (size_t) HeapRegion::GrainBytes, "pre-condition"); 438 assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
440 _humongous_type = NotHumongous; 439 _humongous_type = NotHumongous;
441 _humongous_start_region = NULL; 440 _humongous_start_region = NULL;
442 } 441 }
443 442
444 bool HeapRegion::claimHeapRegion(jint claimValue) { 443 bool HeapRegion::claimHeapRegion(jint claimValue) {