1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 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 |
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp" |
28 #include "gc_implementation/g1/g1CollectorPolicy.hpp" |
29 #include "gc_implementation/g1/g1Log.hpp" |
29 #include "gc_implementation/g1/g1Log.hpp" |
30 #include "gc_implementation/g1/g1MMUTracker.hpp" |
30 #include "gc_implementation/g1/g1MMUTracker.hpp" |
31 #include "gc_implementation/g1/vm_operations_g1.hpp" |
31 #include "gc_implementation/g1/vm_operations_g1.hpp" |
|
32 #include "gc_implementation/shared/gcTrace.hpp" |
32 #include "memory/resourceArea.hpp" |
33 #include "memory/resourceArea.hpp" |
33 #include "runtime/vmThread.hpp" |
34 #include "runtime/vmThread.hpp" |
34 |
35 |
35 // ======= Concurrent Mark Thread ======== |
36 // ======= Concurrent Mark Thread ======== |
36 |
37 |
107 // correctness issue. |
108 // correctness issue. |
108 |
109 |
109 double scan_start = os::elapsedTime(); |
110 double scan_start = os::elapsedTime(); |
110 if (!cm()->has_aborted()) { |
111 if (!cm()->has_aborted()) { |
111 if (G1Log::fine()) { |
112 if (G1Log::fine()) { |
112 gclog_or_tty->date_stamp(PrintGCDateStamps); |
113 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
113 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
114 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]"); |
114 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]"); |
115 } |
115 } |
116 |
116 |
117 _cm->scanRootRegions(); |
117 _cm->scanRootRegions(); |
118 |
118 |
119 double scan_end = os::elapsedTime(); |
119 double scan_end = os::elapsedTime(); |
120 if (G1Log::fine()) { |
120 if (G1Log::fine()) { |
121 gclog_or_tty->date_stamp(PrintGCDateStamps); |
121 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
122 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
123 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]", |
122 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]", |
124 scan_end - scan_start); |
123 scan_end - scan_start); |
125 } |
124 } |
126 } |
125 } |
127 |
126 |
128 double mark_start_sec = os::elapsedTime(); |
127 double mark_start_sec = os::elapsedTime(); |
129 if (G1Log::fine()) { |
128 if (G1Log::fine()) { |
130 gclog_or_tty->date_stamp(PrintGCDateStamps); |
129 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
131 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
132 gclog_or_tty->print_cr("[GC concurrent-mark-start]"); |
130 gclog_or_tty->print_cr("[GC concurrent-mark-start]"); |
133 } |
131 } |
134 |
132 |
135 int iter = 0; |
133 int iter = 0; |
136 do { |
134 do { |
149 jlong sleep_time_ms = mmu_tracker->when_ms(now, remark_prediction_ms); |
147 jlong sleep_time_ms = mmu_tracker->when_ms(now, remark_prediction_ms); |
150 os::sleep(current_thread, sleep_time_ms, false); |
148 os::sleep(current_thread, sleep_time_ms, false); |
151 } |
149 } |
152 |
150 |
153 if (G1Log::fine()) { |
151 if (G1Log::fine()) { |
154 gclog_or_tty->date_stamp(PrintGCDateStamps); |
152 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
155 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
156 gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf secs]", |
153 gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf secs]", |
157 mark_end_sec - mark_start_sec); |
154 mark_end_sec - mark_start_sec); |
158 } |
155 } |
159 |
156 |
160 CMCheckpointRootsFinalClosure final_cl(_cm); |
157 CMCheckpointRootsFinalClosure final_cl(_cm); |
165 if (G1TraceMarkStackOverflow) { |
162 if (G1TraceMarkStackOverflow) { |
166 gclog_or_tty->print_cr("Restarting conc marking because of MS overflow " |
163 gclog_or_tty->print_cr("Restarting conc marking because of MS overflow " |
167 "in remark (restart #%d).", iter); |
164 "in remark (restart #%d).", iter); |
168 } |
165 } |
169 if (G1Log::fine()) { |
166 if (G1Log::fine()) { |
170 gclog_or_tty->date_stamp(PrintGCDateStamps); |
167 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
171 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
172 gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]"); |
168 gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]"); |
173 } |
169 } |
174 } |
170 } |
175 } while (cm()->restart_for_overflow()); |
171 } while (cm()->restart_for_overflow()); |
176 |
172 |
210 // place, it would wait for us to process the regions |
206 // place, it would wait for us to process the regions |
211 // reclaimed by cleanup. |
207 // reclaimed by cleanup. |
212 |
208 |
213 double cleanup_start_sec = os::elapsedTime(); |
209 double cleanup_start_sec = os::elapsedTime(); |
214 if (G1Log::fine()) { |
210 if (G1Log::fine()) { |
215 gclog_or_tty->date_stamp(PrintGCDateStamps); |
211 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
216 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
217 gclog_or_tty->print_cr("[GC concurrent-cleanup-start]"); |
212 gclog_or_tty->print_cr("[GC concurrent-cleanup-start]"); |
218 } |
213 } |
219 |
214 |
220 // Now do the concurrent cleanup operation. |
215 // Now do the concurrent cleanup operation. |
221 _cm->completeCleanup(); |
216 _cm->completeCleanup(); |
231 // the GC workers finishing. |
226 // the GC workers finishing. |
232 g1h->reset_free_regions_coming(); |
227 g1h->reset_free_regions_coming(); |
233 |
228 |
234 double cleanup_end_sec = os::elapsedTime(); |
229 double cleanup_end_sec = os::elapsedTime(); |
235 if (G1Log::fine()) { |
230 if (G1Log::fine()) { |
236 gclog_or_tty->date_stamp(PrintGCDateStamps); |
231 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); |
237 gclog_or_tty->stamp(PrintGCTimeStamps); |
|
238 gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf secs]", |
232 gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf secs]", |
239 cleanup_end_sec - cleanup_start_sec); |
233 cleanup_end_sec - cleanup_start_sec); |
240 } |
234 } |
241 } |
235 } |
242 guarantee(cm()->cleanup_list_is_empty(), |
236 guarantee(cm()->cleanup_list_is_empty(), |