82 ~G1RemSet();
83
84 // Invoke "blk->do_oop" on all pointers into the CS in objects in regions
85 // outside the CS (having invoked "blk->set_region" to set the "from"
86 // region correctly beforehand.) The "worker_i" param is for the
87 // parallel case where the number of the worker thread calling this
88 // function can be helpful in partitioning the work to be done. It
89 // should be the same as the "i" passed to the calling thread's
90 // work(i) function. In the sequential case this param will be ingored.
91 void oops_into_collection_set_do(OopsInHeapRegionClosure* blk, int worker_i);
92
93 // Prepare for and cleanup after an oops_into_collection_set_do
94 // call. Must call each of these once before and after (in sequential
95 // code) any threads call oops_into_collection_set_do. (This offers an
96 // opportunity to sequential setup and teardown of structures needed by a
97 // parallel iteration over the CS's RS.)
98 void prepare_for_oops_into_collection_set_do();
99 void cleanup_after_oops_into_collection_set_do();
100
101 void scanRS(OopsInHeapRegionClosure* oc, int worker_i);
102 void updateRS(DirtyCardQueue* into_cset_dcq, int worker_i);
103
104 CardTableModRefBS* ct_bs() { return _ct_bs; }
105 size_t cardsScanned() { return _total_cards_scanned; }
106
107 // Record, if necessary, the fact that *p (where "p" is in region "from",
108 // which is required to be non-NULL) has changed to a new non-NULL value.
109 template <class T> void write_ref(HeapRegion* from, T* p);
110 template <class T> void par_write_ref(HeapRegion* from, T* p, int tid);
111
112 // Requires "region_bm" and "card_bm" to be bitmaps with 1 bit per region
113 // or card, respectively, such that a region or card with a corresponding
114 // 0 bit contains no part of any live object. Eliminates any remembered
115 // set entries that correspond to dead heap ranges.
116 void scrub(BitMap* region_bm, BitMap* card_bm);
117
118 // Like the above, but assumes is called in parallel: "worker_num" is the
119 // parallel thread id of the current thread, and "claim_val" is the
120 // value that should be used to claim heap regions.
121 void scrub_par(BitMap* region_bm, BitMap* card_bm,
122 uint worker_num, int claim_val);
123
124 // Refine the card corresponding to "card_ptr".
125 // If check_for_refs_into_cset is true, a true result is returned
126 // if the given card contains oops that have references into the
127 // current collection set.
128 virtual bool refine_card(jbyte* card_ptr,
129 int worker_i,
130 bool check_for_refs_into_cset);
131
132 // Print accumulated summary info from the start of the VM.
133 virtual void print_summary_info();
134
135 // Print accumulated summary info from the last time called.
136 virtual void print_periodic_summary_info();
137
138 // Prepare remembered set for verification.
139 virtual void prepare_for_verify();
140
141 size_t conc_refine_cards() const {
142 return _conc_refine_cards;
143 }
144 };
145
146 class CountNonCleanMemRegionClosure: public MemRegionClosure {
147 G1CollectedHeap* _g1;
148 int _n;
149 HeapWord* _start_first;
150 public:
151 CountNonCleanMemRegionClosure(G1CollectedHeap* g1) :
152 _g1(g1), _n(0), _start_first(NULL)
153 {}
154 void do_MemRegion(MemRegion mr);
155 int n() { return _n; };
156 HeapWord* start_first() { return _start_first; }
157 };
158
159 class UpdateRSOopClosure: public ExtendedOopClosure {
|
82 ~G1RemSet();
83
84 // Invoke "blk->do_oop" on all pointers into the CS in objects in regions
85 // outside the CS (having invoked "blk->set_region" to set the "from"
86 // region correctly beforehand.) The "worker_i" param is for the
87 // parallel case where the number of the worker thread calling this
88 // function can be helpful in partitioning the work to be done. It
89 // should be the same as the "i" passed to the calling thread's
90 // work(i) function. In the sequential case this param will be ingored.
91 void oops_into_collection_set_do(OopsInHeapRegionClosure* blk, int worker_i);
92
93 // Prepare for and cleanup after an oops_into_collection_set_do
94 // call. Must call each of these once before and after (in sequential
95 // code) any threads call oops_into_collection_set_do. (This offers an
96 // opportunity to sequential setup and teardown of structures needed by a
97 // parallel iteration over the CS's RS.)
98 void prepare_for_oops_into_collection_set_do();
99 void cleanup_after_oops_into_collection_set_do();
100
101 void scanRS(OopsInHeapRegionClosure* oc, int worker_i);
102 void updateRS(DirtyCardQueue* into_cset_dcq, int worker_i, bool update_accounting);
103
104 CardTableModRefBS* ct_bs() { return _ct_bs; }
105 size_t cardsScanned() { return _total_cards_scanned; }
106
107 // Record, if necessary, the fact that *p (where "p" is in region "from",
108 // which is required to be non-NULL) has changed to a new non-NULL value.
109 template <class T> void write_ref(HeapRegion* from, T* p);
110 template <class T> void par_write_ref(HeapRegion* from, T* p, int tid);
111
112 // Requires "region_bm" and "card_bm" to be bitmaps with 1 bit per region
113 // or card, respectively, such that a region or card with a corresponding
114 // 0 bit contains no part of any live object. Eliminates any remembered
115 // set entries that correspond to dead heap ranges.
116 void scrub(BitMap* region_bm, BitMap* card_bm);
117
118 // Like the above, but assumes is called in parallel: "worker_num" is the
119 // parallel thread id of the current thread, and "claim_val" is the
120 // value that should be used to claim heap regions.
121 void scrub_par(BitMap* region_bm, BitMap* card_bm,
122 uint worker_num, int claim_val);
123
124 // Refine the card corresponding to "card_ptr".
125 // If check_for_refs_into_cset is true, a true result is returned
126 // if the given card contains oops that have references into the
127 // current collection set.
128 bool refine_card(jbyte* card_ptr,
129 int worker_i,
130 bool check_for_refs_into_cset);
131
132 bool refine_card_without_check(jbyte* card_ptr,
133 int worker_i,
134 bool check_for_refs_into_cset);
135
136 // Print accumulated summary info from the start of the VM.
137 void print_summary_info();
138
139 // Print accumulated summary info from the last time called.
140 void print_periodic_summary_info();
141
142 // Prepare remembered set for verification.
143 void prepare_for_verify();
144
145 size_t conc_refine_cards() const {
146 return _conc_refine_cards;
147 }
148 };
149
150 class CountNonCleanMemRegionClosure: public MemRegionClosure {
151 G1CollectedHeap* _g1;
152 int _n;
153 HeapWord* _start_first;
154 public:
155 CountNonCleanMemRegionClosure(G1CollectedHeap* g1) :
156 _g1(g1), _n(0), _start_first(NULL)
157 {}
158 void do_MemRegion(MemRegion mr);
159 int n() { return _n; };
160 HeapWord* start_first() { return _start_first; }
161 };
162
163 class UpdateRSOopClosure: public ExtendedOopClosure {
|