--- old/src/share/vm/gc/g1/g1CollectorPolicy.hpp 2015-11-23 11:07:30.434485421 +0100 +++ new/src/share/vm/gc/g1/g1CollectorPolicy.hpp 2015-11-23 11:07:30.344482815 +0100 @@ -29,9 +29,11 @@ #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1InCSetState.hpp" +#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp" #include "gc/g1/g1MMUTracker.hpp" #include "gc/g1/g1Predictions.hpp" #include "gc/shared/collectorPolicy.hpp" +#include "utilities/pair.hpp" // A G1CollectorPolicy makes policy decisions that determine the // characteristics of the collector. Examples include: @@ -40,6 +42,7 @@ class HeapRegion; class CollectionSetChooser; +class G1IHOPControl; // TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses // (the latter may contain non-young regions - i.e. regions that are @@ -163,6 +166,15 @@ class G1CollectorPolicy: public CollectorPolicy { private: + G1IHOPControl* _ihop_control; + + G1IHOPControl* create_ihop_control() const; + // Update the IHOP control with necessary statistics. + void update_ihop_prediction(double mutator_time_s, + size_t mutator_alloc_bytes, + size_t young_gen_size); + void report_ihop_statistics(); + G1Predictions _predictor; double get_new_prediction(TruncatedSeq const* seq) const; @@ -271,9 +283,17 @@ size_t _pending_cards; + // The amount of allocated bytes in old gen during the last mutator and the following + // young GC phase. + size_t _bytes_allocated_in_old_since_last_gc; + + G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed; public: const G1Predictions& predictor() const { return _predictor; } + // Add the given number of bytes to the total number of allocated bytes in the old gen. + void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; } + // Accessors void set_region_eden(HeapRegion* hr, int young_index_in_cset) { @@ -473,16 +493,18 @@ double _mark_remark_start_sec; double _mark_cleanup_start_sec; - void update_young_list_max_and_target_length(); - void update_young_list_max_and_target_length(size_t rs_lengths); + // Updates the internal young list maximum and target lengths. Returns the + // unbounded young list target length. + uint update_young_list_max_and_target_length(); + uint update_young_list_max_and_target_length(size_t rs_lengths); // Update the young list target length either by setting it to the // desired fixed value or by calculating it using G1's pause // prediction model. If no rs_lengths parameter is passed, predict // the RS lengths using the prediction model, otherwise use the // given rs_lengths as the prediction. - void update_young_list_target_length(); - void update_young_list_target_length(size_t rs_lengths); + // Returns the unbounded young list target length. + uint update_young_list_target_length(size_t rs_lengths); // Calculate and return the minimum desired young list target // length. This is the minimum desired young list length according @@ -505,7 +527,10 @@ uint desired_min_length, uint desired_max_length) const; - uint bounded_young_list_target_length(size_t rs_lengths) const; + // Result of the bounded_young_list_target_length() method, containing both the + // bounded as well as the unbounded young list target lengths in this order. + typedef Pair YoungTargetLengths; + YoungTargetLengths young_list_target_lengths(size_t rs_lengths) const; void update_rs_lengths_prediction(); void update_rs_lengths_prediction(size_t prediction); @@ -536,10 +561,30 @@ // Sets up marking if proper conditions are met. void maybe_start_marking(); + + // The kind of STW pause. + enum PauseKind { + FullGC, + YoungOnlyGC, + MixedGC, + LastYoungGC, + InitialMarkGC, + Cleanup, + Remark + }; + + // Calculate PauseKind from internal state. + PauseKind young_gc_pause_kind() const; + // Record the given STW pause with the given start and end times (in s). + void record_pause(PauseKind kind, double start, double end); + // Indicate that we aborted marking before doing any mixed GCs. + void abort_time_to_mixed_tracking(); public: G1CollectorPolicy(); + virtual ~G1CollectorPolicy(); + virtual G1CollectorPolicy* as_g1_policy() { return this; } G1CollectorState* collector_state() const;