1 /*
2 * Copyright (c) 1997, 2009, 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 *
23 */
24
25 // The following classes are used for operations
26 // initiated by a Java thread but that must
27 // take place in the VMThread.
28
29 #define VM_OP_ENUM(type) VMOp_##type,
30
31 // Note: When new VM_XXX comes up, add 'XXX' to the template table.
32 #define VM_OPS_DO(template) \
33 template(Dummy) \
34 template(ThreadStop) \
35 template(ThreadDump) \
36 template(PrintThreads) \
37 template(FindDeadlocks) \
38 template(ForceSafepoint) \
39 template(ForceAsyncSafepoint) \
40 template(Deoptimize) \
41 template(DeoptimizeFrame) \
42 template(DeoptimizeAll) \
43 template(ZombieAll) \
44 template(HandleFullCodeCache) \
363 private:
364 int _exit_code;
365 static volatile bool _vm_exited;
366 static Thread * _shutdown_thread;
367 static void wait_if_vm_exited();
368 public:
369 VM_Exit(int exit_code) {
370 _exit_code = exit_code;
371 }
372 static int wait_for_threads_in_native_to_block();
373 static int set_vm_exited();
374 static bool vm_exited() { return _vm_exited; }
375 static void block_if_vm_exited() {
376 if (_vm_exited) {
377 wait_if_vm_exited();
378 }
379 }
380 VMOp_Type type() const { return VMOp_Exit; }
381 void doit();
382 };
|
1 /*
2 * Copyright (c) 1997, 2010, 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 *
23 */
24
25 #ifndef SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
26 #define SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
27
28 #include "classfile/javaClasses.hpp"
29 #include "memory/allocation.hpp"
30 #include "oops/oop.hpp"
31 #include "runtime/thread.hpp"
32 #include "utilities/top.hpp"
33
34 // The following classes are used for operations
35 // initiated by a Java thread but that must
36 // take place in the VMThread.
37
38 #define VM_OP_ENUM(type) VMOp_##type,
39
40 // Note: When new VM_XXX comes up, add 'XXX' to the template table.
41 #define VM_OPS_DO(template) \
42 template(Dummy) \
43 template(ThreadStop) \
44 template(ThreadDump) \
45 template(PrintThreads) \
46 template(FindDeadlocks) \
47 template(ForceSafepoint) \
48 template(ForceAsyncSafepoint) \
49 template(Deoptimize) \
50 template(DeoptimizeFrame) \
51 template(DeoptimizeAll) \
52 template(ZombieAll) \
53 template(HandleFullCodeCache) \
372 private:
373 int _exit_code;
374 static volatile bool _vm_exited;
375 static Thread * _shutdown_thread;
376 static void wait_if_vm_exited();
377 public:
378 VM_Exit(int exit_code) {
379 _exit_code = exit_code;
380 }
381 static int wait_for_threads_in_native_to_block();
382 static int set_vm_exited();
383 static bool vm_exited() { return _vm_exited; }
384 static void block_if_vm_exited() {
385 if (_vm_exited) {
386 wait_if_vm_exited();
387 }
388 }
389 VMOp_Type type() const { return VMOp_Exit; }
390 void doit();
391 };
392
393 #endif // SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
|