667 }
668
669 virtual bool region_in_collection_set(ShenandoahHeapRegion* r, size_t immediate_garbage) {
670 assert(false, "Shouldn't get here");
671 return false;
672 }
673 };
674 class PartialHeuristics : public AdaptiveHeuristics {
675 public:
676 PartialHeuristics() : AdaptiveHeuristics() {
677 if (FLAG_IS_DEFAULT(ShenandoahAllocationThreshold)) {
678 FLAG_SET_DEFAULT(ShenandoahAllocationThreshold, 5);
679 }
680 FLAG_SET_DEFAULT(UseShenandoahMatrix, true);
681 // TODO: Disable this optimization for now, as it also requires the matrix barriers.
682 FLAG_SET_DEFAULT(ArrayCopyLoadStoreMaxElem, 0);
683 }
684
685 virtual ~PartialHeuristics() {}
686
687 bool should_start_concurrent_mark(size_t used, size_t capacity) const {
688 // Never do concurrent GCs.
689 return false;
690 }
691
692 bool should_start_partial_gc() {
693 ShenandoahHeap* heap = ShenandoahHeap::heap();
694 size_t capacity = heap->capacity();
695
696 size_t used = heap->used();
697 return (used - _bytes_allocated_after_last_gc) * 100 / capacity > ShenandoahAllocationThreshold;
698 }
699 };
700
701 ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
702 _cycle_counter(0),
703 _successful_cm(0),
704 _degenerated_cm(0)
705 {
706
707 ShenandoahHeapRegion::setup_heap_region_size(initial_heap_byte_size(), max_heap_byte_size());
708
709 initialize_all();
|
667 }
668
669 virtual bool region_in_collection_set(ShenandoahHeapRegion* r, size_t immediate_garbage) {
670 assert(false, "Shouldn't get here");
671 return false;
672 }
673 };
674 class PartialHeuristics : public AdaptiveHeuristics {
675 public:
676 PartialHeuristics() : AdaptiveHeuristics() {
677 if (FLAG_IS_DEFAULT(ShenandoahAllocationThreshold)) {
678 FLAG_SET_DEFAULT(ShenandoahAllocationThreshold, 5);
679 }
680 FLAG_SET_DEFAULT(UseShenandoahMatrix, true);
681 // TODO: Disable this optimization for now, as it also requires the matrix barriers.
682 FLAG_SET_DEFAULT(ArrayCopyLoadStoreMaxElem, 0);
683 }
684
685 virtual ~PartialHeuristics() {}
686
687 bool update_refs_early() {
688 return true;
689 }
690
691 bool should_start_partial_gc() {
692 ShenandoahHeap* heap = ShenandoahHeap::heap();
693 size_t capacity = heap->capacity();
694
695 size_t used = heap->used();
696 return (used - _bytes_allocated_after_last_gc) * 100 / capacity > ShenandoahAllocationThreshold;
697 }
698 };
699
700 ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
701 _cycle_counter(0),
702 _successful_cm(0),
703 _degenerated_cm(0)
704 {
705
706 ShenandoahHeapRegion::setup_heap_region_size(initial_heap_byte_size(), max_heap_byte_size());
707
708 initialize_all();
|