comparison src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @ 4872:aa3d708d67c4

7141200: log some interesting information in ring buffers for crashes Reviewed-by: kvn, jrose, kevinw, brutisso, twisti, jmasa
author never
date Wed, 01 Feb 2012 07:59:01 -0800
parents e7dead7e90af
children ab4422d0ed59
comparison
equal deleted inserted replaced
4871:f067b4e0e04b 4872:aa3d708d67c4
1 /* 1 /*
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 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.
981 heap->increment_total_collections(true); 981 heap->increment_total_collections(true);
982 982
983 // We need to track unique mark sweep invocations as well. 983 // We need to track unique mark sweep invocations as well.
984 _total_invocations++; 984 _total_invocations++;
985 985
986 if (PrintHeapAtGC) { 986 heap->print_heap_before_gc();
987 Universe::print_heap_before_gc();
988 }
989 987
990 // Fill in TLABs 988 // Fill in TLABs
991 heap->accumulate_statistics_all_tlabs(); 989 heap->accumulate_statistics_all_tlabs();
992 heap->ensure_parsability(true); // retire TLABs 990 heap->ensure_parsability(true); // retire TLABs
993 991
1836 #endif // #ifndef PRODUCT 1834 #endif // #ifndef PRODUCT
1837 1835
1838 void PSParallelCompact::summary_phase(ParCompactionManager* cm, 1836 void PSParallelCompact::summary_phase(ParCompactionManager* cm,
1839 bool maximum_compaction) 1837 bool maximum_compaction)
1840 { 1838 {
1841 EventMark m("2 summarize");
1842 TraceTime tm("summary phase", print_phases(), true, gclog_or_tty); 1839 TraceTime tm("summary phase", print_phases(), true, gclog_or_tty);
1843 // trace("2"); 1840 // trace("2");
1844 1841
1845 #ifdef ASSERT 1842 #ifdef ASSERT
1846 if (TraceParallelOldGCMarkingPhase) { 1843 if (TraceParallelOldGCMarkingPhase) {
2235 2232
2236 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); 2233 NOT_PRODUCT(ref_processor()->verify_no_references_recorded());
2237 2234
2238 collection_exit.update(); 2235 collection_exit.update();
2239 2236
2240 if (PrintHeapAtGC) { 2237 heap->print_heap_after_gc();
2241 Universe::print_heap_after_gc();
2242 }
2243 if (PrintGCTaskTimeStamps) { 2238 if (PrintGCTaskTimeStamps) {
2244 gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " 2239 gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " "
2245 INT64_FORMAT, 2240 INT64_FORMAT,
2246 marking_start.ticks(), compaction_start.ticks(), 2241 marking_start.ticks(), compaction_start.ticks(),
2247 collection_exit.ticks()); 2242 collection_exit.ticks());
2350 } 2345 }
2351 2346
2352 void PSParallelCompact::marking_phase(ParCompactionManager* cm, 2347 void PSParallelCompact::marking_phase(ParCompactionManager* cm,
2353 bool maximum_heap_compaction) { 2348 bool maximum_heap_compaction) {
2354 // Recursively traverse all live objects and mark them 2349 // Recursively traverse all live objects and mark them
2355 EventMark m("1 mark object");
2356 TraceTime tm("marking phase", print_phases(), true, gclog_or_tty); 2350 TraceTime tm("marking phase", print_phases(), true, gclog_or_tty);
2357 2351
2358 ParallelScavengeHeap* heap = gc_heap(); 2352 ParallelScavengeHeap* heap = gc_heap();
2359 uint parallel_gc_threads = heap->gc_task_manager()->workers(); 2353 uint parallel_gc_threads = heap->gc_task_manager()->workers();
2360 uint active_gc_threads = heap->gc_task_manager()->active_workers(); 2354 uint active_gc_threads = heap->gc_task_manager()->active_workers();
2436 }; 2430 };
2437 static PSAlwaysTrueClosure always_true; 2431 static PSAlwaysTrueClosure always_true;
2438 2432
2439 void PSParallelCompact::adjust_roots() { 2433 void PSParallelCompact::adjust_roots() {
2440 // Adjust the pointers to reflect the new locations 2434 // Adjust the pointers to reflect the new locations
2441 EventMark m("3 adjust roots");
2442 TraceTime tm("adjust roots", print_phases(), true, gclog_or_tty); 2435 TraceTime tm("adjust roots", print_phases(), true, gclog_or_tty);
2443 2436
2444 // General strong roots. 2437 // General strong roots.
2445 Universe::oops_do(adjust_root_pointer_closure()); 2438 Universe::oops_do(adjust_root_pointer_closure());
2446 JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles 2439 JNIHandles::oops_do(adjust_root_pointer_closure()); // Global (strong) JNI handles
2467 PSScavenge::reference_processor()->weak_oops_do( 2460 PSScavenge::reference_processor()->weak_oops_do(
2468 adjust_root_pointer_closure()); 2461 adjust_root_pointer_closure());
2469 } 2462 }
2470 2463
2471 void PSParallelCompact::compact_perm(ParCompactionManager* cm) { 2464 void PSParallelCompact::compact_perm(ParCompactionManager* cm) {
2472 EventMark m("4 compact perm");
2473 TraceTime tm("compact perm gen", print_phases(), true, gclog_or_tty); 2465 TraceTime tm("compact perm gen", print_phases(), true, gclog_or_tty);
2474 // trace("4"); 2466 // trace("4");
2475 2467
2476 gc_heap()->perm_gen()->start_array()->reset(); 2468 gc_heap()->perm_gen()->start_array()->reset();
2477 move_and_update(cm, perm_space_id); 2469 move_and_update(cm, perm_space_id);
2645 } 2637 }
2646 } 2638 }
2647 } 2639 }
2648 2640
2649 void PSParallelCompact::compact() { 2641 void PSParallelCompact::compact() {
2650 EventMark m("5 compact");
2651 // trace("5"); 2642 // trace("5");
2652 TraceTime tm("compaction phase", print_phases(), true, gclog_or_tty); 2643 TraceTime tm("compaction phase", print_phases(), true, gclog_or_tty);
2653 2644
2654 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); 2645 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
2655 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); 2646 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
3500 // filling holes in the dense prefix. 3491 // filling holes in the dense prefix.
3501 void PSParallelCompact::compact_prologue() { 3492 void PSParallelCompact::compact_prologue() {
3502 _updated_int_array_klass_obj = (klassOop) 3493 _updated_int_array_klass_obj = (klassOop)
3503 summary_data().calc_new_pointer(Universe::intArrayKlassObj()); 3494 summary_data().calc_new_pointer(Universe::intArrayKlassObj());
3504 } 3495 }
3505