1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
30 #include "gc/g1/g1CollectionSet.hpp"
31 #include "gc/g1/g1ConcurrentMark.hpp"
32 #include "gc/g1/g1DefaultPolicy.hpp"
33 #include "gc/g1/g1HotCardCache.hpp"
34 #include "gc/g1/g1IHOPControl.hpp"
35 #include "gc/g1/g1GCPhaseTimes.hpp"
36 #include "gc/g1/g1Policy.hpp"
37 #include "gc/g1/g1SurvivorRegions.hpp"
38 #include "gc/g1/g1YoungGenSizer.hpp"
39 #include "gc/g1/heapRegion.inline.hpp"
40 #include "gc/g1/heapRegionRemSet.hpp"
41 #include "gc/shared/gcPolicyCounters.hpp"
42 #include "logging/logStream.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/mutexLocker.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/growableArray.hpp"
48 #include "utilities/pair.hpp"
49
50 G1DefaultPolicy::G1DefaultPolicy() :
51 _predictor(G1ConfidencePercent / 100.0),
52 _analytics(new G1Analytics(&_predictor)),
53 _mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
54 _ihop_control(create_ihop_control(&_predictor)),
55 _policy_counters(new GCPolicyCounters("GarbageFirst", 1, 3)),
56 _young_list_fixed_length(0),
57 _short_lived_surv_rate_group(new SurvRateGroup()),
58 _survivor_surv_rate_group(new SurvRateGroup()),
59 _reserve_factor((double) G1ReservePercent / 100.0),
60 _reserve_regions(0),
61 _rs_lengths_prediction(0),
62 _bytes_allocated_in_old_since_last_gc(0),
63 _initial_mark_to_mixed(),
64 _collection_set(NULL),
65 _g1(NULL),
66 _phase_times(new G1GCPhaseTimes(ParallelGCThreads)),
67 _tenuring_threshold(MaxTenuringThreshold),
68 _max_survivor_regions(0),
69 _survivors_age_table(true),
70 _collection_pause_end_millis(os::javaTimeNanos() / NANOSECS_PER_MILLISEC) { }
71
72 G1DefaultPolicy::~G1DefaultPolicy() {
73 delete _ihop_control;
74 }
75
76 G1CollectorState* G1DefaultPolicy::collector_state() const { return _g1->collector_state(); }
77
78 void G1DefaultPolicy::init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) {
79 _g1 = g1h;
80 _collection_set = collection_set;
81
82 assert(Heap_lock->owned_by_self(), "Locking discipline.");
83
84 if (!adaptive_young_list_length()) {
85 _young_list_fixed_length = _young_gen_sizer.min_desired_young_length();
86 }
|
1 /*
2 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
30 #include "gc/g1/g1CollectionSet.hpp"
31 #include "gc/g1/g1ConcurrentMark.hpp"
32 #include "gc/g1/g1DefaultPolicy.hpp"
33 #include "gc/g1/g1HotCardCache.hpp"
34 #include "gc/g1/g1IHOPControl.hpp"
35 #include "gc/g1/g1GCPhaseTimes.hpp"
36 #include "gc/g1/g1Policy.hpp"
37 #include "gc/g1/g1SurvivorRegions.hpp"
38 #include "gc/g1/g1YoungGenSizer.hpp"
39 #include "gc/g1/heapRegion.inline.hpp"
40 #include "gc/g1/heapRegionRemSet.hpp"
41 #include "gc/shared/gcPolicyCounters.hpp"
42 #include "logging/logStream.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/mutexLocker.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/growableArray.hpp"
48 #include "utilities/pair.hpp"
49
50 G1DefaultPolicy::G1DefaultPolicy(STWGCTimer* gc_timer) :
51 _predictor(G1ConfidencePercent / 100.0),
52 _analytics(new G1Analytics(&_predictor)),
53 _mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
54 _ihop_control(create_ihop_control(&_predictor)),
55 _policy_counters(new GCPolicyCounters("GarbageFirst", 1, 3)),
56 _young_list_fixed_length(0),
57 _short_lived_surv_rate_group(new SurvRateGroup()),
58 _survivor_surv_rate_group(new SurvRateGroup()),
59 _reserve_factor((double) G1ReservePercent / 100.0),
60 _reserve_regions(0),
61 _rs_lengths_prediction(0),
62 _bytes_allocated_in_old_since_last_gc(0),
63 _initial_mark_to_mixed(),
64 _collection_set(NULL),
65 _g1(NULL),
66 _phase_times(new G1GCPhaseTimes(gc_timer, ParallelGCThreads)),
67 _tenuring_threshold(MaxTenuringThreshold),
68 _max_survivor_regions(0),
69 _survivors_age_table(true),
70 _collection_pause_end_millis(os::javaTimeNanos() / NANOSECS_PER_MILLISEC) { }
71
72 G1DefaultPolicy::~G1DefaultPolicy() {
73 delete _ihop_control;
74 }
75
76 G1CollectorState* G1DefaultPolicy::collector_state() const { return _g1->collector_state(); }
77
78 void G1DefaultPolicy::init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) {
79 _g1 = g1h;
80 _collection_set = collection_set;
81
82 assert(Heap_lock->owned_by_self(), "Locking discipline.");
83
84 if (!adaptive_young_list_length()) {
85 _young_list_fixed_length = _young_gen_sizer.min_desired_young_length();
86 }
|