1762 // Get the compaction manager reserved for the VM thread.
1763 ParCompactionManager* const vmthread_cm =
1764 ParCompactionManager::manager_array(gc_task_manager()->workers());
1765
1766 {
1767 ResourceMark rm;
1768 HandleMark hm;
1769
1770 // Set the number of GC threads to be used in this collection
1771 gc_task_manager()->set_active_gang();
1772 gc_task_manager()->task_idle_workers();
1773
1774 GCTraceCPUTime tcpu;
1775 GCTraceTime(Info, gc) tm("Pause Full", NULL, gc_cause, true);
1776
1777 heap->pre_full_gc_dump(&_gc_timer);
1778
1779 TraceCollectorStats tcs(counters());
1780 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
1781
1782 if (TraceOldGenTime) accumulated_time()->start();
1783
1784 // Let the size policy know we're starting
1785 size_policy->major_collection_begin();
1786
1787 CodeCache::gc_prologue();
1788
1789 #if defined(COMPILER2) || INCLUDE_JVMCI
1790 DerivedPointerTable::clear();
1791 #endif
1792
1793 ref_processor()->enable_discovery();
1794 ref_processor()->setup_policy(maximum_heap_compaction);
1795
1796 bool marked_for_unloading = false;
1797
1798 marking_start.update();
1799 marking_phase(vmthread_cm, maximum_heap_compaction, &_gc_tracer);
1800
1801 bool max_on_system_gc = UseMaximumCompactionOnSystemGC
1802 && GCCause::is_user_requested_gc(gc_cause);
1881
1882 heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
1883 size_policy->calculated_survivor_size_in_bytes());
1884 }
1885
1886 log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
1887 }
1888
1889 if (UsePerfData) {
1890 PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
1891 counters->update_counters();
1892 counters->update_old_capacity(old_gen->capacity_in_bytes());
1893 counters->update_young_capacity(young_gen->capacity_in_bytes());
1894 }
1895
1896 heap->resize_all_tlabs();
1897
1898 // Resize the metaspace capacity after a collection
1899 MetaspaceGC::compute_new_size();
1900
1901 if (TraceOldGenTime) {
1902 accumulated_time()->stop();
1903 }
1904
1905 young_gen->print_used_change(pre_gc_values.young_gen_used());
1906 old_gen->print_used_change(pre_gc_values.old_gen_used());
1907 MetaspaceAux::print_metaspace_change(pre_gc_values.metadata_used());
1908
1909 // Track memory usage and detect low memory
1910 MemoryService::track_memory_usage();
1911 heap->update_counters();
1912 gc_task_manager()->release_idle_workers();
1913
1914 heap->post_full_gc_dump(&_gc_timer);
1915 }
1916
1917 #ifdef ASSERT
1918 for (size_t i = 0; i < ParallelGCThreads + 1; ++i) {
1919 ParCompactionManager* const cm =
1920 ParCompactionManager::manager_array(int(i));
1921 assert(cm->marking_stack()->is_empty(), "should be empty");
|
1762 // Get the compaction manager reserved for the VM thread.
1763 ParCompactionManager* const vmthread_cm =
1764 ParCompactionManager::manager_array(gc_task_manager()->workers());
1765
1766 {
1767 ResourceMark rm;
1768 HandleMark hm;
1769
1770 // Set the number of GC threads to be used in this collection
1771 gc_task_manager()->set_active_gang();
1772 gc_task_manager()->task_idle_workers();
1773
1774 GCTraceCPUTime tcpu;
1775 GCTraceTime(Info, gc) tm("Pause Full", NULL, gc_cause, true);
1776
1777 heap->pre_full_gc_dump(&_gc_timer);
1778
1779 TraceCollectorStats tcs(counters());
1780 TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
1781
1782 if (log_is_enabled(Debug, gc, heap, exit)) accumulated_time()->start();
1783
1784 // Let the size policy know we're starting
1785 size_policy->major_collection_begin();
1786
1787 CodeCache::gc_prologue();
1788
1789 #if defined(COMPILER2) || INCLUDE_JVMCI
1790 DerivedPointerTable::clear();
1791 #endif
1792
1793 ref_processor()->enable_discovery();
1794 ref_processor()->setup_policy(maximum_heap_compaction);
1795
1796 bool marked_for_unloading = false;
1797
1798 marking_start.update();
1799 marking_phase(vmthread_cm, maximum_heap_compaction, &_gc_tracer);
1800
1801 bool max_on_system_gc = UseMaximumCompactionOnSystemGC
1802 && GCCause::is_user_requested_gc(gc_cause);
1881
1882 heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
1883 size_policy->calculated_survivor_size_in_bytes());
1884 }
1885
1886 log_debug(gc, ergo)("AdaptiveSizeStop: collection: %d ", heap->total_collections());
1887 }
1888
1889 if (UsePerfData) {
1890 PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
1891 counters->update_counters();
1892 counters->update_old_capacity(old_gen->capacity_in_bytes());
1893 counters->update_young_capacity(young_gen->capacity_in_bytes());
1894 }
1895
1896 heap->resize_all_tlabs();
1897
1898 // Resize the metaspace capacity after a collection
1899 MetaspaceGC::compute_new_size();
1900
1901 if (log_is_enabled(Debug, gc, heap, exit)) {
1902 accumulated_time()->stop();
1903 }
1904
1905 young_gen->print_used_change(pre_gc_values.young_gen_used());
1906 old_gen->print_used_change(pre_gc_values.old_gen_used());
1907 MetaspaceAux::print_metaspace_change(pre_gc_values.metadata_used());
1908
1909 // Track memory usage and detect low memory
1910 MemoryService::track_memory_usage();
1911 heap->update_counters();
1912 gc_task_manager()->release_idle_workers();
1913
1914 heap->post_full_gc_dump(&_gc_timer);
1915 }
1916
1917 #ifdef ASSERT
1918 for (size_t i = 0; i < ParallelGCThreads + 1; ++i) {
1919 ParCompactionManager* const cm =
1920 ParCompactionManager::manager_array(int(i));
1921 assert(cm->marking_stack()->is_empty(), "should be empty");
|