< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp

Print this page

744   guarantee(RegionSizeWordsShift == 0, "we should only set it once");
745   RegionSizeWordsShift = RegionSizeBytesShift - LogHeapWordSize;
746 
747   guarantee(RegionSizeBytes == 0, "we should only set it once");
748   RegionSizeBytes = region_size;
749   RegionSizeWords = RegionSizeBytes >> LogHeapWordSize;
750   assert (RegionSizeWords*HeapWordSize == RegionSizeBytes, "sanity");
751 
752   guarantee(RegionSizeWordsMask == 0, "we should only set it once");
753   RegionSizeWordsMask = RegionSizeWords - 1;
754 
755   guarantee(RegionSizeBytesMask == 0, "we should only set it once");
756   RegionSizeBytesMask = RegionSizeBytes - 1;
757 
758   guarantee(RegionCount == 0, "we should only set it once");
759   RegionCount = align_up(max_heap_size, RegionSizeBytes) / RegionSizeBytes;
760   guarantee(RegionCount >= MIN_NUM_REGIONS, "Should have at least minimum regions");
761 
762   // Limit TLAB size for better startup behavior and more equitable distribution of memory between contending mutator threads.
763   guarantee(MaxTLABSizeWords == 0, "we should only set it once");
764   MaxTLABSizeWords = align_down(MIN2(RegionSizeWords, MAX2(RegionSizeWords / 32, (size_t) (256 * 1024) / HeapWordSize)),
765                                 MinObjAlignment);








766 
767   guarantee(MaxTLABSizeBytes == 0, "we should only set it once");
768   MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize;
769   assert (MaxTLABSizeBytes > MinTLABSize, "should be larger");
770 
771   return max_heap_size;
772 }
773 
774 void ShenandoahHeapRegion::do_commit() {
775   ShenandoahHeap* heap = ShenandoahHeap::heap();
776   if (!heap->is_heap_region_special()) {
777     os::commit_memory_or_exit((char*) bottom(), RegionSizeBytes, false, "Unable to commit region");
778   }
779   if (!heap->is_bitmap_region_special()) {
780     heap->commit_bitmap_slice(this);
781   }
782   if (AlwaysPreTouch) {
783     os::pretouch_memory(bottom(), end(), heap->pretouch_heap_page_size());
784   }
785   if (ZapUnusedHeapArea) {

744   guarantee(RegionSizeWordsShift == 0, "we should only set it once");
745   RegionSizeWordsShift = RegionSizeBytesShift - LogHeapWordSize;
746 
747   guarantee(RegionSizeBytes == 0, "we should only set it once");
748   RegionSizeBytes = region_size;
749   RegionSizeWords = RegionSizeBytes >> LogHeapWordSize;
750   assert (RegionSizeWords*HeapWordSize == RegionSizeBytes, "sanity");
751 
752   guarantee(RegionSizeWordsMask == 0, "we should only set it once");
753   RegionSizeWordsMask = RegionSizeWords - 1;
754 
755   guarantee(RegionSizeBytesMask == 0, "we should only set it once");
756   RegionSizeBytesMask = RegionSizeBytes - 1;
757 
758   guarantee(RegionCount == 0, "we should only set it once");
759   RegionCount = align_up(max_heap_size, RegionSizeBytes) / RegionSizeBytes;
760   guarantee(RegionCount >= MIN_NUM_REGIONS, "Should have at least minimum regions");
761 
762   // Limit TLAB size for better startup behavior and more equitable distribution of memory between contending mutator threads.
763   guarantee(MaxTLABSizeWords == 0, "we should only set it once");
764   // With compact object headers an object may grow by one word when an identity
765   // hash-code is injected during a GC copy. Never let the max TLAB equal a whole
766   // region: a region-sized TLAB could serve a region-sized object (bypassing the
767   // humongous path) and would itself be a region-sized LAB allocation request. Cap
768   // it one (object-aligned) word below the region so neither can happen.
769   size_t max_tlab_words = MIN2(RegionSizeWords, MAX2(RegionSizeWords / 32, (size_t) (256 * 1024) / HeapWordSize));
770   if (UseCompactObjectHeaders) {
771     max_tlab_words = MIN2(max_tlab_words, RegionSizeWords - align_object_size(1));
772   }
773   MaxTLABSizeWords = align_down(max_tlab_words, MinObjAlignment);
774 
775   guarantee(MaxTLABSizeBytes == 0, "we should only set it once");
776   MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize;
777   assert (MaxTLABSizeBytes > MinTLABSize, "should be larger");
778 
779   return max_heap_size;
780 }
781 
782 void ShenandoahHeapRegion::do_commit() {
783   ShenandoahHeap* heap = ShenandoahHeap::heap();
784   if (!heap->is_heap_region_special()) {
785     os::commit_memory_or_exit((char*) bottom(), RegionSizeBytes, false, "Unable to commit region");
786   }
787   if (!heap->is_bitmap_region_special()) {
788     heap->commit_bitmap_slice(this);
789   }
790   if (AlwaysPreTouch) {
791     os::pretouch_memory(bottom(), end(), heap->pretouch_heap_page_size());
792   }
793   if (ZapUnusedHeapArea) {
< prev index next >