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