32 #include "memory/allocation.hpp"
33 #include "memory/iterator.hpp"
34
35 // A G1RemSet provides ways of iterating over pointers into a selected
36 // collection set.
37
38 class BitMap;
39 class CardTableModRefBS;
40 class G1BlockOffsetTable;
41 class CodeBlobClosure;
42 class G1CollectedHeap;
43 class G1HotCardCache;
44 class G1RemSetScanState;
45 class G1ParScanThreadState;
46 class G1Policy;
47 class G1SATBCardTableModRefBS;
48 class G1ScanObjsDuringScanRSClosure;
49 class G1ScanObjsDuringUpdateRSClosure;
50 class HeapRegionClaimer;
51
52 // Closure used for updating remembered sets and recording references that
53 // point into the collection set while the mutator is running.
54 // Assumed to be only executed concurrently with the mutator. Yields via
55 // SuspendibleThreadSet after every card.
56 class G1RefineCardConcurrentlyClosure: public CardTableEntryClosure {
57 public:
58 bool do_card_ptr(jbyte* card_ptr, uint worker_i);
59 };
60
61 // A G1RemSet in which each heap region has a rem set that records the
62 // external heap references into it. Uses a mod ref bs to track updates,
63 // so that they can be used to update the individual region remsets.
64 class G1RemSet: public CHeapObj<mtGC> {
65 private:
66 G1RefineCardConcurrentlyClosure _refine_card_concurrently_cl;
67
68 G1RemSetScanState* _scan_state;
69 G1CardLiveData _card_live_data;
70
71 G1RemSetSummary _prev_period_summary;
72
73 // A DirtyCardQueueSet that is used to hold cards that contain
74 // references into the current collection set. This is used to
75 // update the remembered sets of the regions in the collection
76 // set in the event of an evacuation failure.
77 DirtyCardQueueSet _into_cset_dirty_card_queue_set;
78
79 // Scan all remembered sets of the collection set for references into the collection
80 // set.
81 void scan_rem_set(G1ParScanThreadState* pss,
82 CodeBlobClosure* heap_region_codeblobs,
83 uint worker_i);
84
85 // Flush remaining refinement buffers for cross-region references to either evacuate references
86 // into the collection set or update the remembered set.
87 void update_rem_set(DirtyCardQueue* into_cset_dcq, G1ParScanThreadState* pss, uint worker_i);
120 // Further applies heap_region_codeblobs on the oops of the unmarked nmethods on the strong code
121 // roots list for each region in the collection set.
122 void oops_into_collection_set_do(G1ParScanThreadState* pss,
123 CodeBlobClosure* heap_region_codeblobs,
124 uint worker_i);
125
126 // Prepare for and cleanup after an oops_into_collection_set_do
127 // call. Must call each of these once before and after (in sequential
128 // code) any thread calls oops_into_collection_set_do.
129 void prepare_for_oops_into_collection_set_do();
130 void cleanup_after_oops_into_collection_set_do();
131
132 G1RemSetScanState* scan_state() const { return _scan_state; }
133
134 // Record, if necessary, the fact that *p (where "p" is in region "from",
135 // which is required to be non-NULL) has changed to a new non-NULL value.
136 template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
137
138 // Eliminates any remembered set entries that correspond to dead heap ranges.
139 void scrub(uint worker_num, HeapRegionClaimer* hrclaimer);
140
141 G1RefineCardConcurrentlyClosure* refine_card_concurrently_closure() { return &_refine_card_concurrently_cl; }
142
143 // Refine the card corresponding to "card_ptr". Safe to be called concurrently
144 // to the mutator.
145 void refine_card_concurrently(jbyte* card_ptr,
146 uint worker_i);
147
148 // Refine the card corresponding to "card_ptr", applying the given closure to
149 // all references found. Returns "true" if the given card contains
150 // oops that have references into the current collection set. Must only be
151 // called during gc.
152 bool refine_card_during_gc(jbyte* card_ptr,
153 G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
154
155 // Print accumulated summary info from the start of the VM.
156 void print_summary_info();
157
158 // Print accumulated summary info from the last time called.
159 void print_periodic_summary_info(const char* header, uint period_count);
160
161 size_t num_conc_refined_cards() const { return _num_conc_refined_cards; }
|
32 #include "memory/allocation.hpp"
33 #include "memory/iterator.hpp"
34
35 // A G1RemSet provides ways of iterating over pointers into a selected
36 // collection set.
37
38 class BitMap;
39 class CardTableModRefBS;
40 class G1BlockOffsetTable;
41 class CodeBlobClosure;
42 class G1CollectedHeap;
43 class G1HotCardCache;
44 class G1RemSetScanState;
45 class G1ParScanThreadState;
46 class G1Policy;
47 class G1SATBCardTableModRefBS;
48 class G1ScanObjsDuringScanRSClosure;
49 class G1ScanObjsDuringUpdateRSClosure;
50 class HeapRegionClaimer;
51
52 // A G1RemSet in which each heap region has a rem set that records the
53 // external heap references into it. Uses a mod ref bs to track updates,
54 // so that they can be used to update the individual region remsets.
55 class G1RemSet: public CHeapObj<mtGC> {
56 private:
57 G1RemSetScanState* _scan_state;
58 G1CardLiveData _card_live_data;
59
60 G1RemSetSummary _prev_period_summary;
61
62 // A DirtyCardQueueSet that is used to hold cards that contain
63 // references into the current collection set. This is used to
64 // update the remembered sets of the regions in the collection
65 // set in the event of an evacuation failure.
66 DirtyCardQueueSet _into_cset_dirty_card_queue_set;
67
68 // Scan all remembered sets of the collection set for references into the collection
69 // set.
70 void scan_rem_set(G1ParScanThreadState* pss,
71 CodeBlobClosure* heap_region_codeblobs,
72 uint worker_i);
73
74 // Flush remaining refinement buffers for cross-region references to either evacuate references
75 // into the collection set or update the remembered set.
76 void update_rem_set(DirtyCardQueue* into_cset_dcq, G1ParScanThreadState* pss, uint worker_i);
109 // Further applies heap_region_codeblobs on the oops of the unmarked nmethods on the strong code
110 // roots list for each region in the collection set.
111 void oops_into_collection_set_do(G1ParScanThreadState* pss,
112 CodeBlobClosure* heap_region_codeblobs,
113 uint worker_i);
114
115 // Prepare for and cleanup after an oops_into_collection_set_do
116 // call. Must call each of these once before and after (in sequential
117 // code) any thread calls oops_into_collection_set_do.
118 void prepare_for_oops_into_collection_set_do();
119 void cleanup_after_oops_into_collection_set_do();
120
121 G1RemSetScanState* scan_state() const { return _scan_state; }
122
123 // Record, if necessary, the fact that *p (where "p" is in region "from",
124 // which is required to be non-NULL) has changed to a new non-NULL value.
125 template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
126
127 // Eliminates any remembered set entries that correspond to dead heap ranges.
128 void scrub(uint worker_num, HeapRegionClaimer* hrclaimer);
129
130 // Refine the card corresponding to "card_ptr". Safe to be called concurrently
131 // to the mutator.
132 void refine_card_concurrently(jbyte* card_ptr,
133 uint worker_i);
134
135 // Refine the card corresponding to "card_ptr", applying the given closure to
136 // all references found. Returns "true" if the given card contains
137 // oops that have references into the current collection set. Must only be
138 // called during gc.
139 bool refine_card_during_gc(jbyte* card_ptr,
140 G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
141
142 // Print accumulated summary info from the start of the VM.
143 void print_summary_info();
144
145 // Print accumulated summary info from the last time called.
146 void print_periodic_summary_info(const char* header, uint period_count);
147
148 size_t num_conc_refined_cards() const { return _num_conc_refined_cards; }
|