< prev index next >
src/share/vm/gc/shenandoah/shenandoahCollectorPolicy.cpp
Print this page
*** 74,83 ****
--- 74,86 ----
size_t _bytes_allocated_after_last_gc;
uint _cancelled_cm_cycles_in_a_row;
uint _successful_cm_cycles_in_a_row;
+ uint _cancelled_uprefs_cycles_in_a_row;
+ uint _successful_uprefs_cycles_in_a_row;
+
size_t _bytes_in_cset;
public:
ShenandoahHeuristics();
*** 113,132 ****
--- 116,149 ----
virtual bool handover_cancelled_marking() {
return _cancelled_cm_cycles_in_a_row <= ShenandoahFullGCThreshold;
}
+ virtual bool handover_cancelled_uprefs() {
+ return _cancelled_uprefs_cycles_in_a_row <= ShenandoahFullGCThreshold;
+ }
+
virtual void record_cm_cancelled() {
_cancelled_cm_cycles_in_a_row++;
_successful_cm_cycles_in_a_row = 0;
}
virtual void record_cm_success() {
_cancelled_cm_cycles_in_a_row = 0;
_successful_cm_cycles_in_a_row++;
}
+ virtual void record_uprefs_cancelled() {
+ _cancelled_uprefs_cycles_in_a_row++;
+ _successful_uprefs_cycles_in_a_row = 0;
+ }
+
+ virtual void record_uprefs_success() {
+ _cancelled_uprefs_cycles_in_a_row = 0;
+ _successful_uprefs_cycles_in_a_row++;
+ }
+
virtual void record_full_gc() {
_bytes_in_cset = 0;
}
virtual void start_choose_collection_set() {
*** 168,177 ****
--- 185,196 ----
_bytes_allocated_during_CM(0),
_bytes_allocated_after_last_gc(0),
_bytes_in_cset(0),
_cancelled_cm_cycles_in_a_row(0),
_successful_cm_cycles_in_a_row(0),
+ _cancelled_uprefs_cycles_in_a_row(0),
+ _successful_uprefs_cycles_in_a_row(0),
_region_garbage(NULL),
_region_garbage_size(0)
{
}
*** 468,495 ****
virtual bool region_in_collection_set(ShenandoahHeapRegion* r, size_t immediate_garbage) {
size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
return r->garbage() > threshold;
}
! virtual void record_cm_cancelled() {
! ShenandoahHeuristics::record_cm_cancelled();
if (_free_threshold < ShenandoahMaxFreeThreshold) {
_free_threshold++;
log_info(gc,ergo)("increasing free threshold to: "UINTX_FORMAT, _free_threshold);
}
}
virtual void record_cm_success() {
ShenandoahHeuristics::record_cm_success();
! if (_successful_cm_cycles_in_a_row > ShenandoahHappyCyclesThreshold &&
! _free_threshold > ShenandoahMinFreeThreshold) {
! _free_threshold--;
! log_info(gc,ergo)("reducing free threshold to: "UINTX_FORMAT, _free_threshold);
! _successful_cm_cycles_in_a_row = 0;
}
}
virtual bool should_start_concurrent_mark(size_t used, size_t capacity) const {
bool shouldStartConcurrentMark = false;
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t free_capacity = heap->free_regions()->capacity();
--- 487,540 ----
virtual bool region_in_collection_set(ShenandoahHeapRegion* r, size_t immediate_garbage) {
size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
return r->garbage() > threshold;
}
! void optimize_free_threshold(uint successful_cycles) {
! if (successful_cycles > ShenandoahHappyCyclesThreshold &&
! _free_threshold > ShenandoahMinFreeThreshold) {
! _free_threshold--;
! log_info(gc,ergo)("reducing free threshold to: "UINTX_FORMAT, _free_threshold);
! _successful_cm_cycles_in_a_row = 0;
! }
! }
!
! void pessimize_free_threshold() {
if (_free_threshold < ShenandoahMaxFreeThreshold) {
_free_threshold++;
log_info(gc,ergo)("increasing free threshold to: "UINTX_FORMAT, _free_threshold);
}
}
+ virtual void record_cm_cancelled() {
+ ShenandoahHeuristics::record_cm_cancelled();
+ pessimize_free_threshold();
+ }
+
virtual void record_cm_success() {
ShenandoahHeuristics::record_cm_success();
! if (update_refs_early()) {
! optimize_free_threshold(_successful_cm_cycles_in_a_row);
! }
}
+
+ virtual void record_uprefs_cancelled() {
+ ShenandoahHeuristics::record_uprefs_cancelled();
+ pessimize_free_threshold();
+ }
+
+ virtual void record_uprefs_success() {
+ ShenandoahHeuristics::record_uprefs_success();
+ optimize_free_threshold(_successful_uprefs_cycles_in_a_row);
+ }
+
+ virtual void record_full_gc() {
+ ShenandoahHeuristics::record_full_gc();
+ pessimize_free_threshold();
}
+
virtual bool should_start_concurrent_mark(size_t used, size_t capacity) const {
bool shouldStartConcurrentMark = false;
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t free_capacity = heap->free_regions()->capacity();
*** 720,730 ****
};
ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
_cycle_counter(0),
_successful_cm(0),
! _degenerated_cm(0)
{
ShenandoahHeapRegion::setup_heap_region_size(initial_heap_byte_size(), max_heap_byte_size());
initialize_all();
--- 765,777 ----
};
ShenandoahCollectorPolicy::ShenandoahCollectorPolicy() :
_cycle_counter(0),
_successful_cm(0),
! _degenerated_cm(0),
! _successful_uprefs(0),
! _degenerated_uprefs(0)
{
ShenandoahHeapRegion::setup_heap_region_size(initial_heap_byte_size(), max_heap_byte_size());
initialize_all();
*** 945,954 ****
--- 992,1005 ----
bool ShenandoahCollectorPolicy::handover_cancelled_marking() {
return _heuristics->handover_cancelled_marking();
}
+ bool ShenandoahCollectorPolicy::handover_cancelled_uprefs() {
+ return _heuristics->handover_cancelled_uprefs();
+ }
+
bool ShenandoahCollectorPolicy::update_refs_early() {
return _heuristics->update_refs_early();
}
void ShenandoahCollectorPolicy::record_cm_success() {
*** 962,971 ****
--- 1013,1035 ----
void ShenandoahCollectorPolicy::record_cm_cancelled() {
_heuristics->record_cm_cancelled();
}
+ void ShenandoahCollectorPolicy::record_uprefs_success() {
+ _heuristics->record_uprefs_success();
+ _successful_uprefs++;
+ }
+
+ void ShenandoahCollectorPolicy::record_uprefs_degenerated() {
+ _degenerated_uprefs++;
+ }
+
+ void ShenandoahCollectorPolicy::record_uprefs_cancelled() {
+ _heuristics->record_uprefs_cancelled();
+ }
+
void ShenandoahCollectorPolicy::record_full_gc() {
_heuristics->record_full_gc();
}
void ShenandoahCollectorPolicy::choose_collection_set(ShenandoahCollectionSet* collection_set, int* connections) {
*** 1000,1009 ****
--- 1064,1074 ----
}
out->cr();
out->print_cr("" SIZE_FORMAT " allocation failure and " SIZE_FORMAT " user requested GCs", _allocation_failure_gcs, _user_requested_gcs);
out->print_cr("" SIZE_FORMAT " successful and " SIZE_FORMAT " degenerated concurrent markings", _successful_cm, _degenerated_cm);
+ out->print_cr("" SIZE_FORMAT " successful and " SIZE_FORMAT " degenerated update references ", _successful_uprefs, _degenerated_uprefs);
out->cr();
}
void ShenandoahCollectorPolicy::print_summary_sd(outputStream* out, const char* str, const HdrSeq* seq) {
out->print_cr("%-27s = %8.2lf s (a = %8.0lf us) (n = "INT32_FORMAT_W(5)") (lvls, us = %8.0lf, %8.0lf, %8.0lf, %8.0lf, %8.0lf)",
< prev index next >