Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8252888: Collapse G1MMUTracker class hierarchy #214

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1ConcurrentMark.inline.hpp"
#include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
#include "gc/g1/g1MMUTrackerQueue.hpp"
#include "gc/g1/g1MMUTracker.hpp"
#include "gc/g1/g1Policy.hpp"
#include "gc/g1/g1RemSet.hpp"
#include "gc/g1/g1Trace.hpp"
@@ -78,7 +78,7 @@ class CMCleanup : public VoidClosure {
double G1ConcurrentMarkThread::mmu_delay_end(G1Policy* policy, bool remark) {
// There are 3 reasons to use SuspendibleThreadSetJoiner.
// 1. To avoid concurrency problem.
// - G1MMUTrackerQueue::add_pause(), when_sec() and when_max_gc_sec() can be called
// - G1MMUTracker::add_pause(), when_sec() and when_max_gc_sec() can be called
// concurrently from ConcurrentMarkThread and VMThread.
// 2. If currently a gc is running, but it has not yet updated the MMU,
// we will not forget to consider that pause in the MMU calculation.
@@ -90,7 +90,7 @@ double G1ConcurrentMarkThread::mmu_delay_end(G1Policy* policy, bool remark) {
double prediction_ms = remark ? analytics->predict_remark_time_ms()
: analytics->predict_cleanup_time_ms();
double prediction = prediction_ms / MILLIUNITS;
G1MMUTrackerQueue *mmu_tracker = policy->mmu_tracker();
G1MMUTracker *mmu_tracker = policy->mmu_tracker();
double now = os::elapsedTime();
return now + mmu_tracker->when_sec(now, prediction);
}
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
*/

#include "precompiled.hpp"
#include "gc/g1/g1MMUTrackerQueue.hpp"
#include "gc/g1/g1MMUTracker.hpp"
#include "gc/g1/g1Trace.hpp"
#include "logging/log.hpp"
#include "runtime/mutexLocker.hpp"
@@ -37,14 +37,14 @@

/***** ALL TIMES ARE IN SECS!!!!!!! *****/

G1MMUTrackerQueue::G1MMUTrackerQueue(double time_slice, double max_gc_time) :
G1MMUTracker::G1MMUTracker(double time_slice, double max_gc_time) :
_time_slice(time_slice),
_max_gc_time(max_gc_time),
_head_index(0),
_tail_index(trim_index(_head_index+1)),
_no_entries(0) { }

void G1MMUTrackerQueue::remove_expired_entries(double current_time) {
void G1MMUTracker::remove_expired_entries(double current_time) {
double limit = current_time - _time_slice;
while (_no_entries > 0) {
if (is_double_geq(limit, _array[_tail_index].end_time())) {
@@ -56,12 +56,12 @@ void G1MMUTrackerQueue::remove_expired_entries(double current_time) {
guarantee(_no_entries == 0, "should have no entries in the array");
}

double G1MMUTrackerQueue::calculate_gc_time(double current_time) {
double G1MMUTracker::calculate_gc_time(double current_time) {
double gc_time = 0.0;
double limit = current_time - _time_slice;
for (int i = 0; i < _no_entries; ++i) {
int index = trim_index(_tail_index + i);
G1MMUTrackerQueueElem *elem = &_array[index];
G1MMUTrackerElem *elem = &_array[index];
if (elem->end_time() > limit) {
if (elem->start_time() > limit)
gc_time += elem->duration();
@@ -72,7 +72,7 @@ double G1MMUTrackerQueue::calculate_gc_time(double current_time) {
return gc_time;
}

void G1MMUTrackerQueue::add_pause(double start, double end) {
void G1MMUTracker::add_pause(double start, double end) {
remove_expired_entries(end);
if (_no_entries == QueueLength) {
// OK, we've filled up the queue. There are a few ways
@@ -96,7 +96,7 @@ void G1MMUTrackerQueue::add_pause(double start, double end) {
_head_index = trim_index(_head_index + 1);
++_no_entries;
}
_array[_head_index] = G1MMUTrackerQueueElem(start, end);
_array[_head_index] = G1MMUTrackerElem(start, end);

// Current entry needs to be added before calculating the value
double slice_time = calculate_gc_time(end);
@@ -111,7 +111,7 @@ void G1MMUTrackerQueue::add_pause(double start, double end) {
}
}

double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) {
double G1MMUTracker::when_sec(double current_time, double pause_time) {
// if the pause is over the maximum, just assume that it's the maximum
double adjusted_pause_time =
(pause_time > max_gc_time()) ? max_gc_time() : pause_time;
@@ -123,13 +123,13 @@ double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) {
return 0.0;

if (adjusted_pause_time == max_gc_time()) {
G1MMUTrackerQueueElem *elem = &_array[_head_index];
G1MMUTrackerElem *elem = &_array[_head_index];
return elem->end_time() - limit;
}

int index = _tail_index;
while ( 1 ) {
G1MMUTrackerQueueElem *elem = &_array[index];
G1MMUTrackerElem *elem = &_array[index];
if (elem->end_time() > limit) {
if (elem->start_time() > limit)
diff -= elem->duration();
Original file line number Diff line number Diff line change
@@ -22,14 +22,14 @@
*
*/

#ifndef SHARE_GC_G1_G1MMUTRACKERQUEUE_HPP
#define SHARE_GC_G1_G1MMUTRACKERQUEUE_HPP
#ifndef SHARE_GC_G1_G1MMUTRACKER_HPP
#define SHARE_GC_G1_G1MMUTRACKER_HPP

#include "gc/shared/gcId.hpp"
#include "memory/allocation.hpp"
#include "utilities/debug.hpp"

class G1MMUTrackerQueueElem {
class G1MMUTrackerElem {
private:
double _start_time;
double _end_time;
@@ -39,12 +39,12 @@ class G1MMUTrackerQueueElem {
inline double end_time() { return _end_time; }
inline double duration() { return _end_time - _start_time; }

G1MMUTrackerQueueElem() {
G1MMUTrackerElem() {
_start_time = 0.0;
_end_time = 0.0;
}

G1MMUTrackerQueueElem(double start_time, double end_time) {
G1MMUTrackerElem(double start_time, double end_time) {
_start_time = start_time;
_end_time = end_time;
}
@@ -67,7 +67,7 @@ class G1MMUTrackerQueueElem {
// - the worst mutator utilisation across all time slices.
//
// ***** ALL TIMES ARE IN SECS!!!!!!! *****
class G1MMUTrackerQueue: public CHeapObj<mtGC> {
class G1MMUTracker: public CHeapObj<mtGC> {
private:
enum PrivateConstants {
QueueLength = 64
@@ -88,7 +88,7 @@ class G1MMUTrackerQueue: public CHeapObj<mtGC> {
// the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus
// potentially violating MMU specs for some time thereafter.

G1MMUTrackerQueueElem _array[QueueLength];
G1MMUTrackerElem _array[QueueLength];
int _head_index;
int _tail_index;
int _no_entries;
@@ -101,7 +101,7 @@ class G1MMUTrackerQueue: public CHeapObj<mtGC> {
double calculate_gc_time(double current_time);

public:
G1MMUTrackerQueue(double time_slice, double max_gc_time);
G1MMUTracker(double time_slice, double max_gc_time);

void add_pause(double start, double end);

@@ -116,4 +116,4 @@ class G1MMUTrackerQueue: public CHeapObj<mtGC> {
}
};

#endif // SHARE_GC_G1_G1MMUTRACKERQUEUE_HPP
#endif // SHARE_GC_G1_G1MMUTRACKER_HPP
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1Policy.cpp
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
_predictor(G1ConfidencePercent / 100.0),
_analytics(new G1Analytics(&_predictor)),
_remset_tracker(),
_mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
_mmu_tracker(new G1MMUTracker(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
_old_gen_alloc_tracker(),
_ihop_control(create_ihop_control(&_old_gen_alloc_tracker, &_predictor)),
_policy_counters(new GCPolicyCounters("GarbageFirst", 1, 2)),
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1Policy.hpp
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
#include "gc/g1/g1ConcurrentStartToMixedTimeTracker.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
#include "gc/g1/g1HeapRegionAttr.hpp"
#include "gc/g1/g1MMUTrackerQueue.hpp"
#include "gc/g1/g1MMUTracker.hpp"
#include "gc/g1/g1OldGenAllocationTracker.hpp"
#include "gc/g1/g1RemSetTrackingPolicy.hpp"
#include "gc/g1/g1Predictions.hpp"
@@ -67,7 +67,7 @@ class G1Policy: public CHeapObj<mtGC> {
G1Predictions _predictor;
G1Analytics* _analytics;
G1RemSetTrackingPolicy _remset_tracker;
G1MMUTrackerQueue* _mmu_tracker;
G1MMUTracker* _mmu_tracker;

// Tracking the allocation in the old generation between
// two GCs.
@@ -154,11 +154,11 @@ class G1Policy: public CHeapObj<mtGC> {
_survivor_surv_rate_group->all_surviving_words_recorded(predictor(), update);
}

G1MMUTrackerQueue* mmu_tracker() {
G1MMUTracker* mmu_tracker() {
return _mmu_tracker;
}

const G1MMUTrackerQueue* mmu_tracker() const {
const G1MMUTracker* mmu_tracker() const {
return _mmu_tracker;
}