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