1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
161 virtual bool allow_nested_vm_operations() const { return false; }
162 virtual bool is_cheap_allocated() const { return false; }
163 virtual void oops_do(OopClosure* f) { /* do nothing */ };
164
165 // CAUTION: <don't hang yourself with following rope>
166 // If you override these methods, make sure that the evaluation
167 // of these methods is race-free and non-blocking, since these
168 // methods may be evaluated either by the mutators or by the
169 // vm thread, either concurrently with mutators or with the mutators
170 // stopped. In other words, taking locks is verboten, and if there
171 // are any races in evaluating the conditions, they'd better be benign.
172 virtual bool evaluate_at_safepoint() const {
173 return evaluation_mode() == _safepoint ||
174 evaluation_mode() == _async_safepoint;
175 }
176 virtual bool evaluate_concurrently() const {
177 return evaluation_mode() == _concurrent ||
178 evaluation_mode() == _async_safepoint;
179 }
180
181 // Debugging
182 void print_on_error(outputStream* st) const;
183 const char* name() const { return _names[type()]; }
184 static const char* name(int type) {
185 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
186 return _names[type];
187 }
188 #ifndef PRODUCT
189 void print_on(outputStream* st) const { print_on_error(st); }
190 #endif
191 };
192
193 class VM_ThreadStop: public VM_Operation {
194 private:
195 oop _thread; // The Thread that the Throwable is thrown against
196 oop _throwable; // The Throwable thrown at the target Thread
197 public:
198 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the
199 // VM operation is executed.
200 VM_ThreadStop(oop thread, oop throwable) {
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
161 virtual bool allow_nested_vm_operations() const { return false; }
162 virtual bool is_cheap_allocated() const { return false; }
163 virtual void oops_do(OopClosure* f) { /* do nothing */ };
164
165 // CAUTION: <don't hang yourself with following rope>
166 // If you override these methods, make sure that the evaluation
167 // of these methods is race-free and non-blocking, since these
168 // methods may be evaluated either by the mutators or by the
169 // vm thread, either concurrently with mutators or with the mutators
170 // stopped. In other words, taking locks is verboten, and if there
171 // are any races in evaluating the conditions, they'd better be benign.
172 virtual bool evaluate_at_safepoint() const {
173 return evaluation_mode() == _safepoint ||
174 evaluation_mode() == _async_safepoint;
175 }
176 virtual bool evaluate_concurrently() const {
177 return evaluation_mode() == _concurrent ||
178 evaluation_mode() == _async_safepoint;
179 }
180
181 static const char* mode_to_string(Mode mode);
182
183 // Debugging
184 void print_on_error(outputStream* st) const;
185 const char* name() const { return _names[type()]; }
186 static const char* name(int type) {
187 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
188 return _names[type];
189 }
190 #ifndef PRODUCT
191 void print_on(outputStream* st) const { print_on_error(st); }
192 #endif
193 };
194
195 class VM_ThreadStop: public VM_Operation {
196 private:
197 oop _thread; // The Thread that the Throwable is thrown against
198 oop _throwable; // The Throwable thrown at the target Thread
199 public:
200 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the
201 // VM operation is executed.
202 VM_ThreadStop(oop thread, oop throwable) {
|