comparison src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @ 4836:d30fa85f9994

6484965: G1: piggy-back liveness accounting phase on marking Summary: Remove the separate counting phase of concurrent marking by tracking the amount of marked bytes and the cards spanned by marked objects in marking task/worker thread local data structures, which are updated as individual objects are marked. Reviewed-by: brutisso, tonyp
author johnc
date Thu, 12 Jan 2012 00:06:47 -0800
parents 00dd86e542eb
children eff609af17d7
comparison
equal deleted inserted replaced
4835:877914d90c57 4836:d30fa85f9994
1 /* 1 /*
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2012, 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.
42 ConcurrentGCThread(), 42 ConcurrentGCThread(),
43 _cm(cm), 43 _cm(cm),
44 _started(false), 44 _started(false),
45 _in_progress(false), 45 _in_progress(false),
46 _vtime_accum(0.0), 46 _vtime_accum(0.0),
47 _vtime_mark_accum(0.0), 47 _vtime_mark_accum(0.0) {
48 _vtime_count_accum(0.0)
49 {
50 create_and_start(); 48 create_and_start();
51 } 49 }
52 50
53 class CMCheckpointRootsFinalClosure: public VoidClosure { 51 class CMCheckpointRootsFinalClosure: public VoidClosure {
54 52
146 gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]"); 144 gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
147 } 145 }
148 } 146 }
149 } while (cm()->restart_for_overflow()); 147 } while (cm()->restart_for_overflow());
150 148
151 double counting_start_time = os::elapsedVTime();
152 if (!cm()->has_aborted()) {
153 double count_start_sec = os::elapsedTime();
154 if (PrintGC) {
155 gclog_or_tty->date_stamp(PrintGCDateStamps);
156 gclog_or_tty->stamp(PrintGCTimeStamps);
157 gclog_or_tty->print_cr("[GC concurrent-count-start]");
158 }
159
160 _sts.join();
161 _cm->calcDesiredRegions();
162 _sts.leave();
163
164 if (!cm()->has_aborted()) {
165 double count_end_sec = os::elapsedTime();
166 if (PrintGC) {
167 gclog_or_tty->date_stamp(PrintGCDateStamps);
168 gclog_or_tty->stamp(PrintGCTimeStamps);
169 gclog_or_tty->print_cr("[GC concurrent-count-end, %1.7lf]",
170 count_end_sec - count_start_sec);
171 }
172 }
173 }
174
175 double end_time = os::elapsedVTime(); 149 double end_time = os::elapsedVTime();
176 _vtime_count_accum += (end_time - counting_start_time);
177 // Update the total virtual time before doing this, since it will try 150 // Update the total virtual time before doing this, since it will try
178 // to measure it to get the vtime for this marking. We purposely 151 // to measure it to get the vtime for this marking. We purposely
179 // neglect the presumably-short "completeCleanup" phase here. 152 // neglect the presumably-short "completeCleanup" phase here.
180 _vtime_accum = (end_time - _vtime_start); 153 _vtime_accum = (end_time - _vtime_start);
154
181 if (!cm()->has_aborted()) { 155 if (!cm()->has_aborted()) {
182 if (g1_policy->adaptive_young_list_length()) { 156 if (g1_policy->adaptive_young_list_length()) {
183 double now = os::elapsedTime(); 157 double now = os::elapsedTime();
184 double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms(); 158 double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms();
185 jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms); 159 jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms);