124 "Possible deadlock");
125
126 // Release the Heap_lock first.
127 Heap_lock->unlock();
128 if (needs_pll()) {
129 release_and_notify_pending_list_lock();
130 }
131 }
132
133 //////////////////////////////////////////////////////////
134 // Methods in class VM_CMS_Initial_Mark
135 //////////////////////////////////////////////////////////
136 void VM_CMS_Initial_Mark::doit() {
137 if (lost_race()) {
138 // Nothing to do.
139 return;
140 }
141 #ifndef USDT2
142 HS_DTRACE_PROBE(hs_private, cms__initmark__begin);
143 #else /* USDT2 */
144 HS_PRIVATE_CMS_INITMARK_BEGIN(
145 );
146 #endif /* USDT2 */
147
148 _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
149
150 GenCollectedHeap* gch = GenCollectedHeap::heap();
151 GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
152
153 VM_CMS_Operation::verify_before_gc();
154
155 IsGCActiveMark x; // stop-world GC active
156 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
157
158 VM_CMS_Operation::verify_after_gc();
159
160 _collector->_gc_timer_cm->register_gc_pause_end();
161
162 #ifndef USDT2
163 HS_DTRACE_PROBE(hs_private, cms__initmark__end);
164 #else /* USDT2 */
165 HS_PRIVATE_CMS_INITMARK_END(
166 );
167 #endif /* USDT2 */
168 }
169
170 //////////////////////////////////////////////////////////
171 // Methods in class VM_CMS_Final_Remark_Operation
172 //////////////////////////////////////////////////////////
173 void VM_CMS_Final_Remark::doit() {
174 if (lost_race()) {
175 // Nothing to do.
176 return;
177 }
178 #ifndef USDT2
179 HS_DTRACE_PROBE(hs_private, cms__remark__begin);
180 #else /* USDT2 */
181 HS_PRIVATE_CMS_REMARK_BEGIN(
182 );
183 #endif /* USDT2 */
184
185 _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
186
187 GenCollectedHeap* gch = GenCollectedHeap::heap();
188 GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
189
190 VM_CMS_Operation::verify_before_gc();
191
192 IsGCActiveMark x; // stop-world GC active
193 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
194
195 VM_CMS_Operation::verify_after_gc();
196
197 _collector->save_heap_summary();
198 _collector->_gc_timer_cm->register_gc_pause_end();
199
200 #ifndef USDT2
201 HS_DTRACE_PROBE(hs_private, cms__remark__end);
202 #else /* USDT2 */
203 HS_PRIVATE_CMS_REMARK_END(
204 );
205 #endif /* USDT2 */
206 }
207
208 // VM operation to invoke a concurrent collection of a
209 // GenCollectedHeap heap.
210 void VM_GenCollectFullConcurrent::doit() {
211 assert(Thread::current()->is_VM_thread(), "Should be VM thread");
212 assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
213
214 GenCollectedHeap* gch = GenCollectedHeap::heap();
215 if (_gc_count_before == gch->total_collections()) {
216 // The "full" of do_full_collection call below "forces"
217 // a collection; the second arg, 0, below ensures that
218 // only the young gen is collected. XXX In the future,
219 // we'll probably need to have something in this interface
220 // to say do this only if we are sure we will not bail
221 // out to a full collection in this attempt, but that's
222 // for the future.
223 assert(SafepointSynchronize::is_at_safepoint(),
224 "We can only be executing this arm of if at a safepoint");
|
124 "Possible deadlock");
125
126 // Release the Heap_lock first.
127 Heap_lock->unlock();
128 if (needs_pll()) {
129 release_and_notify_pending_list_lock();
130 }
131 }
132
133 //////////////////////////////////////////////////////////
134 // Methods in class VM_CMS_Initial_Mark
135 //////////////////////////////////////////////////////////
136 void VM_CMS_Initial_Mark::doit() {
137 if (lost_race()) {
138 // Nothing to do.
139 return;
140 }
141 #ifndef USDT2
142 HS_DTRACE_PROBE(hs_private, cms__initmark__begin);
143 #else /* USDT2 */
144 HS_PRIVATE_CMS_INITMARK_BEGIN();
145 #endif /* USDT2 */
146
147 _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
148
149 GenCollectedHeap* gch = GenCollectedHeap::heap();
150 GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
151
152 VM_CMS_Operation::verify_before_gc();
153
154 IsGCActiveMark x; // stop-world GC active
155 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
156
157 VM_CMS_Operation::verify_after_gc();
158
159 _collector->_gc_timer_cm->register_gc_pause_end();
160
161 #ifndef USDT2
162 HS_DTRACE_PROBE(hs_private, cms__initmark__end);
163 #else /* USDT2 */
164 HS_PRIVATE_CMS_INITMARK_END();
165 #endif /* USDT2 */
166 }
167
168 //////////////////////////////////////////////////////////
169 // Methods in class VM_CMS_Final_Remark_Operation
170 //////////////////////////////////////////////////////////
171 void VM_CMS_Final_Remark::doit() {
172 if (lost_race()) {
173 // Nothing to do.
174 return;
175 }
176 #ifndef USDT2
177 HS_DTRACE_PROBE(hs_private, cms__remark__begin);
178 #else /* USDT2 */
179 HS_PRIVATE_CMS_REMARK_BEGIN();
180 #endif /* USDT2 */
181
182 _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
183
184 GenCollectedHeap* gch = GenCollectedHeap::heap();
185 GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
186
187 VM_CMS_Operation::verify_before_gc();
188
189 IsGCActiveMark x; // stop-world GC active
190 _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
191
192 VM_CMS_Operation::verify_after_gc();
193
194 _collector->save_heap_summary();
195 _collector->_gc_timer_cm->register_gc_pause_end();
196
197 #ifndef USDT2
198 HS_DTRACE_PROBE(hs_private, cms__remark__end);
199 #else /* USDT2 */
200 HS_PRIVATE_CMS_REMARK_END();
201 #endif /* USDT2 */
202 }
203
204 // VM operation to invoke a concurrent collection of a
205 // GenCollectedHeap heap.
206 void VM_GenCollectFullConcurrent::doit() {
207 assert(Thread::current()->is_VM_thread(), "Should be VM thread");
208 assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
209
210 GenCollectedHeap* gch = GenCollectedHeap::heap();
211 if (_gc_count_before == gch->total_collections()) {
212 // The "full" of do_full_collection call below "forces"
213 // a collection; the second arg, 0, below ensures that
214 // only the young gen is collected. XXX In the future,
215 // we'll probably need to have something in this interface
216 // to say do this only if we are sure we will not bail
217 // out to a full collection in this attempt, but that's
218 // for the future.
219 assert(SafepointSynchronize::is_at_safepoint(),
220 "We can only be executing this arm of if at a safepoint");
|