Mercurial > hg > truffle
annotate src/share/vm/runtime/vm_operations.hpp @ 21211:6b11405f0279
Fix typo
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Mon, 04 May 2015 08:49:06 +0200 |
parents | 7848fc12602b |
children |
rev | line source |
---|---|
0 | 1 /* |
10405 | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
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 | 22 * |
23 */ | |
24 | |
1972 | 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 | |
0 | 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) \ | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
53 template(UnlinkSymbols) \ |
0 | 54 template(Verify) \ |
55 template(PrintJNI) \ | |
56 template(HeapDumper) \ | |
57 template(DeoptimizeTheWorld) \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
58 template(CollectForMetadataAllocation) \ |
0 | 59 template(GC_HeapInspection) \ |
60 template(GenCollectFull) \ | |
61 template(GenCollectFullConcurrent) \ | |
62 template(GenCollectForAllocation) \ | |
63 template(ParallelGCFailedAllocation) \ | |
64 template(ParallelGCSystemGC) \ | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
139
diff
changeset
|
65 template(CGC_Operation) \ |
0 | 66 template(CMS_Initial_Mark) \ |
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 | 72 template(EnableBiasedLocking) \ |
73 template(RevokeBias) \ | |
74 template(BulkRevokeBias) \ | |
75 template(PopulateDumpSharedSpace) \ | |
76 template(JNIFunctionTableCopier) \ | |
77 template(RedefineClasses) \ | |
78 template(GetOwnedMonitorInfo) \ | |
79 template(GetObjectMonitorUsage) \ | |
80 template(GetCurrentContendedMonitor) \ | |
81 template(GetStackTrace) \ | |
82 template(GetMultipleStackTraces) \ | |
83 template(GetAllStackTraces) \ | |
84 template(GetThreadListStackTraces) \ | |
85 template(GetFrameCount) \ | |
86 template(GetFrameLocation) \ | |
87 template(ChangeBreakpoints) \ | |
88 template(GetOrSetLocal) \ | |
89 template(GetCurrentLocation) \ | |
90 template(EnterInterpOnlyMode) \ | |
91 template(ChangeSingleStep) \ | |
92 template(HeapWalkOperation) \ | |
93 template(HeapIterateOperation) \ | |
94 template(ReportJavaOutOfMemory) \ | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2426
diff
changeset
|
95 template(JFRCheckpoint) \ |
0 | 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 | 98 template(RotateGCLog) \ |
17867 | 99 template(WhiteBoxOperation) \ |
0 | 100 |
6197 | 101 class VM_Operation: public CHeapObj<mtInternal> { |
0 | 102 public: |
103 enum Mode { | |
104 _safepoint, // blocking, safepoint, vm_op C-heap allocated | |
105 _no_safepoint, // blocking, no safepoint, vm_op C-Heap allocated | |
106 _concurrent, // non-blocking, no safepoint, vm_op C-Heap allocated | |
107 _async_safepoint // non-blocking, safepoint, vm_op C-Heap allocated | |
108 }; | |
109 | |
110 enum VMOp_Type { | |
111 VM_OPS_DO(VM_OP_ENUM) | |
112 VMOp_Terminating | |
113 }; | |
114 | |
115 private: | |
116 Thread* _calling_thread; | |
117 ThreadPriority _priority; | |
118 long _timestamp; | |
119 VM_Operation* _next; | |
120 VM_Operation* _prev; | |
121 | |
122 // The VM operation name array | |
123 static const char* _names[]; | |
124 | |
125 public: | |
126 VM_Operation() { _calling_thread = NULL; _next = NULL; _prev = NULL; } | |
127 virtual ~VM_Operation() {} | |
128 | |
129 // VM operation support (used by VM thread) | |
130 Thread* calling_thread() const { return _calling_thread; } | |
131 ThreadPriority priority() { return _priority; } | |
132 void set_calling_thread(Thread* thread, ThreadPriority priority); | |
133 | |
134 long timestamp() const { return _timestamp; } | |
135 void set_timestamp(long timestamp) { _timestamp = timestamp; } | |
136 | |
137 // Called by VM thread - does in turn invoke doit(). Do not override this | |
138 void evaluate(); | |
139 | |
140 // evaluate() is called by the VMThread and in turn calls doit(). | |
141 // If the thread invoking VMThread::execute((VM_Operation*) is a JavaThread, | |
142 // doit_prologue() is called in that thread before transferring control to | |
143 // the VMThread. | |
144 // If doit_prologue() returns true the VM operation will proceed, and | |
145 // doit_epilogue() will be called by the JavaThread once the VM operation | |
146 // completes. If doit_prologue() returns false the VM operation is cancelled. | |
147 virtual void doit() = 0; | |
148 virtual bool doit_prologue() { return true; }; | |
149 virtual void doit_epilogue() {}; // Note: Not called if mode is: _concurrent | |
150 | |
151 // Type test | |
152 virtual bool is_methodCompiler() const { return false; } | |
153 | |
154 // Linking | |
155 VM_Operation *next() const { return _next; } | |
156 VM_Operation *prev() const { return _prev; } | |
157 void set_next(VM_Operation *next) { _next = next; } | |
158 void set_prev(VM_Operation *prev) { _prev = prev; } | |
159 | |
160 // Configuration. Override these appropriatly in subclasses. | |
161 virtual VMOp_Type type() const = 0; | |
162 virtual Mode evaluation_mode() const { return _safepoint; } | |
163 virtual bool allow_nested_vm_operations() const { return false; } | |
164 virtual bool is_cheap_allocated() const { return false; } | |
165 virtual void oops_do(OopClosure* f) { /* do nothing */ }; | |
166 | |
167 // CAUTION: <don't hang yourself with following rope> | |
168 // If you override these methods, make sure that the evaluation | |
169 // of these methods is race-free and non-blocking, since these | |
170 // methods may be evaluated either by the mutators or by the | |
171 // vm thread, either concurrently with mutators or with the mutators | |
172 // stopped. In other words, taking locks is verboten, and if there | |
173 // are any races in evaluating the conditions, they'd better be benign. | |
174 virtual bool evaluate_at_safepoint() const { | |
175 return evaluation_mode() == _safepoint || | |
176 evaluation_mode() == _async_safepoint; | |
177 } | |
178 virtual bool evaluate_concurrently() const { | |
179 return evaluation_mode() == _concurrent || | |
180 evaluation_mode() == _async_safepoint; | |
181 } | |
182 | |
10405 | 183 static const char* mode_to_string(Mode mode); |
184 | |
0 | 185 // Debugging |
186 void print_on_error(outputStream* st) const; | |
187 const char* name() const { return _names[type()]; } | |
188 static const char* name(int type) { | |
189 assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type"); | |
190 return _names[type]; | |
191 } | |
192 #ifndef PRODUCT | |
193 void print_on(outputStream* st) const { print_on_error(st); } | |
194 #endif | |
195 }; | |
196 | |
197 class VM_ThreadStop: public VM_Operation { | |
198 private: | |
199 oop _thread; // The Thread that the Throwable is thrown against | |
200 oop _throwable; // The Throwable thrown at the target Thread | |
201 public: | |
202 // All oops are passed as JNI handles, since there is no guarantee that a GC might happen before the | |
203 // VM operation is executed. | |
204 VM_ThreadStop(oop thread, oop throwable) { | |
205 _thread = thread; | |
206 _throwable = throwable; | |
207 } | |
208 VMOp_Type type() const { return VMOp_ThreadStop; } | |
209 oop target_thread() const { return _thread; } | |
210 oop throwable() const { return _throwable;} | |
211 void doit(); | |
212 // We deoptimize if top-most frame is compiled - this might require a C2I adapter to be generated | |
213 bool allow_nested_vm_operations() const { return true; } | |
214 Mode evaluation_mode() const { return _async_safepoint; } | |
215 bool is_cheap_allocated() const { return true; } | |
216 | |
217 // GC support | |
218 void oops_do(OopClosure* f) { | |
219 f->do_oop(&_thread); f->do_oop(&_throwable); | |
220 } | |
221 }; | |
222 | |
223 // dummy vm op, evaluated just to force a safepoint | |
224 class VM_ForceSafepoint: public VM_Operation { | |
225 public: | |
226 VM_ForceSafepoint() {} | |
227 void doit() {} | |
228 VMOp_Type type() const { return VMOp_ForceSafepoint; } | |
229 }; | |
230 | |
231 // dummy vm op, evaluated just to force a safepoint | |
232 class VM_ForceAsyncSafepoint: public VM_Operation { | |
233 public: | |
234 VM_ForceAsyncSafepoint() {} | |
235 void doit() {} | |
236 VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; } | |
237 Mode evaluation_mode() const { return _async_safepoint; } | |
238 bool is_cheap_allocated() const { return true; } | |
239 }; | |
240 | |
241 class VM_Deoptimize: public VM_Operation { | |
242 public: | |
243 VM_Deoptimize() {} | |
244 VMOp_Type type() const { return VMOp_Deoptimize; } | |
245 void doit(); | |
246 bool allow_nested_vm_operations() const { return true; } | |
247 }; | |
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 | 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 | 255 private: |
256 JavaThread* _thread; | |
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 | 261 public: |
262 VMOp_Type type() const { return VMOp_DeoptimizeFrame; } | |
263 void doit(); | |
264 bool allow_nested_vm_operations() const { return true; } | |
265 }; | |
266 | |
267 #ifndef PRODUCT | |
268 class VM_DeoptimizeAll: public VM_Operation { | |
269 private: | |
270 KlassHandle _dependee; | |
271 public: | |
272 VM_DeoptimizeAll() {} | |
273 VMOp_Type type() const { return VMOp_DeoptimizeAll; } | |
274 void doit(); | |
275 bool allow_nested_vm_operations() const { return true; } | |
276 }; | |
277 | |
278 | |
279 class VM_ZombieAll: public VM_Operation { | |
280 public: | |
281 VM_ZombieAll() {} | |
282 VMOp_Type type() const { return VMOp_ZombieAll; } | |
283 void doit(); | |
284 bool allow_nested_vm_operations() const { return true; } | |
285 }; | |
286 #endif // PRODUCT | |
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 | 296 class VM_Verify: public VM_Operation { |
297 private: | |
9071
68fe50d4f1d5
8011343: Add new flag for verifying the heap during startup
johnc
parents:
8710
diff
changeset
|
298 bool _silent; |
0 | 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 | 301 VMOp_Type type() const { return VMOp_Verify; } |
302 void doit(); | |
303 }; | |
304 | |
305 | |
306 class VM_PrintThreads: public VM_Operation { | |
307 private: | |
308 outputStream* _out; | |
309 bool _print_concurrent_locks; | |
310 public: | |
311 VM_PrintThreads() { _out = tty; _print_concurrent_locks = PrintConcurrentLocks; } | |
312 VM_PrintThreads(outputStream* out, bool print_concurrent_locks) { _out = out; _print_concurrent_locks = print_concurrent_locks; } | |
313 VMOp_Type type() const { return VMOp_PrintThreads; } | |
314 void doit(); | |
315 bool doit_prologue(); | |
316 void doit_epilogue(); | |
317 }; | |
318 | |
319 class VM_PrintJNI: public VM_Operation { | |
320 private: | |
321 outputStream* _out; | |
322 public: | |
323 VM_PrintJNI() { _out = tty; } | |
324 VM_PrintJNI(outputStream* out) { _out = out; } | |
325 VMOp_Type type() const { return VMOp_PrintJNI; } | |
326 void doit(); | |
327 }; | |
328 | |
329 class DeadlockCycle; | |
330 class VM_FindDeadlocks: public VM_Operation { | |
331 private: | |
332 bool _concurrent_locks; | |
333 DeadlockCycle* _deadlocks; | |
334 outputStream* _out; | |
335 | |
336 public: | |
337 VM_FindDeadlocks(bool concurrent_locks) : _concurrent_locks(concurrent_locks), _out(NULL), _deadlocks(NULL) {}; | |
338 VM_FindDeadlocks(outputStream* st) : _concurrent_locks(true), _out(st), _deadlocks(NULL) {}; | |
339 ~VM_FindDeadlocks(); | |
340 | |
341 DeadlockCycle* result() { return _deadlocks; }; | |
342 VMOp_Type type() const { return VMOp_FindDeadlocks; } | |
343 void doit(); | |
344 bool doit_prologue(); | |
345 }; | |
346 | |
347 class ThreadDumpResult; | |
348 class ThreadSnapshot; | |
349 class ThreadConcurrentLocks; | |
350 | |
351 class VM_ThreadDump : public VM_Operation { | |
352 private: | |
353 ThreadDumpResult* _result; | |
354 int _num_threads; | |
355 GrowableArray<instanceHandle>* _threads; | |
356 int _max_depth; | |
357 bool _with_locked_monitors; | |
358 bool _with_locked_synchronizers; | |
359 | |
360 ThreadSnapshot* snapshot_thread(JavaThread* java_thread, ThreadConcurrentLocks* tcl); | |
361 | |
362 public: | |
363 VM_ThreadDump(ThreadDumpResult* result, | |
364 int max_depth, // -1 indicates entire stack | |
365 bool with_locked_monitors, | |
366 bool with_locked_synchronizers); | |
367 | |
368 VM_ThreadDump(ThreadDumpResult* result, | |
369 GrowableArray<instanceHandle>* threads, | |
370 int num_threads, // -1 indicates entire stack | |
371 int max_depth, | |
372 bool with_locked_monitors, | |
373 bool with_locked_synchronizers); | |
374 | |
375 VMOp_Type type() const { return VMOp_ThreadDump; } | |
376 void doit(); | |
377 bool doit_prologue(); | |
378 void doit_epilogue(); | |
379 }; | |
380 | |
381 | |
382 class VM_Exit: public VM_Operation { | |
383 private: | |
384 int _exit_code; | |
385 static volatile bool _vm_exited; | |
386 static Thread * _shutdown_thread; | |
387 static void wait_if_vm_exited(); | |
388 public: | |
389 VM_Exit(int exit_code) { | |
390 _exit_code = exit_code; | |
391 } | |
392 static int wait_for_threads_in_native_to_block(); | |
393 static int set_vm_exited(); | |
394 static bool vm_exited() { return _vm_exited; } | |
395 static void block_if_vm_exited() { | |
396 if (_vm_exited) { | |
397 wait_if_vm_exited(); | |
398 } | |
399 } | |
400 VMOp_Type type() const { return VMOp_Exit; } | |
401 void doit(); | |
402 }; | |
1972 | 403 |
17827 | 404 |
405 class VM_RotateGCLog: public VM_Operation { | |
406 private: | |
407 outputStream* _out; | |
408 | |
409 public: | |
410 VM_RotateGCLog(outputStream* st) : _out(st) {} | |
411 VMOp_Type type() const { return VMOp_RotateGCLog; } | |
412 void doit() { gclog_or_tty->rotate_log(true, _out); } | |
413 }; | |
414 | |
1972 | 415 #endif // SHARE_VM_RUNTIME_VM_OPERATIONS_HPP |