annotate src/share/vm/runtime/vm_operations.hpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 227a9e5e4b4a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
10405
f2110083203d 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 10186
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1202
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1202
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1202
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
25 #ifndef SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
26 #define SHARE_VM_RUNTIME_VM_OPERATIONS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
28 #include "classfile/javaClasses.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
29 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
30 #include "oops/oop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
31 #include "runtime/thread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
32 #include "utilities/top.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
33
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // The following classes are used for operations
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // initiated by a Java thread but that must
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // take place in the VMThread.
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 #define VM_OP_ENUM(type) VMOp_##type,
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // Note: When new VM_XXX comes up, add 'XXX' to the template table.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 #define VM_OPS_DO(template) \
a61af66fc99e Initial load
duke
parents:
diff changeset
42 template(Dummy) \
a61af66fc99e Initial load
duke
parents:
diff changeset
43 template(ThreadStop) \
a61af66fc99e Initial load
duke
parents:
diff changeset
44 template(ThreadDump) \
a61af66fc99e Initial load
duke
parents:
diff changeset
45 template(PrintThreads) \
a61af66fc99e Initial load
duke
parents:
diff changeset
46 template(FindDeadlocks) \
a61af66fc99e Initial load
duke
parents:
diff changeset
47 template(ForceSafepoint) \
a61af66fc99e Initial load
duke
parents:
diff changeset
48 template(ForceAsyncSafepoint) \
a61af66fc99e Initial load
duke
parents:
diff changeset
49 template(Deoptimize) \
a61af66fc99e Initial load
duke
parents:
diff changeset
50 template(DeoptimizeFrame) \
a61af66fc99e Initial load
duke
parents:
diff changeset
51 template(DeoptimizeAll) \
a61af66fc99e Initial load
duke
parents:
diff changeset
52 template(ZombieAll) \
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
53 template(UnlinkSymbols) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54 template(Verify) \
a61af66fc99e Initial load
duke
parents:
diff changeset
55 template(PrintJNI) \
a61af66fc99e Initial load
duke
parents:
diff changeset
56 template(HeapDumper) \
a61af66fc99e Initial load
duke
parents:
diff changeset
57 template(DeoptimizeTheWorld) \
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
58 template(CollectForMetadataAllocation) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 template(GC_HeapInspection) \
a61af66fc99e Initial load
duke
parents:
diff changeset
60 template(GenCollectFull) \
a61af66fc99e Initial load
duke
parents:
diff changeset
61 template(GenCollectFullConcurrent) \
a61af66fc99e Initial load
duke
parents:
diff changeset
62 template(GenCollectForAllocation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
63 template(ParallelGCFailedAllocation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
64 template(ParallelGCSystemGC) \
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 139
diff changeset
65 template(CGC_Operation) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
66 template(CMS_Initial_Mark) \
a61af66fc99e Initial load
duke
parents:
diff changeset
67 template(CMS_Final_Remark) \
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 139
diff changeset
68 template(G1CollectFull) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 139
diff changeset
69 template(G1CollectForAllocation) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 139
diff changeset
70 template(G1IncCollectionPause) \
20404
227a9e5e4b4a 8057536: Refactor G1 to allow context specific allocations
sjohanss
parents: 17867
diff changeset
71 template(DestroyAllocationContext) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
72 template(EnableBiasedLocking) \
a61af66fc99e Initial load
duke
parents:
diff changeset
73 template(RevokeBias) \
a61af66fc99e Initial load
duke
parents:
diff changeset
74 template(BulkRevokeBias) \
a61af66fc99e Initial load
duke
parents:
diff changeset
75 template(PopulateDumpSharedSpace) \
a61af66fc99e Initial load
duke
parents:
diff changeset
76 template(JNIFunctionTableCopier) \
a61af66fc99e Initial load
duke
parents:
diff changeset
77 template(RedefineClasses) \
a61af66fc99e Initial load
duke
parents:
diff changeset
78 template(GetOwnedMonitorInfo) \
a61af66fc99e Initial load
duke
parents:
diff changeset
79 template(GetObjectMonitorUsage) \
a61af66fc99e Initial load
duke
parents:
diff changeset
80 template(GetCurrentContendedMonitor) \
a61af66fc99e Initial load
duke
parents:
diff changeset
81 template(GetStackTrace) \
a61af66fc99e Initial load
duke
parents:
diff changeset
82 template(GetMultipleStackTraces) \
a61af66fc99e Initial load
duke
parents:
diff changeset
83 template(GetAllStackTraces) \
a61af66fc99e Initial load
duke
parents:
diff changeset
84 template(GetThreadListStackTraces) \
a61af66fc99e Initial load
duke
parents:
diff changeset
85 template(GetFrameCount) \
a61af66fc99e Initial load
duke
parents:
diff changeset
86 template(GetFrameLocation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
87 template(ChangeBreakpoints) \
a61af66fc99e Initial load
duke
parents:
diff changeset
88 template(GetOrSetLocal) \
a61af66fc99e Initial load
duke
parents:
diff changeset
89 template(GetCurrentLocation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
90 template(EnterInterpOnlyMode) \
a61af66fc99e Initial load
duke
parents:
diff changeset
91 template(ChangeSingleStep) \
a61af66fc99e Initial load
duke
parents:
diff changeset
92 template(HeapWalkOperation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
93 template(HeapIterateOperation) \
a61af66fc99e Initial load
duke
parents:
diff changeset
94 template(ReportJavaOutOfMemory) \
4800
94ec88ca68e2 7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents: 2426
diff changeset
95 template(JFRCheckpoint) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
96 template(Exit) \
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 6725
diff changeset
97 template(LinuxDllLoad) \
17827
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
98 template(RotateGCLog) \
17867
b127b0d6de7f 8039597: WhiteBox :: clean type profiling data
iignatyev
parents: 17827
diff changeset
99 template(WhiteBoxOperation) \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 4800
diff changeset
101 class VM_Operation: public CHeapObj<mtInternal> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
103 enum Mode {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 _safepoint, // blocking, safepoint, vm_op C-heap allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
105 _no_safepoint, // blocking, no safepoint, vm_op C-Heap allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _concurrent, // non-blocking, no safepoint, vm_op C-Heap allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
107 _async_safepoint // non-blocking, safepoint, vm_op C-Heap allocated
a61af66fc99e Initial load
duke
parents:
diff changeset
108 };
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 enum VMOp_Type {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 VM_OPS_DO(VM_OP_ENUM)
a61af66fc99e Initial load
duke
parents:
diff changeset
112 VMOp_Terminating
a61af66fc99e Initial load
duke
parents:
diff changeset
113 };
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
116 Thread* _calling_thread;
a61af66fc99e Initial load
duke
parents:
diff changeset
117 ThreadPriority _priority;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 long _timestamp;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 VM_Operation* _next;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 VM_Operation* _prev;
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // The VM operation name array
a61af66fc99e Initial load
duke
parents:
diff changeset
123 static const char* _names[];
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 VM_Operation() { _calling_thread = NULL; _next = NULL; _prev = NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 virtual ~VM_Operation() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // VM operation support (used by VM thread)
a61af66fc99e Initial load
duke
parents:
diff changeset
130 Thread* calling_thread() const { return _calling_thread; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 ThreadPriority priority() { return _priority; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 void set_calling_thread(Thread* thread, ThreadPriority priority);
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 long timestamp() const { return _timestamp; }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 void set_timestamp(long timestamp) { _timestamp = timestamp; }
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // Called by VM thread - does in turn invoke doit(). Do not override this
a61af66fc99e Initial load
duke
parents:
diff changeset
138 void evaluate();
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // evaluate() is called by the VMThread and in turn calls doit().
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // If the thread invoking VMThread::execute((VM_Operation*) is a JavaThread,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // doit_prologue() is called in that thread before transferring control to
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // the VMThread.
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // If doit_prologue() returns true the VM operation will proceed, and
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // doit_epilogue() will be called by the JavaThread once the VM operation
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // completes. If doit_prologue() returns false the VM operation is cancelled.
a61af66fc99e Initial load
duke
parents:
diff changeset
147 virtual void doit() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
148 virtual bool doit_prologue() { return true; };
a61af66fc99e Initial load
duke
parents:
diff changeset
149 virtual void doit_epilogue() {}; // Note: Not called if mode is: _concurrent
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // Type test
a61af66fc99e Initial load
duke
parents:
diff changeset
152 virtual bool is_methodCompiler() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Linking
a61af66fc99e Initial load
duke
parents:
diff changeset
155 VM_Operation *next() const { return _next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 VM_Operation *prev() const { return _prev; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 void set_next(VM_Operation *next) { _next = next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 void set_prev(VM_Operation *prev) { _prev = prev; }
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // Configuration. Override these appropriatly in subclasses.
a61af66fc99e Initial load
duke
parents:
diff changeset
161 virtual VMOp_Type type() const = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
162 virtual Mode evaluation_mode() const { return _safepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 virtual bool allow_nested_vm_operations() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
164 virtual bool is_cheap_allocated() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
165 virtual void oops_do(OopClosure* f) { /* do nothing */ };
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // CAUTION: <don't hang yourself with following rope>
a61af66fc99e Initial load
duke
parents:
diff changeset
168 // If you override these methods, make sure that the evaluation
a61af66fc99e Initial load
duke
parents:
diff changeset
169 // of these methods is race-free and non-blocking, since these
a61af66fc99e Initial load
duke
parents:
diff changeset
170 // methods may be evaluated either by the mutators or by the
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // vm thread, either concurrently with mutators or with the mutators
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // stopped. In other words, taking locks is verboten, and if there
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // are any races in evaluating the conditions, they'd better be benign.
a61af66fc99e Initial load
duke
parents:
diff changeset
174 virtual bool evaluate_at_safepoint() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 return evaluation_mode() == _safepoint ||
a61af66fc99e Initial load
duke
parents:
diff changeset
176 evaluation_mode() == _async_safepoint;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 virtual bool evaluate_concurrently() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 return evaluation_mode() == _concurrent ||
a61af66fc99e Initial load
duke
parents:
diff changeset
180 evaluation_mode() == _async_safepoint;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182
10405
f2110083203d 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 10186
diff changeset
183 static const char* mode_to_string(Mode mode);
f2110083203d 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 10186
diff changeset
184
0
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // Debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
186 void print_on_error(outputStream* st) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 const char* name() const { return _names[type()]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
188 static const char* name(int type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
a61af66fc99e Initial load
duke
parents:
diff changeset
190 return _names[type];
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
193 void print_on(outputStream* st) const { print_on_error(st); }
a61af66fc99e Initial load
duke
parents:
diff changeset
194 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
195 };
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 class VM_ThreadStop: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
199 oop _thread; // The Thread that the Throwable is thrown against
a61af66fc99e Initial load
duke
parents:
diff changeset
200 oop _throwable; // The Throwable thrown at the target Thread
a61af66fc99e Initial load
duke
parents:
diff changeset
201 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
202 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the
a61af66fc99e Initial load
duke
parents:
diff changeset
203 // VM operation is executed.
a61af66fc99e Initial load
duke
parents:
diff changeset
204 VM_ThreadStop(oop thread, oop throwable) {
a61af66fc99e Initial load
duke
parents:
diff changeset
205 _thread = thread;
a61af66fc99e Initial load
duke
parents:
diff changeset
206 _throwable = throwable;
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208 VMOp_Type type() const { return VMOp_ThreadStop; }
a61af66fc99e Initial load
duke
parents:
diff changeset
209 oop target_thread() const { return _thread; }
a61af66fc99e Initial load
duke
parents:
diff changeset
210 oop throwable() const { return _throwable;}
a61af66fc99e Initial load
duke
parents:
diff changeset
211 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // We deoptimize if top-most frame is compiled - this might require a C2I adapter to be generated
a61af66fc99e Initial load
duke
parents:
diff changeset
213 bool allow_nested_vm_operations() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 Mode evaluation_mode() const { return _async_safepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 bool is_cheap_allocated() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // GC support
a61af66fc99e Initial load
duke
parents:
diff changeset
218 void oops_do(OopClosure* f) {
a61af66fc99e Initial load
duke
parents:
diff changeset
219 f->do_oop(&_thread); f->do_oop(&_throwable);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 }
a61af66fc99e Initial load
duke
parents:
diff changeset
221 };
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // dummy vm op, evaluated just to force a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
224 class VM_ForceSafepoint: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
225 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
226 VM_ForceSafepoint() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
227 void doit() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
228 VMOp_Type type() const { return VMOp_ForceSafepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
229 };
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // dummy vm op, evaluated just to force a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
232 class VM_ForceAsyncSafepoint: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
234 VM_ForceAsyncSafepoint() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
235 void doit() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
236 VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
237 Mode evaluation_mode() const { return _async_safepoint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
238 bool is_cheap_allocated() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
239 };
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 class VM_Deoptimize: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
243 VM_Deoptimize() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
244 VMOp_Type type() const { return VMOp_Deoptimize; }
a61af66fc99e Initial load
duke
parents:
diff changeset
245 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
246 bool allow_nested_vm_operations() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
247 };
a61af66fc99e Initial load
duke
parents:
diff changeset
248
1905
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
249
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
250 // Deopt helper that can deoptimize frames in threads other than the
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
251 // current thread. Only used through Deoptimization::deoptimize_frame.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
252 class VM_DeoptimizeFrame: public VM_Operation {
1905
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
253 friend class Deoptimization;
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
254
0
a61af66fc99e Initial load
duke
parents:
diff changeset
255 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
256 JavaThread* _thread;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 intptr_t* _id;
5110
0ebca2e35ca5 more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4800
diff changeset
258 int _reason;
0ebca2e35ca5 more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4800
diff changeset
259 VM_DeoptimizeFrame(JavaThread* thread, intptr_t* id, int reason);
1905
ce6848d0666d 6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents: 1552
diff changeset
260
0
a61af66fc99e Initial load
duke
parents:
diff changeset
261 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
262 VMOp_Type type() const { return VMOp_DeoptimizeFrame; }
a61af66fc99e Initial load
duke
parents:
diff changeset
263 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
264 bool allow_nested_vm_operations() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 };
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
268 class VM_DeoptimizeAll: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
269 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
270 KlassHandle _dependee;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
272 VM_DeoptimizeAll() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
273 VMOp_Type type() const { return VMOp_DeoptimizeAll; }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
275 bool allow_nested_vm_operations() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 };
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 class VM_ZombieAll: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
280 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
281 VM_ZombieAll() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
282 VMOp_Type type() const { return VMOp_ZombieAll; }
a61af66fc99e Initial load
duke
parents:
diff changeset
283 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
284 bool allow_nested_vm_operations() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
285 };
a61af66fc99e Initial load
duke
parents:
diff changeset
286 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
287
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
288 class VM_UnlinkSymbols: public VM_Operation {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
289 public:
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
290 VM_UnlinkSymbols() {}
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
291 VMOp_Type type() const { return VMOp_UnlinkSymbols; }
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
292 void doit();
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
293 bool allow_nested_vm_operations() const { return true; }
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
294 };
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
295
0
a61af66fc99e Initial load
duke
parents:
diff changeset
296 class VM_Verify: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
297 private:
9071
68fe50d4f1d5 8011343: Add new flag for verifying the heap during startup
johnc
parents: 8710
diff changeset
298 bool _silent;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
299 public:
10186
b06ac540229e 8013132: Add a flag to turn off the output of the verbose verification code
stefank
parents: 9071
diff changeset
300 VM_Verify(bool silent = VerifySilently) : _silent(silent) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
301 VMOp_Type type() const { return VMOp_Verify; }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
303 };
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 class VM_PrintThreads: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
308 outputStream* _out;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 bool _print_concurrent_locks;
a61af66fc99e Initial load
duke
parents:
diff changeset
310 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
311 VM_PrintThreads() { _out = tty; _print_concurrent_locks = PrintConcurrentLocks; }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 VM_PrintThreads(outputStream* out, bool print_concurrent_locks) { _out = out; _print_concurrent_locks = print_concurrent_locks; }
a61af66fc99e Initial load
duke
parents:
diff changeset
313 VMOp_Type type() const { return VMOp_PrintThreads; }
a61af66fc99e Initial load
duke
parents:
diff changeset
314 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
315 bool doit_prologue();
a61af66fc99e Initial load
duke
parents:
diff changeset
316 void doit_epilogue();
a61af66fc99e Initial load
duke
parents:
diff changeset
317 };
a61af66fc99e Initial load
duke
parents:
diff changeset
318
a61af66fc99e Initial load
duke
parents:
diff changeset
319 class VM_PrintJNI: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
320 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
321 outputStream* _out;
a61af66fc99e Initial load
duke
parents:
diff changeset
322 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
323 VM_PrintJNI() { _out = tty; }
a61af66fc99e Initial load
duke
parents:
diff changeset
324 VM_PrintJNI(outputStream* out) { _out = out; }
a61af66fc99e Initial load
duke
parents:
diff changeset
325 VMOp_Type type() const { return VMOp_PrintJNI; }
a61af66fc99e Initial load
duke
parents:
diff changeset
326 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
327 };
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329 class DeadlockCycle;
a61af66fc99e Initial load
duke
parents:
diff changeset
330 class VM_FindDeadlocks: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
331 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
332 bool _concurrent_locks;
a61af66fc99e Initial load
duke
parents:
diff changeset
333 DeadlockCycle* _deadlocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
334 outputStream* _out;
a61af66fc99e Initial load
duke
parents:
diff changeset
335
a61af66fc99e Initial load
duke
parents:
diff changeset
336 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
337 VM_FindDeadlocks(bool concurrent_locks) : _concurrent_locks(concurrent_locks), _out(NULL), _deadlocks(NULL) {};
a61af66fc99e Initial load
duke
parents:
diff changeset
338 VM_FindDeadlocks(outputStream* st) : _concurrent_locks(true), _out(st), _deadlocks(NULL) {};
a61af66fc99e Initial load
duke
parents:
diff changeset
339 ~VM_FindDeadlocks();
a61af66fc99e Initial load
duke
parents:
diff changeset
340
a61af66fc99e Initial load
duke
parents:
diff changeset
341 DeadlockCycle* result() { return _deadlocks; };
a61af66fc99e Initial load
duke
parents:
diff changeset
342 VMOp_Type type() const { return VMOp_FindDeadlocks; }
a61af66fc99e Initial load
duke
parents:
diff changeset
343 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
344 bool doit_prologue();
a61af66fc99e Initial load
duke
parents:
diff changeset
345 };
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 class ThreadDumpResult;
a61af66fc99e Initial load
duke
parents:
diff changeset
348 class ThreadSnapshot;
a61af66fc99e Initial load
duke
parents:
diff changeset
349 class ThreadConcurrentLocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351 class VM_ThreadDump : public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
352 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
353 ThreadDumpResult* _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
354 int _num_threads;
a61af66fc99e Initial load
duke
parents:
diff changeset
355 GrowableArray<instanceHandle>* _threads;
a61af66fc99e Initial load
duke
parents:
diff changeset
356 int _max_depth;
a61af66fc99e Initial load
duke
parents:
diff changeset
357 bool _with_locked_monitors;
a61af66fc99e Initial load
duke
parents:
diff changeset
358 bool _with_locked_synchronizers;
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 ThreadSnapshot* snapshot_thread(JavaThread* java_thread, ThreadConcurrentLocks* tcl);
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
363 VM_ThreadDump(ThreadDumpResult* result,
a61af66fc99e Initial load
duke
parents:
diff changeset
364 int max_depth, // -1 indicates entire stack
a61af66fc99e Initial load
duke
parents:
diff changeset
365 bool with_locked_monitors,
a61af66fc99e Initial load
duke
parents:
diff changeset
366 bool with_locked_synchronizers);
a61af66fc99e Initial load
duke
parents:
diff changeset
367
a61af66fc99e Initial load
duke
parents:
diff changeset
368 VM_ThreadDump(ThreadDumpResult* result,
a61af66fc99e Initial load
duke
parents:
diff changeset
369 GrowableArray<instanceHandle>* threads,
a61af66fc99e Initial load
duke
parents:
diff changeset
370 int num_threads, // -1 indicates entire stack
a61af66fc99e Initial load
duke
parents:
diff changeset
371 int max_depth,
a61af66fc99e Initial load
duke
parents:
diff changeset
372 bool with_locked_monitors,
a61af66fc99e Initial load
duke
parents:
diff changeset
373 bool with_locked_synchronizers);
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 VMOp_Type type() const { return VMOp_ThreadDump; }
a61af66fc99e Initial load
duke
parents:
diff changeset
376 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
377 bool doit_prologue();
a61af66fc99e Initial load
duke
parents:
diff changeset
378 void doit_epilogue();
a61af66fc99e Initial load
duke
parents:
diff changeset
379 };
a61af66fc99e Initial load
duke
parents:
diff changeset
380
a61af66fc99e Initial load
duke
parents:
diff changeset
381
a61af66fc99e Initial load
duke
parents:
diff changeset
382 class VM_Exit: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
383 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
384 int _exit_code;
a61af66fc99e Initial load
duke
parents:
diff changeset
385 static volatile bool _vm_exited;
a61af66fc99e Initial load
duke
parents:
diff changeset
386 static Thread * _shutdown_thread;
a61af66fc99e Initial load
duke
parents:
diff changeset
387 static void wait_if_vm_exited();
a61af66fc99e Initial load
duke
parents:
diff changeset
388 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
389 VM_Exit(int exit_code) {
a61af66fc99e Initial load
duke
parents:
diff changeset
390 _exit_code = exit_code;
a61af66fc99e Initial load
duke
parents:
diff changeset
391 }
a61af66fc99e Initial load
duke
parents:
diff changeset
392 static int wait_for_threads_in_native_to_block();
a61af66fc99e Initial load
duke
parents:
diff changeset
393 static int set_vm_exited();
a61af66fc99e Initial load
duke
parents:
diff changeset
394 static bool vm_exited() { return _vm_exited; }
a61af66fc99e Initial load
duke
parents:
diff changeset
395 static void block_if_vm_exited() {
a61af66fc99e Initial load
duke
parents:
diff changeset
396 if (_vm_exited) {
a61af66fc99e Initial load
duke
parents:
diff changeset
397 wait_if_vm_exited();
a61af66fc99e Initial load
duke
parents:
diff changeset
398 }
a61af66fc99e Initial load
duke
parents:
diff changeset
399 }
a61af66fc99e Initial load
duke
parents:
diff changeset
400 VMOp_Type type() const { return VMOp_Exit; }
a61af66fc99e Initial load
duke
parents:
diff changeset
401 void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
402 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
403
17827
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
404
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
405 class VM_RotateGCLog: public VM_Operation {
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
406 private:
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
407 outputStream* _out;
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
408
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
409 public:
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
410 VM_RotateGCLog(outputStream* st) : _out(st) {}
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
411 VMOp_Type type() const { return VMOp_RotateGCLog; }
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
412 void doit() { gclog_or_tty->rotate_log(true, _out); }
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
413 };
f42c10a3d4b1 7090324: gclog rotation via external tool
minqi
parents: 12324
diff changeset
414
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1905
diff changeset
415 #endif // SHARE_VM_RUNTIME_VM_OPERATIONS_HPP