< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp

Print this page

550         (MutatorSizeChanged || CollectorSizeChanged || MutatorEmptiesChanged || CollectorEmptiesChanged ||
551          OldCollectorSizeChanged || OldCollectorEmptiesChanged)) {
552       _global_affiliated_regions = _young_affiliated_regions + _old_affiliated_regions;
553     }
554 #ifdef ASSERT
555     if (ShenandoahHeap::heap()->mode()->is_generational()) {
556       assert(_young_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_young_used, "sanity");
557       assert(_old_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_old_used, "sanity");
558     }
559     assert(_global_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_global_used, "sanity");
560 #endif
561   }
562 
563   // Increases used memory for the partition if the allocation is successful. `in_new_region` will be set
564   // if this is the first allocation in the region.
565   HeapWord* try_allocate_in(ShenandoahHeapRegion* region, ShenandoahAllocRequest& req, bool& in_new_region);
566 
567   // While holding the heap lock, allocate memory for a single object or LAB  which is to be entirely contained
568   // within a single HeapRegion as characterized by req.
569   //
570   // Precondition: !ShenandoahHeapRegion::requires_humongous(req.size())
571   HeapWord* allocate_single(ShenandoahAllocRequest& req, bool& in_new_region);
572 
573   // While holding the heap lock, allocate memory for a humongous object which spans one or more regions that
574   // were previously empty.  Regions that represent humongous objects are entirely dedicated to the humongous
575   // object.  No other objects are packed into these regions.
576   //
577   // Precondition: ShenandoahHeapRegion::requires_humongous(req.size())
578   HeapWord* allocate_contiguous(ShenandoahAllocRequest& req, bool is_humongous);
579 
580   bool transfer_one_region_from_mutator_to_old_collector(size_t idx, size_t alloc_capacity);
581 
582   // Change region r from the Mutator partition to the GC's Collector or OldCollector partition.  This requires that the
583   // region is entirely empty.
584   //
585   // Typical usage: During evacuation, the GC may find it needs more memory than had been reserved at the start of evacuation to
586   // hold evacuated objects.  If this occurs and memory is still available in the Mutator's free set, we will flip a region from
587   // the Mutator free set into the Collector or OldCollector free set. The conditions to move this region are checked by
588   // the caller, so the given region is always moved.
589   void flip_to_gc(ShenandoahHeapRegion* r);
590 
591   // Return true if and only if the given region is successfully flipped to the old partition
592   bool flip_to_old_gc(ShenandoahHeapRegion* r);
593 
594   // Handle allocation for mutator.
595   HeapWord* allocate_for_mutator(ShenandoahAllocRequest &req, bool &in_new_region);
596 
597   // Update allocation bias and decided whether to allocate from the left or right side of the heap.

550         (MutatorSizeChanged || CollectorSizeChanged || MutatorEmptiesChanged || CollectorEmptiesChanged ||
551          OldCollectorSizeChanged || OldCollectorEmptiesChanged)) {
552       _global_affiliated_regions = _young_affiliated_regions + _old_affiliated_regions;
553     }
554 #ifdef ASSERT
555     if (ShenandoahHeap::heap()->mode()->is_generational()) {
556       assert(_young_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_young_used, "sanity");
557       assert(_old_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_old_used, "sanity");
558     }
559     assert(_global_affiliated_regions * ShenandoahHeapRegion::region_size_bytes() >= _total_global_used, "sanity");
560 #endif
561   }
562 
563   // Increases used memory for the partition if the allocation is successful. `in_new_region` will be set
564   // if this is the first allocation in the region.
565   HeapWord* try_allocate_in(ShenandoahHeapRegion* region, ShenandoahAllocRequest& req, bool& in_new_region);
566 
567   // While holding the heap lock, allocate memory for a single object or LAB  which is to be entirely contained
568   // within a single HeapRegion as characterized by req.
569   //
570   // Precondition: !ShenandoahHeapRegion::requires_humongous(req.size(), req.type() == _alloc_shared)
571   HeapWord* allocate_single(ShenandoahAllocRequest& req, bool& in_new_region);
572 
573   // While holding the heap lock, allocate memory for a humongous object which spans one or more regions that
574   // were previously empty.  Regions that represent humongous objects are entirely dedicated to the humongous
575   // object.  No other objects are packed into these regions.
576   //
577   // Precondition: ShenandoahHeapRegion::requires_humongous(req.size(), req.type() == _alloc_shared)
578   HeapWord* allocate_contiguous(ShenandoahAllocRequest& req, bool is_humongous);
579 
580   bool transfer_one_region_from_mutator_to_old_collector(size_t idx, size_t alloc_capacity);
581 
582   // Change region r from the Mutator partition to the GC's Collector or OldCollector partition.  This requires that the
583   // region is entirely empty.
584   //
585   // Typical usage: During evacuation, the GC may find it needs more memory than had been reserved at the start of evacuation to
586   // hold evacuated objects.  If this occurs and memory is still available in the Mutator's free set, we will flip a region from
587   // the Mutator free set into the Collector or OldCollector free set. The conditions to move this region are checked by
588   // the caller, so the given region is always moved.
589   void flip_to_gc(ShenandoahHeapRegion* r);
590 
591   // Return true if and only if the given region is successfully flipped to the old partition
592   bool flip_to_old_gc(ShenandoahHeapRegion* r);
593 
594   // Handle allocation for mutator.
595   HeapWord* allocate_for_mutator(ShenandoahAllocRequest &req, bool &in_new_region);
596 
597   // Update allocation bias and decided whether to allocate from the left or right side of the heap.
< prev index next >