1727 _free_regions_coming(false),
1728 _young_list(new YoungList(this)),
1729 _gc_time_stamp(0),
1730 _survivor_plab_stats(YoungPLABSize, PLABWeight),
1731 _old_plab_stats(OldPLABSize, PLABWeight),
1732 _expand_heap_after_alloc_failure(true),
1733 _surviving_young_words(NULL),
1734 _old_marking_cycles_started(0),
1735 _old_marking_cycles_completed(0),
1736 _concurrent_cycle_started(false),
1737 _heap_summary_sent(false),
1738 _in_cset_fast_test(),
1739 _dirty_cards_region_list(NULL),
1740 _worker_cset_start_region(NULL),
1741 _worker_cset_start_region_time_stamp(NULL),
1742 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1743 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1744 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1745 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1746
1747 _workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads,
1748 /* are_GC_task_threads */true,
1749 /* are_ConcurrentGC_threads */false);
1750 _workers->initialize_workers();
1751
1752 _allocator = G1Allocator::create_allocator(this);
1753 _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
1754
1755 int n_queues = (int)ParallelGCThreads;
1756 _task_queues = new RefToScanQueueSet(n_queues);
1757
1758 uint n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
1759 assert(n_rem_sets > 0, "Invariant.");
1760
1761 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1762 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(uint, n_queues, mtGC);
1763 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1764
1765 for (int i = 0; i < n_queues; i++) {
1766 RefToScanQueue* q = new RefToScanQueue();
1767 q->initialize();
4943 G1STWDrainQueueClosure(G1CollectedHeap* g1h, G1ParScanThreadState* pss) :
4944 _g1h(g1h),
4945 _par_scan_state(pss)
4946 { }
4947
4948 void do_void() {
4949 G1ParScanThreadState* const pss = par_scan_state();
4950 pss->trim_queue();
4951 }
4952 };
4953
4954 // Parallel Reference Processing closures
4955
4956 // Implementation of AbstractRefProcTaskExecutor for parallel reference
4957 // processing during G1 evacuation pauses.
4958
4959 class G1STWRefProcTaskExecutor: public AbstractRefProcTaskExecutor {
4960 private:
4961 G1CollectedHeap* _g1h;
4962 RefToScanQueueSet* _queues;
4963 FlexibleWorkGang* _workers;
4964 uint _active_workers;
4965
4966 public:
4967 G1STWRefProcTaskExecutor(G1CollectedHeap* g1h,
4968 FlexibleWorkGang* workers,
4969 RefToScanQueueSet *task_queues,
4970 uint n_workers) :
4971 _g1h(g1h),
4972 _queues(task_queues),
4973 _workers(workers),
4974 _active_workers(n_workers)
4975 {
4976 assert(n_workers > 0, "shouldn't call this otherwise");
4977 }
4978
4979 // Executes the given task using concurrent marking worker threads.
4980 virtual void execute(ProcessTask& task);
4981 virtual void execute(EnqueueTask& task);
4982 };
4983
4984 // Gang task for possibly parallel reference processing
4985
4986 class G1STWRefProcTaskProxy: public AbstractGangTask {
4987 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
4988 ProcessTask& _proc_task;
|
1727 _free_regions_coming(false),
1728 _young_list(new YoungList(this)),
1729 _gc_time_stamp(0),
1730 _survivor_plab_stats(YoungPLABSize, PLABWeight),
1731 _old_plab_stats(OldPLABSize, PLABWeight),
1732 _expand_heap_after_alloc_failure(true),
1733 _surviving_young_words(NULL),
1734 _old_marking_cycles_started(0),
1735 _old_marking_cycles_completed(0),
1736 _concurrent_cycle_started(false),
1737 _heap_summary_sent(false),
1738 _in_cset_fast_test(),
1739 _dirty_cards_region_list(NULL),
1740 _worker_cset_start_region(NULL),
1741 _worker_cset_start_region_time_stamp(NULL),
1742 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1743 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1744 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1745 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1746
1747 _workers = new WorkGang("GC Thread", ParallelGCThreads,
1748 /* are_GC_task_threads */true,
1749 /* are_ConcurrentGC_threads */false);
1750 _workers->initialize_workers();
1751
1752 _allocator = G1Allocator::create_allocator(this);
1753 _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
1754
1755 int n_queues = (int)ParallelGCThreads;
1756 _task_queues = new RefToScanQueueSet(n_queues);
1757
1758 uint n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
1759 assert(n_rem_sets > 0, "Invariant.");
1760
1761 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1762 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(uint, n_queues, mtGC);
1763 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1764
1765 for (int i = 0; i < n_queues; i++) {
1766 RefToScanQueue* q = new RefToScanQueue();
1767 q->initialize();
4943 G1STWDrainQueueClosure(G1CollectedHeap* g1h, G1ParScanThreadState* pss) :
4944 _g1h(g1h),
4945 _par_scan_state(pss)
4946 { }
4947
4948 void do_void() {
4949 G1ParScanThreadState* const pss = par_scan_state();
4950 pss->trim_queue();
4951 }
4952 };
4953
4954 // Parallel Reference Processing closures
4955
4956 // Implementation of AbstractRefProcTaskExecutor for parallel reference
4957 // processing during G1 evacuation pauses.
4958
4959 class G1STWRefProcTaskExecutor: public AbstractRefProcTaskExecutor {
4960 private:
4961 G1CollectedHeap* _g1h;
4962 RefToScanQueueSet* _queues;
4963 WorkGang* _workers;
4964 uint _active_workers;
4965
4966 public:
4967 G1STWRefProcTaskExecutor(G1CollectedHeap* g1h,
4968 WorkGang* workers,
4969 RefToScanQueueSet *task_queues,
4970 uint n_workers) :
4971 _g1h(g1h),
4972 _queues(task_queues),
4973 _workers(workers),
4974 _active_workers(n_workers)
4975 {
4976 assert(n_workers > 0, "shouldn't call this otherwise");
4977 }
4978
4979 // Executes the given task using concurrent marking worker threads.
4980 virtual void execute(ProcessTask& task);
4981 virtual void execute(EnqueueTask& task);
4982 };
4983
4984 // Gang task for possibly parallel reference processing
4985
4986 class G1STWRefProcTaskProxy: public AbstractGangTask {
4987 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
4988 ProcessTask& _proc_task;
|