author | kbarrett |
Tue, 12 Jun 2018 18:12:59 -0400 | |
changeset 50532 | a18c60527166 |
parent 50097 | ed8a43d83fcc |
child 51332 | c25572739e7c |
permissions | -rw-r--r-- |
49659
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
1 |
/* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
4 |
* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
8 |
* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
13 |
* accompanied this code). |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
14 |
* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
18 |
* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
21 |
* questions. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
22 |
* |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
23 |
*/ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
24 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
26 |
#include "classfile/classLoaderData.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
27 |
#include "gc/g1/g1Analytics.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
28 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
29 |
#include "gc/g1/g1ConcurrentMark.inline.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
30 |
#include "gc/g1/g1ConcurrentMarkThread.inline.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
31 |
#include "gc/g1/g1MMUTracker.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
32 |
#include "gc/g1/g1Policy.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
33 |
#include "gc/g1/g1RemSet.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
34 |
#include "gc/g1/vm_operations_g1.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
35 |
#include "gc/shared/concurrentGCPhaseManager.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
36 |
#include "gc/shared/gcId.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
37 |
#include "gc/shared/gcTrace.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
38 |
#include "gc/shared/gcTraceTime.inline.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
39 |
#include "gc/shared/suspendibleThreadSet.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
40 |
#include "logging/log.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
41 |
#include "memory/resourceArea.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
42 |
#include "runtime/handles.inline.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
43 |
#include "runtime/vmThread.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
44 |
#include "utilities/debug.hpp" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
45 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
46 |
// ======= Concurrent Mark Thread ======== |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
47 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
48 |
// Check order in EXPAND_CURRENT_PHASES |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
49 |
STATIC_ASSERT(ConcurrentGCPhaseManager::UNCONSTRAINED_PHASE < |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
50 |
ConcurrentGCPhaseManager::IDLE_PHASE); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
51 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
52 |
#define EXPAND_CONCURRENT_PHASES(expander) \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
53 |
expander(ANY, = ConcurrentGCPhaseManager::UNCONSTRAINED_PHASE, NULL) \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
54 |
expander(IDLE, = ConcurrentGCPhaseManager::IDLE_PHASE, NULL) \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
55 |
expander(CONCURRENT_CYCLE,, "Concurrent Cycle") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
56 |
expander(CLEAR_CLAIMED_MARKS,, "Concurrent Clear Claimed Marks") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
57 |
expander(SCAN_ROOT_REGIONS,, "Concurrent Scan Root Regions") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
58 |
expander(CONCURRENT_MARK,, "Concurrent Mark") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
59 |
expander(MARK_FROM_ROOTS,, "Concurrent Mark From Roots") \ |
50097
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
60 |
expander(PRECLEAN,, "Concurrent Preclean") \ |
49659
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
61 |
expander(BEFORE_REMARK,, NULL) \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
62 |
expander(REMARK,, NULL) \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
63 |
expander(REBUILD_REMEMBERED_SETS,, "Concurrent Rebuild Remembered Sets") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
64 |
expander(CLEANUP_FOR_NEXT_MARK,, "Concurrent Cleanup for Next Mark") \ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
65 |
/* */ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
66 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
67 |
class G1ConcurrentPhase : public AllStatic { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
68 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
69 |
enum { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
70 |
#define CONCURRENT_PHASE_ENUM(tag, value, ignore_title) tag value, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
71 |
EXPAND_CONCURRENT_PHASES(CONCURRENT_PHASE_ENUM) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
72 |
#undef CONCURRENT_PHASE_ENUM |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
73 |
PHASE_ID_LIMIT |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
74 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
75 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
76 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
77 |
// The CM thread is created when the G1 garbage collector is used |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
78 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
79 |
G1ConcurrentMarkThread::G1ConcurrentMarkThread(G1ConcurrentMark* cm) : |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
80 |
ConcurrentGCThread(), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
81 |
_cm(cm), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
82 |
_state(Idle), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
83 |
_phase_manager_stack(), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
84 |
_vtime_accum(0.0), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
85 |
_vtime_mark_accum(0.0) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
86 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
87 |
set_name("G1 Main Marker"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
88 |
create_and_start(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
89 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
90 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
91 |
class CMRemark : public VoidClosure { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
92 |
G1ConcurrentMark* _cm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
93 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
94 |
CMRemark(G1ConcurrentMark* cm) : _cm(cm) {} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
95 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
96 |
void do_void(){ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
97 |
_cm->remark(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
98 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
99 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
100 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
101 |
class CMCleanup : public VoidClosure { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
102 |
G1ConcurrentMark* _cm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
103 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
104 |
CMCleanup(G1ConcurrentMark* cm) : _cm(cm) {} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
105 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
106 |
void do_void(){ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
107 |
_cm->cleanup(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
108 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
109 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
110 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
111 |
double G1ConcurrentMarkThread::mmu_sleep_time(G1Policy* g1_policy, bool remark) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
112 |
// There are 3 reasons to use SuspendibleThreadSetJoiner. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
113 |
// 1. To avoid concurrency problem. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
114 |
// - G1MMUTracker::add_pause(), when_sec() and its variation(when_ms() etc..) can be called |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
115 |
// concurrently from ConcurrentMarkThread and VMThread. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
116 |
// 2. If currently a gc is running, but it has not yet updated the MMU, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
117 |
// we will not forget to consider that pause in the MMU calculation. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
118 |
// 3. If currently a gc is running, ConcurrentMarkThread will wait it to be finished. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
119 |
// And then sleep for predicted amount of time by delay_to_keep_mmu(). |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
120 |
SuspendibleThreadSetJoiner sts_join; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
121 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
122 |
const G1Analytics* analytics = g1_policy->analytics(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
123 |
double now = os::elapsedTime(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
124 |
double prediction_ms = remark ? analytics->predict_remark_time_ms() |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
125 |
: analytics->predict_cleanup_time_ms(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
126 |
G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
127 |
return mmu_tracker->when_ms(now, prediction_ms); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
128 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
129 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
130 |
void G1ConcurrentMarkThread::delay_to_keep_mmu(G1Policy* g1_policy, bool remark) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
131 |
if (g1_policy->adaptive_young_list_length()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
132 |
jlong sleep_time_ms = mmu_sleep_time(g1_policy, remark); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
133 |
if (!_cm->has_aborted() && sleep_time_ms > 0) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
134 |
os::sleep(this, sleep_time_ms, false); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
135 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
136 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
137 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
138 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
139 |
class G1ConcPhaseTimer : public GCTraceConcTimeImpl<LogLevel::Info, LOG_TAGS(gc, marking)> { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
140 |
G1ConcurrentMark* _cm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
141 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
142 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
143 |
G1ConcPhaseTimer(G1ConcurrentMark* cm, const char* title) : |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
144 |
GCTraceConcTimeImpl<LogLevel::Info, LogTag::_gc, LogTag::_marking>(title), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
145 |
_cm(cm) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
146 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
147 |
_cm->gc_timer_cm()->register_gc_concurrent_start(title); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
148 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
149 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
150 |
~G1ConcPhaseTimer() { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
151 |
_cm->gc_timer_cm()->register_gc_concurrent_end(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
152 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
153 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
154 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
155 |
static const char* const concurrent_phase_names[] = { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
156 |
#define CONCURRENT_PHASE_NAME(tag, ignore_value, ignore_title) XSTR(tag), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
157 |
EXPAND_CONCURRENT_PHASES(CONCURRENT_PHASE_NAME) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
158 |
#undef CONCURRENT_PHASE_NAME |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
159 |
NULL // terminator |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
160 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
161 |
// Verify dense enum assumption. +1 for terminator. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
162 |
STATIC_ASSERT(G1ConcurrentPhase::PHASE_ID_LIMIT + 1 == |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
163 |
ARRAY_SIZE(concurrent_phase_names)); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
164 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
165 |
// Returns the phase number for name, or a negative value if unknown. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
166 |
static int lookup_concurrent_phase(const char* name) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
167 |
const char* const* names = concurrent_phase_names; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
168 |
for (uint i = 0; names[i] != NULL; ++i) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
169 |
if (strcmp(name, names[i]) == 0) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
170 |
return static_cast<int>(i); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
171 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
172 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
173 |
return -1; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
174 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
175 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
176 |
// The phase must be valid and must have a title. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
177 |
static const char* lookup_concurrent_phase_title(int phase) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
178 |
static const char* const titles[] = { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
179 |
#define CONCURRENT_PHASE_TITLE(ignore_tag, ignore_value, title) title, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
180 |
EXPAND_CONCURRENT_PHASES(CONCURRENT_PHASE_TITLE) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
181 |
#undef CONCURRENT_PHASE_TITLE |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
182 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
183 |
// Verify dense enum assumption. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
184 |
STATIC_ASSERT(G1ConcurrentPhase::PHASE_ID_LIMIT == ARRAY_SIZE(titles)); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
185 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
186 |
assert(0 <= phase, "precondition"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
187 |
assert((uint)phase < ARRAY_SIZE(titles), "precondition"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
188 |
const char* title = titles[phase]; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
189 |
assert(title != NULL, "precondition"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
190 |
return title; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
191 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
192 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
193 |
class G1ConcPhaseManager : public StackObj { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
194 |
G1ConcurrentMark* _cm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
195 |
ConcurrentGCPhaseManager _manager; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
196 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
197 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
198 |
G1ConcPhaseManager(int phase, G1ConcurrentMarkThread* thread) : |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
199 |
_cm(thread->cm()), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
200 |
_manager(phase, thread->phase_manager_stack()) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
201 |
{ } |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
202 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
203 |
~G1ConcPhaseManager() { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
204 |
// Deactivate the manager if marking aborted, to avoid blocking on |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
205 |
// phase exit when the phase has been requested. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
206 |
if (_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
207 |
_manager.deactivate(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
208 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
209 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
210 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
211 |
void set_phase(int phase, bool force) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
212 |
_manager.set_phase(phase, force); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
213 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
214 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
215 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
216 |
// Combine phase management and timing into one convenient utility. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
217 |
class G1ConcPhase : public StackObj { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
218 |
G1ConcPhaseTimer _timer; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
219 |
G1ConcPhaseManager _manager; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
220 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
221 |
public: |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
222 |
G1ConcPhase(int phase, G1ConcurrentMarkThread* thread) : |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
223 |
_timer(thread->cm(), lookup_concurrent_phase_title(phase)), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
224 |
_manager(phase, thread) |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
225 |
{ } |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
226 |
}; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
227 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
228 |
const char* const* G1ConcurrentMarkThread::concurrent_phases() const { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
229 |
return concurrent_phase_names; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
230 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
231 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
232 |
bool G1ConcurrentMarkThread::request_concurrent_phase(const char* phase_name) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
233 |
int phase = lookup_concurrent_phase(phase_name); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
234 |
if (phase < 0) return false; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
235 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
236 |
while (!ConcurrentGCPhaseManager::wait_for_phase(phase, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
237 |
phase_manager_stack())) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
238 |
assert(phase != G1ConcurrentPhase::ANY, "Wait for ANY phase must succeed"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
239 |
if ((phase != G1ConcurrentPhase::IDLE) && !during_cycle()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
240 |
// If idle and the goal is !idle, start a collection. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
241 |
G1CollectedHeap::heap()->collect(GCCause::_wb_conc_mark); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
242 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
243 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
244 |
return true; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
245 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
246 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
247 |
void G1ConcurrentMarkThread::run_service() { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
248 |
_vtime_start = os::elapsedVTime(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
249 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
250 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
251 |
G1Policy* g1_policy = g1h->g1_policy(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
252 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
253 |
G1ConcPhaseManager cpmanager(G1ConcurrentPhase::IDLE, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
254 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
255 |
while (!should_terminate()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
256 |
// wait until started is set. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
257 |
sleep_before_next_cycle(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
258 |
if (should_terminate()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
259 |
break; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
260 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
261 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
262 |
cpmanager.set_phase(G1ConcurrentPhase::CONCURRENT_CYCLE, false /* force */); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
263 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
264 |
GCIdMark gc_id_mark; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
265 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
266 |
_cm->concurrent_cycle_start(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
267 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
268 |
GCTraceConcTime(Info, gc) tt("Concurrent Cycle"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
269 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
270 |
ResourceMark rm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
271 |
HandleMark hm; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
272 |
double cycle_start = os::elapsedVTime(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
273 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
274 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
275 |
G1ConcPhase p(G1ConcurrentPhase::CLEAR_CLAIMED_MARKS, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
276 |
ClassLoaderDataGraph::clear_claimed_marks(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
277 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
278 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
279 |
// We have to ensure that we finish scanning the root regions |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
280 |
// before the next GC takes place. To ensure this we have to |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
281 |
// make sure that we do not join the STS until the root regions |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
282 |
// have been scanned. If we did then it's possible that a |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
283 |
// subsequent GC could block us from joining the STS and proceed |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
284 |
// without the root regions have been scanned which would be a |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
285 |
// correctness issue. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
286 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
287 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
288 |
G1ConcPhase p(G1ConcurrentPhase::SCAN_ROOT_REGIONS, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
289 |
_cm->scan_root_regions(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
290 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
291 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
292 |
// It would be nice to use the G1ConcPhase class here but |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
293 |
// the "end" logging is inside the loop and not at the end of |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
294 |
// a scope. Also, the timer doesn't support nesting. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
295 |
// Mimicking the same log output instead. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
296 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
297 |
G1ConcPhaseManager mark_manager(G1ConcurrentPhase::CONCURRENT_MARK, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
298 |
jlong mark_start = os::elapsed_counter(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
299 |
const char* cm_title = lookup_concurrent_phase_title(G1ConcurrentPhase::CONCURRENT_MARK); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
300 |
log_info(gc, marking)("%s (%.3fs)", |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
301 |
cm_title, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
302 |
TimeHelper::counter_to_seconds(mark_start)); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
303 |
for (uint iter = 1; !_cm->has_aborted(); ++iter) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
304 |
// Concurrent marking. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
305 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
306 |
G1ConcPhase p(G1ConcurrentPhase::MARK_FROM_ROOTS, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
307 |
_cm->mark_from_roots(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
308 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
309 |
if (_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
310 |
break; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
311 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
312 |
|
50097
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
313 |
if (G1UseReferencePrecleaning) { |
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
314 |
G1ConcPhase p(G1ConcurrentPhase::PRECLEAN, this); |
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
315 |
_cm->preclean(); |
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
316 |
} |
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
317 |
|
ed8a43d83fcc
8201491: G1 support for java.lang.ref.Reference precleaning
tschatzl
parents:
49668
diff
changeset
|
318 |
// Provide a control point before remark. |
49659
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
319 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
320 |
G1ConcPhaseManager p(G1ConcurrentPhase::BEFORE_REMARK, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
321 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
322 |
if (_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
323 |
break; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
324 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
325 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
326 |
// Delay remark pause for MMU. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
327 |
double mark_end_time = os::elapsedVTime(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
328 |
jlong mark_end = os::elapsed_counter(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
329 |
_vtime_mark_accum += (mark_end_time - cycle_start); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
330 |
delay_to_keep_mmu(g1_policy, true /* remark */); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
331 |
if (_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
332 |
break; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
333 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
334 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
335 |
// Pause Remark. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
336 |
log_info(gc, marking)("%s (%.3fs, %.3fs) %.3fms", |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
337 |
cm_title, |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
338 |
TimeHelper::counter_to_seconds(mark_start), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
339 |
TimeHelper::counter_to_seconds(mark_end), |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
340 |
TimeHelper::counter_to_millis(mark_end - mark_start)); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
341 |
mark_manager.set_phase(G1ConcurrentPhase::REMARK, false); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
342 |
CMRemark cl(_cm); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
343 |
VM_CGC_Operation op(&cl, "Pause Remark"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
344 |
VMThread::execute(&op); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
345 |
if (_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
346 |
break; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
347 |
} else if (!_cm->restart_for_overflow()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
348 |
break; // Exit loop if no restart requested. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
349 |
} else { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
350 |
// Loop to restart for overflow. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
351 |
mark_manager.set_phase(G1ConcurrentPhase::CONCURRENT_MARK, false); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
352 |
log_info(gc, marking)("%s Restart for Mark Stack Overflow (iteration #%u)", |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
353 |
cm_title, iter); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
354 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
355 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
356 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
357 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
358 |
if (!_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
359 |
G1ConcPhase p(G1ConcurrentPhase::REBUILD_REMEMBERED_SETS, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
360 |
_cm->rebuild_rem_set_concurrently(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
361 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
362 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
363 |
double end_time = os::elapsedVTime(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
364 |
// Update the total virtual time before doing this, since it will try |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
365 |
// to measure it to get the vtime for this marking. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
366 |
_vtime_accum = (end_time - _vtime_start); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
367 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
368 |
if (!_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
369 |
delay_to_keep_mmu(g1_policy, false /* cleanup */); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
370 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
371 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
372 |
if (!_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
373 |
CMCleanup cl_cl(_cm); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
374 |
VM_CGC_Operation op(&cl_cl, "Pause Cleanup"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
375 |
VMThread::execute(&op); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
376 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
377 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
378 |
// We now want to allow clearing of the marking bitmap to be |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
379 |
// suspended by a collection pause. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
380 |
// We may have aborted just before the remark. Do not bother clearing the |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
381 |
// bitmap then, as it has been done during mark abort. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
382 |
if (!_cm->has_aborted()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
383 |
G1ConcPhase p(G1ConcurrentPhase::CLEANUP_FOR_NEXT_MARK, this); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
384 |
_cm->cleanup_for_next_mark(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
385 |
} else { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
386 |
assert(!G1VerifyBitmaps || _cm->next_mark_bitmap_is_clear(), "Next mark bitmap must be clear"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
387 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
388 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
389 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
390 |
// Update the number of full collections that have been |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
391 |
// completed. This will also notify the FullGCCount_lock in case a |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
392 |
// Java thread is waiting for a full GC to happen (e.g., it |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
393 |
// called System.gc() with +ExplicitGCInvokesConcurrent). |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
394 |
{ |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
395 |
SuspendibleThreadSetJoiner sts_join; |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
396 |
g1h->increment_old_marking_cycles_completed(true /* concurrent */); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
397 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
398 |
_cm->concurrent_cycle_end(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
399 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
400 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
401 |
cpmanager.set_phase(G1ConcurrentPhase::IDLE, _cm->has_aborted() /* force */); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
402 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
403 |
_cm->root_regions()->cancel_scan(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
404 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
405 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
406 |
void G1ConcurrentMarkThread::stop_service() { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
407 |
MutexLockerEx ml(CGC_lock, Mutex::_no_safepoint_check_flag); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
408 |
CGC_lock->notify_all(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
409 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
410 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
411 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
412 |
void G1ConcurrentMarkThread::sleep_before_next_cycle() { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
413 |
// We join here because we don't want to do the "shouldConcurrentMark()" |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
414 |
// below while the world is otherwise stopped. |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
415 |
assert(!in_progress(), "should have been cleared"); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
416 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
417 |
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
418 |
while (!started() && !should_terminate()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
419 |
CGC_lock->wait(Mutex::_no_safepoint_check_flag); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
420 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
421 |
|
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
422 |
if (started()) { |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
423 |
set_in_progress(); |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
424 |
} |
0ed1370f52bb
8200371: In g1, rename ConcurrentMarkThread to G1ConcurrentMarkThread
lkorinth
parents:
diff
changeset
|
425 |
} |