193 virtual void oops_do(OopClosure* f) { /* do nothing */ };
194
195 // CAUTION: <don't hang yourself with following rope>
196 // If you override these methods, make sure that the evaluation
197 // of these methods is race-free and non-blocking, since these
198 // methods may be evaluated either by the mutators or by the
199 // vm thread, either concurrently with mutators or with the mutators
200 // stopped. In other words, taking locks is verboten, and if there
201 // are any races in evaluating the conditions, they'd better be benign.
202 virtual bool evaluate_at_safepoint() const {
203 return evaluation_mode() == _safepoint ||
204 evaluation_mode() == _async_safepoint;
205 }
206 virtual bool evaluate_concurrently() const {
207 return evaluation_mode() == _concurrent ||
208 evaluation_mode() == _async_safepoint;
209 }
210
211 static const char* mode_to_string(Mode mode);
212
213 // Safepoint cleanup
214 // Return true if this VM_Operation takes care of idle monitor deflation.
215 // Idle monitor deflation is usually done by the safepoint cleanup phase
216 // in SafepointSynchronize::do_cleanup_tasks(). However, a VM_Operation
217 // may want to take care of this itself, for example if a GC operation
218 // scans the thread stack anyway, it probably can piggy-back monitor
219 // deflation. Note that this is only possible if the oop marks are preserved
220 // during the VM operation (for example, most current GCs *don't* preserve
221 // the mark word, but displace it and temporarily use the mark word as
222 // forwarding pointer).
223 virtual bool deflates_idle_monitors() { return false; }
224
225 // Return true if this VM_Operation takes care of nmethod marking.
226 // NMethod marking is usually done by the safepoint cleanup phase
227 // in SafepointSynchronize::do_cleanup_tasks(). However, a VM_Operation
228 // may want to take care of this itself, for example if a GC operation
229 // scans the thread stack anyway, it can just as well piggy-back nmethod
230 // marking.
231 virtual bool marks_nmethods() { return false; }
232
233 // Debugging
234 virtual void print_on_error(outputStream* st) const;
235 const char* name() const { return _names[type()]; }
236 static const char* name(int type) {
237 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
238 return _names[type];
239 }
240 #ifndef PRODUCT
241 void print_on(outputStream* st) const { print_on_error(st); }
242 #endif
243 };
244
245 class VM_ThreadStop: public VM_Operation {
246 private:
247 oop _thread; // The Thread that the Throwable is thrown against
248 oop _throwable; // The Throwable thrown at the target Thread
249 public:
250 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the
251 // VM operation is executed.
252 VM_ThreadStop(oop thread, oop throwable) {
|
193 virtual void oops_do(OopClosure* f) { /* do nothing */ };
194
195 // CAUTION: <don't hang yourself with following rope>
196 // If you override these methods, make sure that the evaluation
197 // of these methods is race-free and non-blocking, since these
198 // methods may be evaluated either by the mutators or by the
199 // vm thread, either concurrently with mutators or with the mutators
200 // stopped. In other words, taking locks is verboten, and if there
201 // are any races in evaluating the conditions, they'd better be benign.
202 virtual bool evaluate_at_safepoint() const {
203 return evaluation_mode() == _safepoint ||
204 evaluation_mode() == _async_safepoint;
205 }
206 virtual bool evaluate_concurrently() const {
207 return evaluation_mode() == _concurrent ||
208 evaluation_mode() == _async_safepoint;
209 }
210
211 static const char* mode_to_string(Mode mode);
212
213 // Debugging
214 virtual void print_on_error(outputStream* st) const;
215 const char* name() const { return _names[type()]; }
216 static const char* name(int type) {
217 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
218 return _names[type];
219 }
220 #ifndef PRODUCT
221 void print_on(outputStream* st) const { print_on_error(st); }
222 #endif
223 };
224
225 class VM_ThreadStop: public VM_Operation {
226 private:
227 oop _thread; // The Thread that the Throwable is thrown against
228 oop _throwable; // The Throwable thrown at the target Thread
229 public:
230 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the
231 // VM operation is executed.
232 VM_ThreadStop(oop thread, oop throwable) {
|