Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.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 | 5534bd30c151 |
children | c49c7f835e8d |
comparison
equal
deleted
inserted
replaced
10404:d0add7016434 | 10405:f2110083203d |
---|---|
37 #include "gc_implementation/parallelScavenge/psOldGen.hpp" | 37 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
38 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" | 38 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
39 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" | 39 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" |
40 #include "gc_implementation/parallelScavenge/psScavenge.hpp" | 40 #include "gc_implementation/parallelScavenge/psScavenge.hpp" |
41 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" | 41 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" |
42 #include "gc_implementation/shared/gcHeapSummary.hpp" | |
43 #include "gc_implementation/shared/gcTimer.hpp" | |
44 #include "gc_implementation/shared/gcTrace.hpp" | |
45 #include "gc_implementation/shared/gcTraceTime.hpp" | |
42 #include "gc_implementation/shared/isGCActiveMark.hpp" | 46 #include "gc_implementation/shared/isGCActiveMark.hpp" |
43 #include "gc_interface/gcCause.hpp" | 47 #include "gc_interface/gcCause.hpp" |
44 #include "memory/gcLocker.inline.hpp" | 48 #include "memory/gcLocker.inline.hpp" |
45 #include "memory/referencePolicy.hpp" | 49 #include "memory/referencePolicy.hpp" |
46 #include "memory/referenceProcessor.hpp" | 50 #include "memory/referenceProcessor.hpp" |
797 verify_clear(_region_vspace); | 801 verify_clear(_region_vspace); |
798 verify_clear(_block_vspace); | 802 verify_clear(_block_vspace); |
799 } | 803 } |
800 #endif // #ifdef ASSERT | 804 #endif // #ifdef ASSERT |
801 | 805 |
806 STWGCTimer PSParallelCompact::_gc_timer; | |
807 ParallelOldTracer PSParallelCompact::_gc_tracer; | |
802 elapsedTimer PSParallelCompact::_accumulated_time; | 808 elapsedTimer PSParallelCompact::_accumulated_time; |
803 unsigned int PSParallelCompact::_total_invocations = 0; | 809 unsigned int PSParallelCompact::_total_invocations = 0; |
804 unsigned int PSParallelCompact::_maximum_compaction_gc_num = 0; | 810 unsigned int PSParallelCompact::_maximum_compaction_gc_num = 0; |
805 jlong PSParallelCompact::_time_of_last_gc = 0; | 811 jlong PSParallelCompact::_time_of_last_gc = 0; |
806 CollectorCounters* PSParallelCompact::_counters = NULL; | 812 CollectorCounters* PSParallelCompact::_counters = NULL; |
970 { | 976 { |
971 // Update the from & to space pointers in space_info, since they are swapped | 977 // Update the from & to space pointers in space_info, since they are swapped |
972 // at each young gen gc. Do the update unconditionally (even though a | 978 // at each young gen gc. Do the update unconditionally (even though a |
973 // promotion failure does not swap spaces) because an unknown number of minor | 979 // promotion failure does not swap spaces) because an unknown number of minor |
974 // collections will have swapped the spaces an unknown number of times. | 980 // collections will have swapped the spaces an unknown number of times. |
975 TraceTime tm("pre compact", print_phases(), true, gclog_or_tty); | 981 GCTraceTime tm("pre compact", print_phases(), true, &_gc_timer); |
976 ParallelScavengeHeap* heap = gc_heap(); | 982 ParallelScavengeHeap* heap = gc_heap(); |
977 _space_info[from_space_id].set_space(heap->young_gen()->from_space()); | 983 _space_info[from_space_id].set_space(heap->young_gen()->from_space()); |
978 _space_info[to_space_id].set_space(heap->young_gen()->to_space()); | 984 _space_info[to_space_id].set_space(heap->young_gen()->to_space()); |
979 | 985 |
980 pre_gc_values->fill(heap); | 986 pre_gc_values->fill(heap); |
987 | 993 |
988 // We need to track unique mark sweep invocations as well. | 994 // We need to track unique mark sweep invocations as well. |
989 _total_invocations++; | 995 _total_invocations++; |
990 | 996 |
991 heap->print_heap_before_gc(); | 997 heap->print_heap_before_gc(); |
998 heap->trace_heap_before_gc(&_gc_tracer); | |
992 | 999 |
993 // Fill in TLABs | 1000 // Fill in TLABs |
994 heap->accumulate_statistics_all_tlabs(); | 1001 heap->accumulate_statistics_all_tlabs(); |
995 heap->ensure_parsability(true); // retire TLABs | 1002 heap->ensure_parsability(true); // retire TLABs |
996 | 1003 |
1012 gc_task_manager()->release_all_resources(); | 1019 gc_task_manager()->release_all_resources(); |
1013 } | 1020 } |
1014 | 1021 |
1015 void PSParallelCompact::post_compact() | 1022 void PSParallelCompact::post_compact() |
1016 { | 1023 { |
1017 TraceTime tm("post compact", print_phases(), true, gclog_or_tty); | 1024 GCTraceTime tm("post compact", print_phases(), true, &_gc_timer); |
1018 | 1025 |
1019 for (unsigned int id = old_space_id; id < last_space_id; ++id) { | 1026 for (unsigned int id = old_space_id; id < last_space_id; ++id) { |
1020 // Clear the marking bitmap, summary data and split info. | 1027 // Clear the marking bitmap, summary data and split info. |
1021 clear_data_covering_space(SpaceId(id)); | 1028 clear_data_covering_space(SpaceId(id)); |
1022 // Update top(). Must be done after clearing the bitmap and summary data. | 1029 // Update top(). Must be done after clearing the bitmap and summary data. |
1838 #endif // #ifndef PRODUCT | 1845 #endif // #ifndef PRODUCT |
1839 | 1846 |
1840 void PSParallelCompact::summary_phase(ParCompactionManager* cm, | 1847 void PSParallelCompact::summary_phase(ParCompactionManager* cm, |
1841 bool maximum_compaction) | 1848 bool maximum_compaction) |
1842 { | 1849 { |
1843 TraceTime tm("summary phase", print_phases(), true, gclog_or_tty); | 1850 GCTraceTime tm("summary phase", print_phases(), true, &_gc_timer); |
1844 // trace("2"); | 1851 // trace("2"); |
1845 | 1852 |
1846 #ifdef ASSERT | 1853 #ifdef ASSERT |
1847 if (TraceParallelOldGCMarkingPhase) { | 1854 if (TraceParallelOldGCMarkingPhase) { |
1848 tty->print_cr("add_obj_count=" SIZE_FORMAT " " | 1855 tty->print_cr("add_obj_count=" SIZE_FORMAT " " |
1996 | 2003 |
1997 if (GC_locker::check_active_before_gc()) { | 2004 if (GC_locker::check_active_before_gc()) { |
1998 return false; | 2005 return false; |
1999 } | 2006 } |
2000 | 2007 |
2008 ParallelScavengeHeap* heap = gc_heap(); | |
2009 | |
2010 _gc_timer.register_gc_start(os::elapsed_counter()); | |
2011 _gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start()); | |
2012 | |
2001 TimeStamp marking_start; | 2013 TimeStamp marking_start; |
2002 TimeStamp compaction_start; | 2014 TimeStamp compaction_start; |
2003 TimeStamp collection_exit; | 2015 TimeStamp collection_exit; |
2004 | 2016 |
2005 ParallelScavengeHeap* heap = gc_heap(); | |
2006 GCCause::Cause gc_cause = heap->gc_cause(); | 2017 GCCause::Cause gc_cause = heap->gc_cause(); |
2007 PSYoungGen* young_gen = heap->young_gen(); | 2018 PSYoungGen* young_gen = heap->young_gen(); |
2008 PSOldGen* old_gen = heap->old_gen(); | 2019 PSOldGen* old_gen = heap->old_gen(); |
2009 PSAdaptiveSizePolicy* size_policy = heap->size_policy(); | 2020 PSAdaptiveSizePolicy* size_policy = heap->size_policy(); |
2010 | 2021 |
2016 if (ZapUnusedHeapArea) { | 2027 if (ZapUnusedHeapArea) { |
2017 // Save information needed to minimize mangling | 2028 // Save information needed to minimize mangling |
2018 heap->record_gen_tops_before_GC(); | 2029 heap->record_gen_tops_before_GC(); |
2019 } | 2030 } |
2020 | 2031 |
2021 heap->pre_full_gc_dump(); | 2032 heap->pre_full_gc_dump(&_gc_timer); |
2022 | 2033 |
2023 _print_phases = PrintGCDetails && PrintParallelOldGCPhaseTimes; | 2034 _print_phases = PrintGCDetails && PrintParallelOldGCPhaseTimes; |
2024 | 2035 |
2025 // Make sure data structures are sane, make the heap parsable, and do other | 2036 // Make sure data structures are sane, make the heap parsable, and do other |
2026 // miscellaneous bookkeeping. | 2037 // miscellaneous bookkeeping. |
2043 gc_task_manager()->task_idle_workers(); | 2054 gc_task_manager()->task_idle_workers(); |
2044 heap->set_par_threads(gc_task_manager()->active_workers()); | 2055 heap->set_par_threads(gc_task_manager()->active_workers()); |
2045 | 2056 |
2046 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); | 2057 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); |
2047 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); | 2058 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); |
2048 TraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, gclog_or_tty); | 2059 GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL); |
2049 TraceCollectorStats tcs(counters()); | 2060 TraceCollectorStats tcs(counters()); |
2050 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); | 2061 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); |
2051 | 2062 |
2052 if (TraceGen1Time) accumulated_time()->start(); | 2063 if (TraceGen1Time) accumulated_time()->start(); |
2053 | 2064 |
2063 ref_processor()->setup_policy(maximum_heap_compaction); | 2074 ref_processor()->setup_policy(maximum_heap_compaction); |
2064 | 2075 |
2065 bool marked_for_unloading = false; | 2076 bool marked_for_unloading = false; |
2066 | 2077 |
2067 marking_start.update(); | 2078 marking_start.update(); |
2068 marking_phase(vmthread_cm, maximum_heap_compaction); | 2079 marking_phase(vmthread_cm, maximum_heap_compaction, &_gc_tracer); |
2069 | 2080 |
2070 bool max_on_system_gc = UseMaximumCompactionOnSystemGC | 2081 bool max_on_system_gc = UseMaximumCompactionOnSystemGC |
2071 && gc_cause == GCCause::_java_lang_system_gc; | 2082 && gc_cause == GCCause::_java_lang_system_gc; |
2072 summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); | 2083 summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); |
2073 | 2084 |
2216 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); | 2227 NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); |
2217 | 2228 |
2218 collection_exit.update(); | 2229 collection_exit.update(); |
2219 | 2230 |
2220 heap->print_heap_after_gc(); | 2231 heap->print_heap_after_gc(); |
2232 heap->trace_heap_after_gc(&_gc_tracer); | |
2233 | |
2221 if (PrintGCTaskTimeStamps) { | 2234 if (PrintGCTaskTimeStamps) { |
2222 gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " | 2235 gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " |
2223 INT64_FORMAT, | 2236 INT64_FORMAT, |
2224 marking_start.ticks(), compaction_start.ticks(), | 2237 marking_start.ticks(), compaction_start.ticks(), |
2225 collection_exit.ticks()); | 2238 collection_exit.ticks()); |
2226 gc_task_manager()->print_task_time_stamps(); | 2239 gc_task_manager()->print_task_time_stamps(); |
2227 } | 2240 } |
2228 | 2241 |
2229 heap->post_full_gc_dump(); | 2242 heap->post_full_gc_dump(&_gc_timer); |
2230 | 2243 |
2231 #ifdef TRACESPINNING | 2244 #ifdef TRACESPINNING |
2232 ParallelTaskTerminator::print_termination_counts(); | 2245 ParallelTaskTerminator::print_termination_counts(); |
2233 #endif | 2246 #endif |
2247 | |
2248 _gc_timer.register_gc_end(os::elapsed_counter()); | |
2249 | |
2250 _gc_tracer.report_dense_prefix(dense_prefix(old_space_id)); | |
2251 _gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions()); | |
2234 | 2252 |
2235 return true; | 2253 return true; |
2236 } | 2254 } |
2237 | 2255 |
2238 bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, | 2256 bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, |
2328 "shouldn't return NULL"); | 2346 "shouldn't return NULL"); |
2329 return ParallelScavengeHeap::gc_task_manager(); | 2347 return ParallelScavengeHeap::gc_task_manager(); |
2330 } | 2348 } |
2331 | 2349 |
2332 void PSParallelCompact::marking_phase(ParCompactionManager* cm, | 2350 void PSParallelCompact::marking_phase(ParCompactionManager* cm, |
2333 bool maximum_heap_compaction) { | 2351 bool maximum_heap_compaction, |
2352 ParallelOldTracer *gc_tracer) { | |
2334 // Recursively traverse all live objects and mark them | 2353 // Recursively traverse all live objects and mark them |
2335 TraceTime tm("marking phase", print_phases(), true, gclog_or_tty); | 2354 GCTraceTime tm("marking phase", print_phases(), true, &_gc_timer); |
2336 | 2355 |
2337 ParallelScavengeHeap* heap = gc_heap(); | 2356 ParallelScavengeHeap* heap = gc_heap(); |
2338 uint parallel_gc_threads = heap->gc_task_manager()->workers(); | 2357 uint parallel_gc_threads = heap->gc_task_manager()->workers(); |
2339 uint active_gc_threads = heap->gc_task_manager()->active_workers(); | 2358 uint active_gc_threads = heap->gc_task_manager()->active_workers(); |
2340 TaskQueueSetSuper* qset = ParCompactionManager::region_array(); | 2359 TaskQueueSetSuper* qset = ParCompactionManager::region_array(); |
2345 | 2364 |
2346 // Need new claim bits before marking starts. | 2365 // Need new claim bits before marking starts. |
2347 ClassLoaderDataGraph::clear_claimed_marks(); | 2366 ClassLoaderDataGraph::clear_claimed_marks(); |
2348 | 2367 |
2349 { | 2368 { |
2350 TraceTime tm_m("par mark", print_phases(), true, gclog_or_tty); | 2369 GCTraceTime tm_m("par mark", print_phases(), true, &_gc_timer); |
2370 | |
2351 ParallelScavengeHeap::ParStrongRootsScope psrs; | 2371 ParallelScavengeHeap::ParStrongRootsScope psrs; |
2352 | 2372 |
2353 GCTaskQueue* q = GCTaskQueue::create(); | 2373 GCTaskQueue* q = GCTaskQueue::create(); |
2354 | 2374 |
2355 q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::universe)); | 2375 q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::universe)); |
2373 gc_task_manager()->execute_and_wait(q); | 2393 gc_task_manager()->execute_and_wait(q); |
2374 } | 2394 } |
2375 | 2395 |
2376 // Process reference objects found during marking | 2396 // Process reference objects found during marking |
2377 { | 2397 { |
2378 TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty); | 2398 GCTraceTime tm_r("reference processing", print_phases(), true, &_gc_timer); |
2399 | |
2400 ReferenceProcessorStats stats; | |
2379 if (ref_processor()->processing_is_mt()) { | 2401 if (ref_processor()->processing_is_mt()) { |
2380 RefProcTaskExecutor task_executor; | 2402 RefProcTaskExecutor task_executor; |
2381 ref_processor()->process_discovered_references( | 2403 stats = ref_processor()->process_discovered_references( |
2382 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, | 2404 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, |
2383 &task_executor); | 2405 &task_executor, &_gc_timer); |
2384 } else { | 2406 } else { |
2385 ref_processor()->process_discovered_references( | 2407 stats = ref_processor()->process_discovered_references( |
2386 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL); | 2408 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL, |
2387 } | 2409 &_gc_timer); |
2388 } | 2410 } |
2389 | 2411 |
2390 TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty); | 2412 gc_tracer->report_gc_reference_stats(stats); |
2413 } | |
2414 | |
2415 GCTraceTime tm_c("class unloading", print_phases(), true, &_gc_timer); | |
2391 | 2416 |
2392 // This is the point where the entire marking should have completed. | 2417 // This is the point where the entire marking should have completed. |
2393 assert(cm->marking_stacks_empty(), "Marking should have completed"); | 2418 assert(cm->marking_stacks_empty(), "Marking should have completed"); |
2394 | 2419 |
2395 // Follow system dictionary roots and unload classes. | 2420 // Follow system dictionary roots and unload classes. |
2404 // Delete entries for dead interned strings. | 2429 // Delete entries for dead interned strings. |
2405 StringTable::unlink(is_alive_closure()); | 2430 StringTable::unlink(is_alive_closure()); |
2406 | 2431 |
2407 // Clean up unreferenced symbols in symbol table. | 2432 // Clean up unreferenced symbols in symbol table. |
2408 SymbolTable::unlink(); | 2433 SymbolTable::unlink(); |
2434 _gc_tracer.report_object_count_after_gc(is_alive_closure()); | |
2409 } | 2435 } |
2410 | 2436 |
2411 void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { | 2437 void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { |
2412 ClassLoaderData* cld = klass->class_loader_data(); | 2438 ClassLoaderData* cld = klass->class_loader_data(); |
2413 // The actual processing of the klass is done when we | 2439 // The actual processing of the klass is done when we |
2444 }; | 2470 }; |
2445 static PSAlwaysTrueClosure always_true; | 2471 static PSAlwaysTrueClosure always_true; |
2446 | 2472 |
2447 void PSParallelCompact::adjust_roots() { | 2473 void PSParallelCompact::adjust_roots() { |
2448 // Adjust the pointers to reflect the new locations | 2474 // Adjust the pointers to reflect the new locations |
2449 TraceTime tm("adjust roots", print_phases(), true, gclog_or_tty); | 2475 GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer); |
2450 | 2476 |
2451 // Need new claim bits when tracing through and adjusting pointers. | 2477 // Need new claim bits when tracing through and adjusting pointers. |
2452 ClassLoaderDataGraph::clear_claimed_marks(); | 2478 ClassLoaderDataGraph::clear_claimed_marks(); |
2453 | 2479 |
2454 // General strong roots. | 2480 // General strong roots. |
2480 } | 2506 } |
2481 | 2507 |
2482 void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, | 2508 void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, |
2483 uint parallel_gc_threads) | 2509 uint parallel_gc_threads) |
2484 { | 2510 { |
2485 TraceTime tm("drain task setup", print_phases(), true, gclog_or_tty); | 2511 GCTraceTime tm("drain task setup", print_phases(), true, &_gc_timer); |
2486 | 2512 |
2487 // Find the threads that are active | 2513 // Find the threads that are active |
2488 unsigned int which = 0; | 2514 unsigned int which = 0; |
2489 | 2515 |
2490 const uint task_count = MAX2(parallel_gc_threads, 1U); | 2516 const uint task_count = MAX2(parallel_gc_threads, 1U); |
2554 | 2580 |
2555 #define PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING 4 | 2581 #define PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING 4 |
2556 | 2582 |
2557 void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, | 2583 void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, |
2558 uint parallel_gc_threads) { | 2584 uint parallel_gc_threads) { |
2559 TraceTime tm("dense prefix task setup", print_phases(), true, gclog_or_tty); | 2585 GCTraceTime tm("dense prefix task setup", print_phases(), true, &_gc_timer); |
2560 | 2586 |
2561 ParallelCompactData& sd = PSParallelCompact::summary_data(); | 2587 ParallelCompactData& sd = PSParallelCompact::summary_data(); |
2562 | 2588 |
2563 // Iterate over all the spaces adding tasks for updating | 2589 // Iterate over all the spaces adding tasks for updating |
2564 // regions in the dense prefix. Assume that 1 gc thread | 2590 // regions in the dense prefix. Assume that 1 gc thread |
2636 | 2662 |
2637 void PSParallelCompact::enqueue_region_stealing_tasks( | 2663 void PSParallelCompact::enqueue_region_stealing_tasks( |
2638 GCTaskQueue* q, | 2664 GCTaskQueue* q, |
2639 ParallelTaskTerminator* terminator_ptr, | 2665 ParallelTaskTerminator* terminator_ptr, |
2640 uint parallel_gc_threads) { | 2666 uint parallel_gc_threads) { |
2641 TraceTime tm("steal task setup", print_phases(), true, gclog_or_tty); | 2667 GCTraceTime tm("steal task setup", print_phases(), true, &_gc_timer); |
2642 | 2668 |
2643 // Once a thread has drained it's stack, it should try to steal regions from | 2669 // Once a thread has drained it's stack, it should try to steal regions from |
2644 // other threads. | 2670 // other threads. |
2645 if (parallel_gc_threads > 1) { | 2671 if (parallel_gc_threads > 1) { |
2646 for (uint j = 0; j < parallel_gc_threads; j++) { | 2672 for (uint j = 0; j < parallel_gc_threads; j++) { |
2684 } | 2710 } |
2685 #endif // #ifdef ASSERT | 2711 #endif // #ifdef ASSERT |
2686 | 2712 |
2687 void PSParallelCompact::compact() { | 2713 void PSParallelCompact::compact() { |
2688 // trace("5"); | 2714 // trace("5"); |
2689 TraceTime tm("compaction phase", print_phases(), true, gclog_or_tty); | 2715 GCTraceTime tm("compaction phase", print_phases(), true, &_gc_timer); |
2690 | 2716 |
2691 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); | 2717 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
2692 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | 2718 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); |
2693 PSOldGen* old_gen = heap->old_gen(); | 2719 PSOldGen* old_gen = heap->old_gen(); |
2694 old_gen->start_array()->reset(); | 2720 old_gen->start_array()->reset(); |
2701 enqueue_region_draining_tasks(q, active_gc_threads); | 2727 enqueue_region_draining_tasks(q, active_gc_threads); |
2702 enqueue_dense_prefix_tasks(q, active_gc_threads); | 2728 enqueue_dense_prefix_tasks(q, active_gc_threads); |
2703 enqueue_region_stealing_tasks(q, &terminator, active_gc_threads); | 2729 enqueue_region_stealing_tasks(q, &terminator, active_gc_threads); |
2704 | 2730 |
2705 { | 2731 { |
2706 TraceTime tm_pc("par compact", print_phases(), true, gclog_or_tty); | 2732 GCTraceTime tm_pc("par compact", print_phases(), true, &_gc_timer); |
2707 | 2733 |
2708 gc_task_manager()->execute_and_wait(q); | 2734 gc_task_manager()->execute_and_wait(q); |
2709 | 2735 |
2710 #ifdef ASSERT | 2736 #ifdef ASSERT |
2711 // Verify that all regions have been processed before the deferred updates. | 2737 // Verify that all regions have been processed before the deferred updates. |
2715 #endif | 2741 #endif |
2716 } | 2742 } |
2717 | 2743 |
2718 { | 2744 { |
2719 // Update the deferred objects, if any. Any compaction manager can be used. | 2745 // Update the deferred objects, if any. Any compaction manager can be used. |
2720 TraceTime tm_du("deferred updates", print_phases(), true, gclog_or_tty); | 2746 GCTraceTime tm_du("deferred updates", print_phases(), true, &_gc_timer); |
2721 ParCompactionManager* cm = ParCompactionManager::manager_array(0); | 2747 ParCompactionManager* cm = ParCompactionManager::manager_array(0); |
2722 for (unsigned int id = old_space_id; id < last_space_id; ++id) { | 2748 for (unsigned int id = old_space_id; id < last_space_id; ++id) { |
2723 update_deferred_objects(cm, SpaceId(id)); | 2749 update_deferred_objects(cm, SpaceId(id)); |
2724 } | 2750 } |
2725 } | 2751 } |