52
53 // A G1RemSet in which each heap region has a rem set that records the
54 // external heap references into it. Uses a mod ref bs to track updates,
55 // so that they can be used to update the individual region remsets.
56 class G1RemSet: public CHeapObj<mtGC> {
57 private:
58 G1RemSetScanState* _scan_state;
59
60 G1RemSetSummary _prev_period_summary;
61
62 // Scan all remembered sets of the collection set for references into the collection
63 // set.
64 void scan_rem_set(G1ParScanThreadState* pss,
65 CodeBlobClosure* heap_region_codeblobs,
66 uint worker_i);
67
68 // Flush remaining refinement buffers for cross-region references to either evacuate references
69 // into the collection set or update the remembered set.
70 void update_rem_set(G1ParScanThreadState* pss, uint worker_i);
71
72 G1CollectedHeap* _g1;
73 size_t _num_conc_refined_cards; // Number of cards refined concurrently to the mutator.
74
75 G1CardTable* _ct;
76 G1Policy* _g1p;
77 G1HotCardCache* _hot_card_cache;
78
79 public:
80 // Gives an approximation on how many threads can be expected to add records to
81 // a remembered set in parallel. This can be used for sizing data structures to
82 // decrease performance losses due to data structure sharing.
83 // Examples for quantities that influence this value are the maximum number of
84 // mutator threads, maximum number of concurrent refinement or GC threads.
85 static uint num_par_rem_sets();
86
87 // Initialize data that depends on the heap size being known.
88 void initialize(size_t capacity, uint max_regions);
89
90 // This is called to reset dual hash tables after the gc pause
91 // is finished and the initial hash table is no longer being
92 // scanned.
93 void cleanupHRRS();
94
95 G1RemSet(G1CollectedHeap* g1,
96 G1CardTable* ct,
97 G1HotCardCache* hot_card_cache);
98 ~G1RemSet();
99
100 // Process all oops in the collection set from the cards in the refinement buffers and
101 // remembered sets using pss.
102 //
103 // Further applies heap_region_codeblobs on the oops of the unmarked nmethods on the strong code
104 // roots list for each region in the collection set.
105 void oops_into_collection_set_do(G1ParScanThreadState* pss,
106 CodeBlobClosure* heap_region_codeblobs,
107 uint worker_i);
108
109 // Prepare for and cleanup after an oops_into_collection_set_do
110 // call. Must call each of these once before and after (in sequential
111 // code) any thread calls oops_into_collection_set_do.
112 void prepare_for_oops_into_collection_set_do();
113 void cleanup_after_oops_into_collection_set_do();
114
115 G1RemSetScanState* scan_state() const { return _scan_state; }
|
52
53 // A G1RemSet in which each heap region has a rem set that records the
54 // external heap references into it. Uses a mod ref bs to track updates,
55 // so that they can be used to update the individual region remsets.
56 class G1RemSet: public CHeapObj<mtGC> {
57 private:
58 G1RemSetScanState* _scan_state;
59
60 G1RemSetSummary _prev_period_summary;
61
62 // Scan all remembered sets of the collection set for references into the collection
63 // set.
64 void scan_rem_set(G1ParScanThreadState* pss,
65 CodeBlobClosure* heap_region_codeblobs,
66 uint worker_i);
67
68 // Flush remaining refinement buffers for cross-region references to either evacuate references
69 // into the collection set or update the remembered set.
70 void update_rem_set(G1ParScanThreadState* pss, uint worker_i);
71
72 G1CollectedHeap* _g1h;
73 size_t _num_conc_refined_cards; // Number of cards refined concurrently to the mutator.
74
75 G1CardTable* _ct;
76 G1Policy* _g1p;
77 G1HotCardCache* _hot_card_cache;
78
79 public:
80 // Gives an approximation on how many threads can be expected to add records to
81 // a remembered set in parallel. This can be used for sizing data structures to
82 // decrease performance losses due to data structure sharing.
83 // Examples for quantities that influence this value are the maximum number of
84 // mutator threads, maximum number of concurrent refinement or GC threads.
85 static uint num_par_rem_sets();
86
87 // Initialize data that depends on the heap size being known.
88 void initialize(size_t capacity, uint max_regions);
89
90 // This is called to reset dual hash tables after the gc pause
91 // is finished and the initial hash table is no longer being
92 // scanned.
93 void cleanupHRRS();
94
95 G1RemSet(G1CollectedHeap* g1h,
96 G1CardTable* ct,
97 G1HotCardCache* hot_card_cache);
98 ~G1RemSet();
99
100 // Process all oops in the collection set from the cards in the refinement buffers and
101 // remembered sets using pss.
102 //
103 // Further applies heap_region_codeblobs on the oops of the unmarked nmethods on the strong code
104 // roots list for each region in the collection set.
105 void oops_into_collection_set_do(G1ParScanThreadState* pss,
106 CodeBlobClosure* heap_region_codeblobs,
107 uint worker_i);
108
109 // Prepare for and cleanup after an oops_into_collection_set_do
110 // call. Must call each of these once before and after (in sequential
111 // code) any thread calls oops_into_collection_set_do.
112 void prepare_for_oops_into_collection_set_do();
113 void cleanup_after_oops_into_collection_set_do();
114
115 G1RemSetScanState* scan_state() const { return _scan_state; }
|