comparison src/share/vm/memory/referenceProcessor.cpp @ 20190:0982ec23da03

8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps Reviewed-by: jwilhelm, ehelin, tschatzl
author brutisso
date Thu, 19 Jun 2014 13:31:14 +0200
parents 8e20ef014b08
children c2844108a708
comparison
equal deleted inserted replaced
20189:5d855d021755 20190:0982ec23da03
188 ReferenceProcessorStats ReferenceProcessor::process_discovered_references( 188 ReferenceProcessorStats ReferenceProcessor::process_discovered_references(
189 BoolObjectClosure* is_alive, 189 BoolObjectClosure* is_alive,
190 OopClosure* keep_alive, 190 OopClosure* keep_alive,
191 VoidClosure* complete_gc, 191 VoidClosure* complete_gc,
192 AbstractRefProcTaskExecutor* task_executor, 192 AbstractRefProcTaskExecutor* task_executor,
193 GCTimer* gc_timer) { 193 GCTimer* gc_timer,
194 GCId gc_id) {
194 NOT_PRODUCT(verify_ok_to_handle_reflists()); 195 NOT_PRODUCT(verify_ok_to_handle_reflists());
195 196
196 assert(!enqueuing_is_done(), "If here enqueuing should not be complete"); 197 assert(!enqueuing_is_done(), "If here enqueuing should not be complete");
197 // Stop treating discovered references specially. 198 // Stop treating discovered references specially.
198 disable_discovery(); 199 disable_discovery();
210 bool trace_time = PrintGCDetails && PrintReferenceGC; 211 bool trace_time = PrintGCDetails && PrintReferenceGC;
211 212
212 // Soft references 213 // Soft references
213 size_t soft_count = 0; 214 size_t soft_count = 0;
214 { 215 {
215 GCTraceTime tt("SoftReference", trace_time, false, gc_timer); 216 GCTraceTime tt("SoftReference", trace_time, false, gc_timer, gc_id);
216 soft_count = 217 soft_count =
217 process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true, 218 process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true,
218 is_alive, keep_alive, complete_gc, task_executor); 219 is_alive, keep_alive, complete_gc, task_executor);
219 } 220 }
220 221
221 update_soft_ref_master_clock(); 222 update_soft_ref_master_clock();
222 223
223 // Weak references 224 // Weak references
224 size_t weak_count = 0; 225 size_t weak_count = 0;
225 { 226 {
226 GCTraceTime tt("WeakReference", trace_time, false, gc_timer); 227 GCTraceTime tt("WeakReference", trace_time, false, gc_timer, gc_id);
227 weak_count = 228 weak_count =
228 process_discovered_reflist(_discoveredWeakRefs, NULL, true, 229 process_discovered_reflist(_discoveredWeakRefs, NULL, true,
229 is_alive, keep_alive, complete_gc, task_executor); 230 is_alive, keep_alive, complete_gc, task_executor);
230 } 231 }
231 232
232 // Final references 233 // Final references
233 size_t final_count = 0; 234 size_t final_count = 0;
234 { 235 {
235 GCTraceTime tt("FinalReference", trace_time, false, gc_timer); 236 GCTraceTime tt("FinalReference", trace_time, false, gc_timer, gc_id);
236 final_count = 237 final_count =
237 process_discovered_reflist(_discoveredFinalRefs, NULL, false, 238 process_discovered_reflist(_discoveredFinalRefs, NULL, false,
238 is_alive, keep_alive, complete_gc, task_executor); 239 is_alive, keep_alive, complete_gc, task_executor);
239 } 240 }
240 241
241 // Phantom references 242 // Phantom references
242 size_t phantom_count = 0; 243 size_t phantom_count = 0;
243 { 244 {
244 GCTraceTime tt("PhantomReference", trace_time, false, gc_timer); 245 GCTraceTime tt("PhantomReference", trace_time, false, gc_timer, gc_id);
245 phantom_count = 246 phantom_count =
246 process_discovered_reflist(_discoveredPhantomRefs, NULL, false, 247 process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
247 is_alive, keep_alive, complete_gc, task_executor); 248 is_alive, keep_alive, complete_gc, task_executor);
248 } 249 }
249 250
251 // traverse these simultaneously with the regular weak references above, but 252 // traverse these simultaneously with the regular weak references above, but
252 // that is not how the JDK1.2 specification is. See #4126360. Native code can 253 // that is not how the JDK1.2 specification is. See #4126360. Native code can
253 // thus use JNI weak references to circumvent the phantom references and 254 // thus use JNI weak references to circumvent the phantom references and
254 // resurrect a "post-mortem" object. 255 // resurrect a "post-mortem" object.
255 { 256 {
256 GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer); 257 GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer, gc_id);
257 if (task_executor != NULL) { 258 if (task_executor != NULL) {
258 task_executor->set_single_threaded_mode(); 259 task_executor->set_single_threaded_mode();
259 } 260 }
260 process_phaseJNI(is_alive, keep_alive, complete_gc); 261 process_phaseJNI(is_alive, keep_alive, complete_gc);
261 } 262 }
1249 void ReferenceProcessor::preclean_discovered_references( 1250 void ReferenceProcessor::preclean_discovered_references(
1250 BoolObjectClosure* is_alive, 1251 BoolObjectClosure* is_alive,
1251 OopClosure* keep_alive, 1252 OopClosure* keep_alive,
1252 VoidClosure* complete_gc, 1253 VoidClosure* complete_gc,
1253 YieldClosure* yield, 1254 YieldClosure* yield,
1254 GCTimer* gc_timer) { 1255 GCTimer* gc_timer,
1256 GCId gc_id) {
1255 1257
1256 NOT_PRODUCT(verify_ok_to_handle_reflists()); 1258 NOT_PRODUCT(verify_ok_to_handle_reflists());
1257 1259
1258 // Soft references 1260 // Soft references
1259 { 1261 {
1260 GCTraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC, 1262 GCTraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
1261 false, gc_timer); 1263 false, gc_timer, gc_id);
1262 for (uint i = 0; i < _max_num_q; i++) { 1264 for (uint i = 0; i < _max_num_q; i++) {
1263 if (yield->should_return()) { 1265 if (yield->should_return()) {
1264 return; 1266 return;
1265 } 1267 }
1266 preclean_discovered_reflist(_discoveredSoftRefs[i], is_alive, 1268 preclean_discovered_reflist(_discoveredSoftRefs[i], is_alive,
1269 } 1271 }
1270 1272
1271 // Weak references 1273 // Weak references
1272 { 1274 {
1273 GCTraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC, 1275 GCTraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
1274 false, gc_timer); 1276 false, gc_timer, gc_id);
1275 for (uint i = 0; i < _max_num_q; i++) { 1277 for (uint i = 0; i < _max_num_q; i++) {
1276 if (yield->should_return()) { 1278 if (yield->should_return()) {
1277 return; 1279 return;
1278 } 1280 }
1279 preclean_discovered_reflist(_discoveredWeakRefs[i], is_alive, 1281 preclean_discovered_reflist(_discoveredWeakRefs[i], is_alive,
1282 } 1284 }
1283 1285
1284 // Final references 1286 // Final references
1285 { 1287 {
1286 GCTraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC, 1288 GCTraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
1287 false, gc_timer); 1289 false, gc_timer, gc_id);
1288 for (uint i = 0; i < _max_num_q; i++) { 1290 for (uint i = 0; i < _max_num_q; i++) {
1289 if (yield->should_return()) { 1291 if (yield->should_return()) {
1290 return; 1292 return;
1291 } 1293 }
1292 preclean_discovered_reflist(_discoveredFinalRefs[i], is_alive, 1294 preclean_discovered_reflist(_discoveredFinalRefs[i], is_alive,
1295 } 1297 }
1296 1298
1297 // Phantom references 1299 // Phantom references
1298 { 1300 {
1299 GCTraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC, 1301 GCTraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
1300 false, gc_timer); 1302 false, gc_timer, gc_id);
1301 for (uint i = 0; i < _max_num_q; i++) { 1303 for (uint i = 0; i < _max_num_q; i++) {
1302 if (yield->should_return()) { 1304 if (yield->should_return()) {
1303 return; 1305 return;
1304 } 1306 }
1305 preclean_discovered_reflist(_discoveredPhantomRefs[i], is_alive, 1307 preclean_discovered_reflist(_discoveredPhantomRefs[i], is_alive,