Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @ 10405:f2110083203d
8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author | sla |
---|---|
date | Mon, 10 Jun 2013 11:30:51 +0200 |
parents | 633ba56cb013 |
children | 86e6d691f2e1 |
comparison
equal
deleted
inserted
replaced
10404:d0add7016434 | 10405:f2110083203d |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
24 | 24 |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp" | 26 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp" |
27 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" | 27 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" |
28 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp" | 28 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp" |
29 #include "gc_implementation/shared/gcTimer.hpp" | |
30 #include "gc_implementation/shared/gcTraceTime.hpp" | |
29 #include "gc_implementation/shared/isGCActiveMark.hpp" | 31 #include "gc_implementation/shared/isGCActiveMark.hpp" |
30 #include "memory/gcLocker.inline.hpp" | 32 #include "memory/gcLocker.inline.hpp" |
31 #include "runtime/interfaceSupport.hpp" | 33 #include "runtime/interfaceSupport.hpp" |
34 #include "runtime/os.hpp" | |
32 #include "utilities/dtrace.hpp" | 35 #include "utilities/dtrace.hpp" |
33 | 36 |
34 | 37 |
35 #ifndef USDT2 | 38 #ifndef USDT2 |
36 HS_DTRACE_PROBE_DECL(hs_private, cms__initmark__begin); | 39 HS_DTRACE_PROBE_DECL(hs_private, cms__initmark__begin); |
58 } | 61 } |
59 | 62 |
60 void VM_CMS_Operation::verify_before_gc() { | 63 void VM_CMS_Operation::verify_before_gc() { |
61 if (VerifyBeforeGC && | 64 if (VerifyBeforeGC && |
62 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { | 65 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { |
66 GCTraceTime tm("Verify Before", false, false, _collector->_gc_timer_cm); | |
63 HandleMark hm; | 67 HandleMark hm; |
64 FreelistLocker x(_collector); | 68 FreelistLocker x(_collector); |
65 MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag); | 69 MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag); |
66 Universe::heap()->prepare_for_verify(); | 70 Universe::heap()->prepare_for_verify(); |
67 Universe::verify(); | 71 Universe::verify(); |
69 } | 73 } |
70 | 74 |
71 void VM_CMS_Operation::verify_after_gc() { | 75 void VM_CMS_Operation::verify_after_gc() { |
72 if (VerifyAfterGC && | 76 if (VerifyAfterGC && |
73 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { | 77 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { |
78 GCTraceTime tm("Verify After", false, false, _collector->_gc_timer_cm); | |
74 HandleMark hm; | 79 HandleMark hm; |
75 FreelistLocker x(_collector); | 80 FreelistLocker x(_collector); |
76 MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag); | 81 MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag); |
77 Universe::verify(); | 82 Universe::verify(); |
78 } | 83 } |
138 #else /* USDT2 */ | 143 #else /* USDT2 */ |
139 HS_PRIVATE_CMS_INITMARK_BEGIN( | 144 HS_PRIVATE_CMS_INITMARK_BEGIN( |
140 ); | 145 ); |
141 #endif /* USDT2 */ | 146 #endif /* USDT2 */ |
142 | 147 |
148 _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark", os::elapsed_counter()); | |
149 | |
143 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 150 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
144 GCCauseSetter gccs(gch, GCCause::_cms_initial_mark); | 151 GCCauseSetter gccs(gch, GCCause::_cms_initial_mark); |
145 | 152 |
146 VM_CMS_Operation::verify_before_gc(); | 153 VM_CMS_Operation::verify_before_gc(); |
147 | 154 |
148 IsGCActiveMark x; // stop-world GC active | 155 IsGCActiveMark x; // stop-world GC active |
149 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause()); | 156 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause()); |
150 | 157 |
151 VM_CMS_Operation::verify_after_gc(); | 158 VM_CMS_Operation::verify_after_gc(); |
159 | |
160 _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter()); | |
161 | |
152 #ifndef USDT2 | 162 #ifndef USDT2 |
153 HS_DTRACE_PROBE(hs_private, cms__initmark__end); | 163 HS_DTRACE_PROBE(hs_private, cms__initmark__end); |
154 #else /* USDT2 */ | 164 #else /* USDT2 */ |
155 HS_PRIVATE_CMS_INITMARK_END( | 165 HS_PRIVATE_CMS_INITMARK_END( |
156 ); | 166 ); |
170 #else /* USDT2 */ | 180 #else /* USDT2 */ |
171 HS_PRIVATE_CMS_REMARK_BEGIN( | 181 HS_PRIVATE_CMS_REMARK_BEGIN( |
172 ); | 182 ); |
173 #endif /* USDT2 */ | 183 #endif /* USDT2 */ |
174 | 184 |
185 _collector->_gc_timer_cm->register_gc_pause_start("Final Mark", os::elapsed_counter()); | |
186 | |
175 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 187 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
176 GCCauseSetter gccs(gch, GCCause::_cms_final_remark); | 188 GCCauseSetter gccs(gch, GCCause::_cms_final_remark); |
177 | 189 |
178 VM_CMS_Operation::verify_before_gc(); | 190 VM_CMS_Operation::verify_before_gc(); |
179 | 191 |
180 IsGCActiveMark x; // stop-world GC active | 192 IsGCActiveMark x; // stop-world GC active |
181 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause()); | 193 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause()); |
182 | 194 |
183 VM_CMS_Operation::verify_after_gc(); | 195 VM_CMS_Operation::verify_after_gc(); |
196 | |
197 _collector->save_heap_summary(); | |
198 _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter()); | |
199 | |
184 #ifndef USDT2 | 200 #ifndef USDT2 |
185 HS_DTRACE_PROBE(hs_private, cms__remark__end); | 201 HS_DTRACE_PROBE(hs_private, cms__remark__end); |
186 #else /* USDT2 */ | 202 #else /* USDT2 */ |
187 HS_PRIVATE_CMS_REMARK_END( | 203 HS_PRIVATE_CMS_REMARK_END( |
188 ); | 204 ); |
223 CMSCollector::disable_icms(); | 239 CMSCollector::disable_icms(); |
224 _disabled_icms = true; | 240 _disabled_icms = true; |
225 // In case CMS thread was in icms_wait(), wake it up. | 241 // In case CMS thread was in icms_wait(), wake it up. |
226 CMSCollector::start_icms(); | 242 CMSCollector::start_icms(); |
227 // Nudge the CMS thread to start a concurrent collection. | 243 // Nudge the CMS thread to start a concurrent collection. |
228 CMSCollector::request_full_gc(_full_gc_count_before); | 244 CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause); |
229 } else { | 245 } else { |
230 assert(_full_gc_count_before < gch->total_full_collections(), "Error"); | 246 assert(_full_gc_count_before < gch->total_full_collections(), "Error"); |
231 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done | 247 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done |
232 } | 248 } |
233 } | 249 } |