src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp

Print this page




1561     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
1562     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
1563     TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
1564     TraceCollectorStats tcs(counters());
1565     TraceMemoryManagerStats tms(true /* Full GC */);
1566 
1567     if (TraceGen1Time) accumulated_time()->start();
1568 
1569     // Let the size policy know we're starting
1570     size_policy->major_collection_begin();
1571 
1572     // When collecting the permanent generation methodOops may be moving,
1573     // so we either have to flush all bcp data or convert it into bci.
1574     CodeCache::gc_prologue();
1575     Threads::gc_prologue();
1576 
1577     NOT_PRODUCT(ref_processor()->verify_no_references_recorded());
1578     COMPILER2_PRESENT(DerivedPointerTable::clear());
1579 
1580     ref_processor()->enable_discovery();

1581 
1582     bool marked_for_unloading = false;
1583 
1584     marking_start.update();
1585     marking_phase(vmthread_cm, maximum_heap_compaction);
1586 
1587 #ifndef PRODUCT
1588     if (TraceParallelOldGCMarkingPhase) {
1589       gclog_or_tty->print_cr("marking_phase: cas_tries %d  cas_retries %d "
1590         "cas_by_another %d",
1591         mark_bitmap()->cas_tries(), mark_bitmap()->cas_retries(),
1592         mark_bitmap()->cas_by_another());
1593     }
1594 #endif  // #ifndef PRODUCT
1595 
1596     bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc;
1597     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
1598 
1599     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
1600     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));


1877     if (parallel_gc_threads > 1) {
1878       for (uint j = 0; j < parallel_gc_threads; j++) {
1879         q->enqueue(new StealMarkingTask(&terminator));
1880       }
1881     }
1882 
1883     WaitForBarrierGCTask* fin = WaitForBarrierGCTask::create();
1884     q->enqueue(fin);
1885 
1886     gc_task_manager()->add_list(q);
1887 
1888     fin->wait_for();
1889 
1890     // We have to release the barrier tasks!
1891     WaitForBarrierGCTask::destroy(fin);
1892   }
1893 
1894   // Process reference objects found during marking
1895   {
1896     TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty);
1897     ReferencePolicy *soft_ref_policy;
1898     if (maximum_heap_compaction) {
1899       soft_ref_policy = new AlwaysClearPolicy();
1900     } else {
1901 #ifdef COMPILER2
1902       soft_ref_policy = new LRUMaxHeapPolicy();
1903 #else
1904       soft_ref_policy = new LRUCurrentHeapPolicy();
1905 #endif // COMPILER2
1906     }
1907     assert(soft_ref_policy != NULL, "No soft reference policy");
1908     if (ref_processor()->processing_is_mt()) {
1909       RefProcTaskExecutor task_executor;
1910       ref_processor()->process_discovered_references(
1911         soft_ref_policy, is_alive_closure(), &mark_and_push_closure,
1912         &follow_stack_closure, &task_executor);
1913     } else {
1914       ref_processor()->process_discovered_references(
1915         soft_ref_policy, is_alive_closure(), &mark_and_push_closure,
1916         &follow_stack_closure, NULL);
1917     }
1918   }
1919 
1920   TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty);
1921   // Follow system dictionary roots and unload classes.
1922   bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
1923 
1924   // Follow code cache roots.
1925   CodeCache::do_unloading(is_alive_closure(), &mark_and_push_closure,
1926                           purged_class);
1927   follow_stack(cm); // Flush marking stack.
1928 
1929   // Update subklass/sibling/implementor links of live klasses
1930   // revisit_klass_stack is used in follow_weak_klass_links().
1931   follow_weak_klass_links(cm);
1932 
1933   // Visit symbol and interned string tables and delete unmarked oops
1934   SymbolTable::unlink(is_alive_closure());
1935   StringTable::unlink(is_alive_closure());
1936 




1561     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
1562     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
1563     TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
1564     TraceCollectorStats tcs(counters());
1565     TraceMemoryManagerStats tms(true /* Full GC */);
1566 
1567     if (TraceGen1Time) accumulated_time()->start();
1568 
1569     // Let the size policy know we're starting
1570     size_policy->major_collection_begin();
1571 
1572     // When collecting the permanent generation methodOops may be moving,
1573     // so we either have to flush all bcp data or convert it into bci.
1574     CodeCache::gc_prologue();
1575     Threads::gc_prologue();
1576 
1577     NOT_PRODUCT(ref_processor()->verify_no_references_recorded());
1578     COMPILER2_PRESENT(DerivedPointerTable::clear());
1579 
1580     ref_processor()->enable_discovery();
1581     ref_processor()->snap_policy(maximum_heap_compaction);
1582 
1583     bool marked_for_unloading = false;
1584 
1585     marking_start.update();
1586     marking_phase(vmthread_cm, maximum_heap_compaction);
1587 
1588 #ifndef PRODUCT
1589     if (TraceParallelOldGCMarkingPhase) {
1590       gclog_or_tty->print_cr("marking_phase: cas_tries %d  cas_retries %d "
1591         "cas_by_another %d",
1592         mark_bitmap()->cas_tries(), mark_bitmap()->cas_retries(),
1593         mark_bitmap()->cas_by_another());
1594     }
1595 #endif  // #ifndef PRODUCT
1596 
1597     bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc;
1598     summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc);
1599 
1600     COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
1601     COMPILER2_PRESENT(DerivedPointerTable::set_active(false));


1878     if (parallel_gc_threads > 1) {
1879       for (uint j = 0; j < parallel_gc_threads; j++) {
1880         q->enqueue(new StealMarkingTask(&terminator));
1881       }
1882     }
1883 
1884     WaitForBarrierGCTask* fin = WaitForBarrierGCTask::create();
1885     q->enqueue(fin);
1886 
1887     gc_task_manager()->add_list(q);
1888 
1889     fin->wait_for();
1890 
1891     // We have to release the barrier tasks!
1892     WaitForBarrierGCTask::destroy(fin);
1893   }
1894 
1895   // Process reference objects found during marking
1896   {
1897     TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty);











1898     if (ref_processor()->processing_is_mt()) {
1899       RefProcTaskExecutor task_executor;
1900       ref_processor()->process_discovered_references(
1901         is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, &task_executor);

1902     } else {
1903       ref_processor()->process_discovered_references(
1904         is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL);

1905     }
1906   }
1907 
1908   TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty);
1909   // Follow system dictionary roots and unload classes.
1910   bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
1911 
1912   // Follow code cache roots.
1913   CodeCache::do_unloading(is_alive_closure(), &mark_and_push_closure,
1914                           purged_class);
1915   follow_stack(cm); // Flush marking stack.
1916 
1917   // Update subklass/sibling/implementor links of live klasses
1918   // revisit_klass_stack is used in follow_weak_klass_links().
1919   follow_weak_klass_links(cm);
1920 
1921   // Visit symbol and interned string tables and delete unmarked oops
1922   SymbolTable::unlink(is_alive_closure());
1923   StringTable::unlink(is_alive_closure());
1924