Mercurial > hg > truffle
annotate src/share/vm/runtime/interfaceSupport.hpp @ 4724:0841c0ec2ed6
7123810: new hotspot build - hs23-b10
Reviewed-by: jcoomes
author | amurillo |
---|---|
date | Fri, 23 Dec 2011 15:29:34 -0800 |
parents | a6eef545f1a2 |
children | da4be62fb889 |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2177
diff
changeset
|
2 * Copyright (c) 1997, 2011, 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:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP |
26 #define SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP | |
27 | |
28 #include "memory/gcLocker.hpp" | |
29 #include "runtime/handles.inline.hpp" | |
30 #include "runtime/mutexLocker.hpp" | |
31 #include "runtime/orderAccess.hpp" | |
32 #include "runtime/os.hpp" | |
33 #include "runtime/safepoint.hpp" | |
34 #include "runtime/vmThread.hpp" | |
35 #include "utilities/globalDefinitions.hpp" | |
36 #include "utilities/preserveException.hpp" | |
37 #include "utilities/top.hpp" | |
38 #ifdef TARGET_OS_FAMILY_linux | |
39 # include "thread_linux.inline.hpp" | |
40 #endif | |
41 #ifdef TARGET_OS_FAMILY_solaris | |
42 # include "thread_solaris.inline.hpp" | |
43 #endif | |
44 #ifdef TARGET_OS_FAMILY_windows | |
45 # include "thread_windows.inline.hpp" | |
46 #endif | |
3960 | 47 #ifdef TARGET_OS_FAMILY_bsd |
48 # include "thread_bsd.inline.hpp" | |
49 #endif | |
1972 | 50 |
0 | 51 // Wrapper for all entry points to the virtual machine. |
52 // The HandleMarkCleaner is a faster version of HandleMark. | |
53 // It relies on the fact that there is a HandleMark further | |
54 // down the stack (in JavaCalls::call_helper), and just resets | |
55 // to the saved values in that HandleMark. | |
56 | |
57 class HandleMarkCleaner: public StackObj { | |
58 private: | |
59 Thread* _thread; | |
60 public: | |
61 HandleMarkCleaner(Thread* thread) { | |
62 _thread = thread; | |
63 _thread->last_handle_mark()->push(); | |
64 } | |
65 ~HandleMarkCleaner() { | |
66 _thread->last_handle_mark()->pop_and_restore(); | |
67 } | |
68 | |
69 private: | |
70 inline void* operator new(size_t size, void* ptr) { | |
71 return ptr; | |
72 } | |
73 }; | |
74 | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
75 // InterfaceSupport provides functionality used by the VM_LEAF_BASE and |
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
76 // VM_ENTRY_BASE macros. These macros are used to guard entry points into |
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
77 // the VM and perform checks upon leave of the VM. |
0 | 78 |
79 | |
80 class InterfaceSupport: AllStatic { | |
81 # ifdef ASSERT | |
82 public: | |
83 static long _scavenge_alot_counter; | |
84 static long _fullgc_alot_counter; | |
85 static long _number_of_calls; | |
86 static long _fullgc_alot_invocation; | |
87 | |
88 // tracing | |
89 static void trace(const char* result_type, const char* header); | |
90 | |
91 // Helper methods used to implement +ScavengeALot and +FullGCALot | |
92 static void check_gc_alot() { if (ScavengeALot || FullGCALot) gc_alot(); } | |
93 static void gc_alot(); | |
94 | |
95 static void walk_stack_from(vframe* start_vf); | |
96 static void walk_stack(); | |
97 | |
98 # ifdef ENABLE_ZAP_DEAD_LOCALS | |
99 static void zap_dead_locals_old(); | |
100 # endif | |
101 | |
102 static void zombieAll(); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
103 static void unlinkSymbols(); |
0 | 104 static void deoptimizeAll(); |
105 static void stress_derived_pointers(); | |
106 static void verify_stack(); | |
107 static void verify_last_frame(); | |
108 # endif | |
109 | |
110 public: | |
111 // OS dependent stuff | |
1972 | 112 #ifdef TARGET_OS_FAMILY_linux |
113 # include "interfaceSupport_linux.hpp" | |
114 #endif | |
115 #ifdef TARGET_OS_FAMILY_solaris | |
116 # include "interfaceSupport_solaris.hpp" | |
117 #endif | |
118 #ifdef TARGET_OS_FAMILY_windows | |
119 # include "interfaceSupport_windows.hpp" | |
120 #endif | |
3960 | 121 #ifdef TARGET_OS_FAMILY_bsd |
122 # include "interfaceSupport_bsd.hpp" | |
123 #endif | |
1972 | 124 |
0 | 125 }; |
126 | |
127 | |
128 // Basic class for all thread transition classes. | |
129 | |
130 class ThreadStateTransition : public StackObj { | |
131 protected: | |
132 JavaThread* _thread; | |
133 public: | |
134 ThreadStateTransition(JavaThread *thread) { | |
135 _thread = thread; | |
136 assert(thread != NULL && thread->is_Java_thread(), "must be Java thread"); | |
137 } | |
138 | |
139 // Change threadstate in a manner, so safepoint can detect changes. | |
140 // Time-critical: called on exit from every runtime routine | |
141 static inline void transition(JavaThread *thread, JavaThreadState from, JavaThreadState to) { | |
142 assert(from != _thread_in_Java, "use transition_from_java"); | |
143 assert(from != _thread_in_native, "use transition_from_native"); | |
144 assert((from & 1) == 0 && (to & 1) == 0, "odd numbers are transitions states"); | |
145 assert(thread->thread_state() == from, "coming from wrong thread state"); | |
146 // Change to transition state (assumes total store ordering! -Urs) | |
147 thread->set_thread_state((JavaThreadState)(from + 1)); | |
148 | |
149 // Make sure new state is seen by VM thread | |
150 if (os::is_MP()) { | |
151 if (UseMembar) { | |
152 // Force a fence between the write above and read below | |
153 OrderAccess::fence(); | |
154 } else { | |
155 // store to serialize page so VM thread can do pseudo remote membar | |
156 os::write_memory_serialize_page(thread); | |
157 } | |
158 } | |
159 | |
160 if (SafepointSynchronize::do_call_back()) { | |
161 SafepointSynchronize::block(thread); | |
162 } | |
163 thread->set_thread_state(to); | |
164 | |
165 CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();) | |
166 } | |
167 | |
168 // transition_and_fence must be used on any thread state transition | |
169 // where there might not be a Java call stub on the stack, in | |
170 // particular on Windows where the Structured Exception Handler is | |
171 // set up in the call stub. os::write_memory_serialize_page() can | |
172 // fault and we can't recover from it on Windows without a SEH in | |
173 // place. | |
174 static inline void transition_and_fence(JavaThread *thread, JavaThreadState from, JavaThreadState to) { | |
175 assert(thread->thread_state() == from, "coming from wrong thread state"); | |
176 assert((from & 1) == 0 && (to & 1) == 0, "odd numbers are transitions states"); | |
177 // Change to transition state (assumes total store ordering! -Urs) | |
178 thread->set_thread_state((JavaThreadState)(from + 1)); | |
179 | |
180 // Make sure new state is seen by VM thread | |
181 if (os::is_MP()) { | |
182 if (UseMembar) { | |
183 // Force a fence between the write above and read below | |
184 OrderAccess::fence(); | |
185 } else { | |
186 // Must use this rather than serialization page in particular on Windows | |
187 InterfaceSupport::serialize_memory(thread); | |
188 } | |
189 } | |
190 | |
191 if (SafepointSynchronize::do_call_back()) { | |
192 SafepointSynchronize::block(thread); | |
193 } | |
194 thread->set_thread_state(to); | |
195 | |
196 CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();) | |
197 } | |
198 | |
199 // Same as above, but assumes from = _thread_in_Java. This is simpler, since we | |
200 // never block on entry to the VM. This will break the code, since e.g. preserve arguments | |
201 // have not been setup. | |
202 static inline void transition_from_java(JavaThread *thread, JavaThreadState to) { | |
203 assert(thread->thread_state() == _thread_in_Java, "coming from wrong thread state"); | |
204 thread->set_thread_state(to); | |
205 } | |
206 | |
207 static inline void transition_from_native(JavaThread *thread, JavaThreadState to) { | |
208 assert((to & 1) == 0, "odd numbers are transitions states"); | |
209 assert(thread->thread_state() == _thread_in_native, "coming from wrong thread state"); | |
210 // Change to transition state (assumes total store ordering! -Urs) | |
211 thread->set_thread_state(_thread_in_native_trans); | |
212 | |
213 // Make sure new state is seen by GC thread | |
214 if (os::is_MP()) { | |
215 if (UseMembar) { | |
216 // Force a fence between the write above and read below | |
217 OrderAccess::fence(); | |
218 } else { | |
219 // Must use this rather than serialization page in particular on Windows | |
220 InterfaceSupport::serialize_memory(thread); | |
221 } | |
222 } | |
223 | |
224 // We never install asynchronous exceptions when coming (back) in | |
225 // to the runtime from native code because the runtime is not set | |
226 // up to handle exceptions floating around at arbitrary points. | |
227 if (SafepointSynchronize::do_call_back() || thread->is_suspend_after_native()) { | |
228 JavaThread::check_safepoint_and_suspend_for_native_trans(thread); | |
229 | |
230 // Clear unhandled oops anywhere where we could block, even if we don't. | |
231 CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();) | |
232 } | |
233 | |
234 thread->set_thread_state(to); | |
235 } | |
236 protected: | |
237 void trans(JavaThreadState from, JavaThreadState to) { transition(_thread, from, to); } | |
238 void trans_from_java(JavaThreadState to) { transition_from_java(_thread, to); } | |
239 void trans_from_native(JavaThreadState to) { transition_from_native(_thread, to); } | |
240 void trans_and_fence(JavaThreadState from, JavaThreadState to) { transition_and_fence(_thread, from, to); } | |
241 }; | |
242 | |
243 | |
244 class ThreadInVMfromJava : public ThreadStateTransition { | |
245 public: | |
246 ThreadInVMfromJava(JavaThread* thread) : ThreadStateTransition(thread) { | |
247 trans_from_java(_thread_in_vm); | |
248 } | |
249 ~ThreadInVMfromJava() { | |
250 trans(_thread_in_vm, _thread_in_Java); | |
251 // Check for pending. async. exceptions or suspends. | |
252 if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition(); | |
253 } | |
254 }; | |
255 | |
256 | |
257 class ThreadInVMfromUnknown { | |
258 private: | |
259 JavaThread* _thread; | |
260 public: | |
261 ThreadInVMfromUnknown() : _thread(NULL) { | |
262 Thread* t = Thread::current(); | |
263 if (t->is_Java_thread()) { | |
264 JavaThread* t2 = (JavaThread*) t; | |
265 if (t2->thread_state() == _thread_in_native) { | |
266 _thread = t2; | |
267 ThreadStateTransition::transition_from_native(t2, _thread_in_vm); | |
268 // Used to have a HandleMarkCleaner but that is dangerous as | |
269 // it could free a handle in our (indirect, nested) caller. | |
270 // We expect any handles will be short lived and figure we | |
271 // don't need an actual HandleMark. | |
272 } | |
273 } | |
274 } | |
275 ~ThreadInVMfromUnknown() { | |
276 if (_thread) { | |
277 ThreadStateTransition::transition_and_fence(_thread, _thread_in_vm, _thread_in_native); | |
278 } | |
279 } | |
280 }; | |
281 | |
282 | |
283 class ThreadInVMfromNative : public ThreadStateTransition { | |
284 public: | |
285 ThreadInVMfromNative(JavaThread* thread) : ThreadStateTransition(thread) { | |
286 trans_from_native(_thread_in_vm); | |
287 } | |
288 ~ThreadInVMfromNative() { | |
289 trans_and_fence(_thread_in_vm, _thread_in_native); | |
290 } | |
291 }; | |
292 | |
293 | |
294 class ThreadToNativeFromVM : public ThreadStateTransition { | |
295 public: | |
296 ThreadToNativeFromVM(JavaThread *thread) : ThreadStateTransition(thread) { | |
297 // We are leaving the VM at this point and going directly to native code. | |
298 // Block, if we are in the middle of a safepoint synchronization. | |
299 assert(!thread->owns_locks(), "must release all locks when leaving VM"); | |
300 thread->frame_anchor()->make_walkable(thread); | |
301 trans_and_fence(_thread_in_vm, _thread_in_native); | |
302 // Check for pending. async. exceptions or suspends. | |
303 if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition(false); | |
304 } | |
305 | |
306 ~ThreadToNativeFromVM() { | |
307 trans_from_native(_thread_in_vm); | |
308 // We don't need to clear_walkable because it will happen automagically when we return to java | |
309 } | |
310 }; | |
311 | |
312 | |
313 class ThreadBlockInVM : public ThreadStateTransition { | |
314 public: | |
315 ThreadBlockInVM(JavaThread *thread) | |
316 : ThreadStateTransition(thread) { | |
317 // Once we are blocked vm expects stack to be walkable | |
318 thread->frame_anchor()->make_walkable(thread); | |
319 trans_and_fence(_thread_in_vm, _thread_blocked); | |
320 } | |
321 ~ThreadBlockInVM() { | |
322 trans_and_fence(_thread_blocked, _thread_in_vm); | |
323 // We don't need to clear_walkable because it will happen automagically when we return to java | |
324 } | |
325 }; | |
326 | |
327 | |
328 // This special transition class is only used to prevent asynchronous exceptions | |
329 // from being installed on vm exit in situations where we can't tolerate them. | |
330 // See bugs: 4324348, 4854693, 4998314, 5040492, 5050705. | |
331 class ThreadInVMfromJavaNoAsyncException : public ThreadStateTransition { | |
332 public: | |
333 ThreadInVMfromJavaNoAsyncException(JavaThread* thread) : ThreadStateTransition(thread) { | |
334 trans_from_java(_thread_in_vm); | |
335 } | |
336 ~ThreadInVMfromJavaNoAsyncException() { | |
337 trans(_thread_in_vm, _thread_in_Java); | |
338 // NOTE: We do not check for pending. async. exceptions. | |
339 // If we did and moved the pending async exception over into the | |
340 // pending exception field, we would need to deopt (currently C2 | |
341 // only). However, to do so would require that we transition back | |
342 // to the _thread_in_vm state. Instead we postpone the handling of | |
343 // the async exception. | |
344 | |
345 // Check for pending. suspends only. | |
346 if (_thread->has_special_runtime_exit_condition()) | |
347 _thread->handle_special_runtime_exit_condition(false); | |
348 } | |
349 }; | |
350 | |
351 // Debug class instantiated in JRT_ENTRY and ITR_ENTRY macro. | |
352 // Can be used to verify properties on enter/exit of the VM. | |
353 | |
354 #ifdef ASSERT | |
355 class VMEntryWrapper { | |
356 public: | |
357 VMEntryWrapper() { | |
358 if (VerifyLastFrame) { | |
359 InterfaceSupport::verify_last_frame(); | |
360 } | |
361 } | |
362 | |
363 ~VMEntryWrapper() { | |
364 InterfaceSupport::check_gc_alot(); | |
365 if (WalkStackALot) { | |
366 InterfaceSupport::walk_stack(); | |
367 } | |
368 #ifdef ENABLE_ZAP_DEAD_LOCALS | |
369 if (ZapDeadLocalsOld) { | |
370 InterfaceSupport::zap_dead_locals_old(); | |
371 } | |
372 #endif | |
373 #ifdef COMPILER2 | |
374 // This option is not used by Compiler 1 | |
375 if (StressDerivedPointers) { | |
376 InterfaceSupport::stress_derived_pointers(); | |
377 } | |
378 #endif | |
379 if (DeoptimizeALot || DeoptimizeRandom) { | |
380 InterfaceSupport::deoptimizeAll(); | |
381 } | |
382 if (ZombieALot) { | |
383 InterfaceSupport::zombieAll(); | |
384 } | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
385 if (UnlinkSymbolsALot) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
386 InterfaceSupport::unlinkSymbols(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
387 } |
0 | 388 // do verification AFTER potential deoptimization |
389 if (VerifyStack) { | |
390 InterfaceSupport::verify_stack(); | |
391 } | |
392 | |
393 } | |
394 }; | |
395 | |
396 | |
397 class VMNativeEntryWrapper { | |
398 public: | |
399 VMNativeEntryWrapper() { | |
400 if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); | |
401 } | |
402 | |
403 ~VMNativeEntryWrapper() { | |
404 if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); | |
405 } | |
406 }; | |
407 | |
408 #endif | |
409 | |
410 | |
411 // VM-internal runtime interface support | |
412 | |
413 #ifdef ASSERT | |
414 | |
415 class RuntimeHistogramElement : public HistogramElement { | |
416 public: | |
417 RuntimeHistogramElement(const char* name); | |
418 }; | |
419 | |
420 #define TRACE_CALL(result_type, header) \ | |
421 InterfaceSupport::_number_of_calls++; \ | |
422 if (TraceRuntimeCalls) \ | |
423 InterfaceSupport::trace(#result_type, #header); \ | |
424 if (CountRuntimeCalls) { \ | |
425 static RuntimeHistogramElement* e = new RuntimeHistogramElement(#header); \ | |
426 if (e != NULL) e->increment_count(); \ | |
427 } | |
428 #else | |
429 #define TRACE_CALL(result_type, header) \ | |
430 /* do nothing */ | |
431 #endif | |
432 | |
433 | |
434 // LEAF routines do not lock, GC or throw exceptions | |
435 | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
436 #define VM_LEAF_BASE(result_type, header) \ |
0 | 437 TRACE_CALL(result_type, header) \ |
438 debug_only(NoHandleMark __hm;) \ | |
439 /* begin of body */ | |
440 | |
441 | |
442 // ENTRY routines may lock, GC and throw exceptions | |
443 | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
444 #define VM_ENTRY_BASE(result_type, header, thread) \ |
0 | 445 TRACE_CALL(result_type, header) \ |
446 HandleMarkCleaner __hm(thread); \ | |
447 Thread* THREAD = thread; \ | |
448 /* begin of body */ | |
449 | |
450 | |
451 // QUICK_ENTRY routines behave like ENTRY but without a handle mark | |
452 | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
453 #define VM_QUICK_ENTRY_BASE(result_type, header, thread) \ |
0 | 454 TRACE_CALL(result_type, header) \ |
455 debug_only(NoHandleMark __hm;) \ | |
456 Thread* THREAD = thread; \ | |
457 /* begin of body */ | |
458 | |
459 | |
460 // Definitions for IRT (Interpreter Runtime) | |
461 // (thread is an argument passed in to all these routines) | |
462 | |
463 #define IRT_ENTRY(result_type, header) \ | |
464 result_type header { \ | |
465 ThreadInVMfromJava __tiv(thread); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
466 VM_ENTRY_BASE(result_type, header, thread) \ |
0 | 467 debug_only(VMEntryWrapper __vew;) |
468 | |
469 | |
470 #define IRT_LEAF(result_type, header) \ | |
471 result_type header { \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
472 VM_LEAF_BASE(result_type, header) \ |
0 | 473 debug_only(No_Safepoint_Verifier __nspv(true);) |
474 | |
475 | |
476 #define IRT_ENTRY_NO_ASYNC(result_type, header) \ | |
477 result_type header { \ | |
478 ThreadInVMfromJavaNoAsyncException __tiv(thread); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
479 VM_ENTRY_BASE(result_type, header, thread) \ |
0 | 480 debug_only(VMEntryWrapper __vew;) |
481 | |
482 // Another special case for nmethod_entry_point so the nmethod that the | |
483 // interpreter is about to branch to doesn't get flushed before as we | |
484 // branch to it's interpreter_entry_point. Skip stress testing here too. | |
485 // Also we don't allow async exceptions because it is just too painful. | |
486 #define IRT_ENTRY_FOR_NMETHOD(result_type, header) \ | |
487 result_type header { \ | |
488 nmethodLocker _nmlock(nm); \ | |
489 ThreadInVMfromJavaNoAsyncException __tiv(thread); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
490 VM_ENTRY_BASE(result_type, header, thread) |
0 | 491 |
492 #define IRT_END } | |
493 | |
494 | |
495 // Definitions for JRT (Java (Compiler/Shared) Runtime) | |
496 | |
497 #define JRT_ENTRY(result_type, header) \ | |
498 result_type header { \ | |
499 ThreadInVMfromJava __tiv(thread); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
500 VM_ENTRY_BASE(result_type, header, thread) \ |
0 | 501 debug_only(VMEntryWrapper __vew;) |
502 | |
503 | |
504 #define JRT_LEAF(result_type, header) \ | |
505 result_type header { \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
506 VM_LEAF_BASE(result_type, header) \ |
0 | 507 debug_only(JRT_Leaf_Verifier __jlv;) |
508 | |
509 | |
510 #define JRT_ENTRY_NO_ASYNC(result_type, header) \ | |
511 result_type header { \ | |
512 ThreadInVMfromJavaNoAsyncException __tiv(thread); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
513 VM_ENTRY_BASE(result_type, header, thread) \ |
0 | 514 debug_only(VMEntryWrapper __vew;) |
515 | |
516 // Same as JRT Entry but allows for return value after the safepoint | |
517 // to get back into Java from the VM | |
518 #define JRT_BLOCK_ENTRY(result_type, header) \ | |
519 result_type header { \ | |
520 TRACE_CALL(result_type, header) \ | |
521 HandleMarkCleaner __hm(thread); | |
522 | |
523 #define JRT_BLOCK \ | |
524 { \ | |
525 ThreadInVMfromJava __tiv(thread); \ | |
526 Thread* THREAD = thread; \ | |
527 debug_only(VMEntryWrapper __vew;) | |
528 | |
529 #define JRT_BLOCK_END } | |
530 | |
531 #define JRT_END } | |
532 | |
533 // Definitions for JNI | |
534 | |
535 #define JNI_ENTRY(result_type, header) \ | |
536 JNI_ENTRY_NO_PRESERVE(result_type, header) \ | |
537 WeakPreserveExceptionMark __wem(thread); | |
538 | |
539 #define JNI_ENTRY_NO_PRESERVE(result_type, header) \ | |
540 extern "C" { \ | |
541 result_type JNICALL header { \ | |
542 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ | |
543 assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \ | |
544 ThreadInVMfromNative __tiv(thread); \ | |
545 debug_only(VMNativeEntryWrapper __vew;) \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
546 VM_ENTRY_BASE(result_type, header, thread) |
0 | 547 |
548 | |
549 // Ensure that the VMNativeEntryWrapper constructor, which can cause | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
550 // a GC, is called outside the NoHandleMark (set via VM_QUICK_ENTRY_BASE). |
0 | 551 #define JNI_QUICK_ENTRY(result_type, header) \ |
552 extern "C" { \ | |
553 result_type JNICALL header { \ | |
554 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ | |
555 assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \ | |
556 ThreadInVMfromNative __tiv(thread); \ | |
557 debug_only(VMNativeEntryWrapper __vew;) \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
558 VM_QUICK_ENTRY_BASE(result_type, header, thread) |
0 | 559 |
560 | |
561 #define JNI_LEAF(result_type, header) \ | |
562 extern "C" { \ | |
563 result_type JNICALL header { \ | |
564 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ | |
565 assert( !VerifyJNIEnvThread || (thread == Thread::current()), "JNIEnv is only valid in same thread"); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
566 VM_LEAF_BASE(result_type, header) |
0 | 567 |
568 | |
569 // Close the routine and the extern "C" | |
570 #define JNI_END } } | |
571 | |
572 | |
573 | |
574 // Definitions for JVM | |
575 | |
576 #define JVM_ENTRY(result_type, header) \ | |
577 extern "C" { \ | |
578 result_type JNICALL header { \ | |
579 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ | |
580 ThreadInVMfromNative __tiv(thread); \ | |
581 debug_only(VMNativeEntryWrapper __vew;) \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
582 VM_ENTRY_BASE(result_type, header, thread) |
0 | 583 |
584 | |
585 #define JVM_ENTRY_NO_ENV(result_type, header) \ | |
586 extern "C" { \ | |
587 result_type JNICALL header { \ | |
588 JavaThread* thread = (JavaThread*)ThreadLocalStorage::thread(); \ | |
589 ThreadInVMfromNative __tiv(thread); \ | |
590 debug_only(VMNativeEntryWrapper __vew;) \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
591 VM_ENTRY_BASE(result_type, header, thread) |
0 | 592 |
593 | |
594 #define JVM_QUICK_ENTRY(result_type, header) \ | |
595 extern "C" { \ | |
596 result_type JNICALL header { \ | |
597 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ | |
598 ThreadInVMfromNative __tiv(thread); \ | |
599 debug_only(VMNativeEntryWrapper __vew;) \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
600 VM_QUICK_ENTRY_BASE(result_type, header, thread) |
0 | 601 |
602 | |
603 #define JVM_LEAF(result_type, header) \ | |
604 extern "C" { \ | |
605 result_type JNICALL header { \ | |
606 VM_Exit::block_if_vm_exited(); \ | |
4045
a6eef545f1a2
7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents:
3960
diff
changeset
|
607 VM_LEAF_BASE(result_type, header) |
0 | 608 |
609 | |
610 #define JVM_END } } | |
1972 | 611 |
612 #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP |