1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
400 #define TRACE_CALL(result_type, header) \
401 InterfaceSupport::_number_of_calls++; \
402 if (CountRuntimeCalls) { \
403 static RuntimeHistogramElement* e = new RuntimeHistogramElement(#header); \
404 if (e != NULL) e->increment_count(); \
405 }
406 #else
407 #define TRACE_CALL(result_type, header) \
408 /* do nothing */
409 #endif
410
411
412 // LEAF routines do not lock, GC or throw exceptions
413
414 #define VM_LEAF_BASE(result_type, header) \
415 TRACE_CALL(result_type, header) \
416 debug_only(NoHandleMark __hm;) \
417 os::verify_stack_alignment(); \
418 /* begin of body */
419
420
421 // ENTRY routines may lock, GC and throw exceptions
422
423 #define VM_ENTRY_BASE(result_type, header, thread) \
424 TRACE_CALL(result_type, header) \
425 HandleMarkCleaner __hm(thread); \
426 Thread* THREAD = thread; \
427 os::verify_stack_alignment(); \
428 /* begin of body */
429
430
431 // QUICK_ENTRY routines behave like ENTRY but without a handle mark
432
433 #define VM_QUICK_ENTRY_BASE(result_type, header, thread) \
434 TRACE_CALL(result_type, header) \
435 debug_only(NoHandleMark __hm;) \
436 Thread* THREAD = thread; \
437 os::verify_stack_alignment(); \
438 /* begin of body */
439
565 JavaThread* thread = JavaThread::current(); \
566 ThreadInVMfromNative __tiv(thread); \
567 debug_only(VMNativeEntryWrapper __vew;) \
568 VM_ENTRY_BASE(result_type, header, thread)
569
570
571 #define JVM_QUICK_ENTRY(result_type, header) \
572 extern "C" { \
573 result_type JNICALL header { \
574 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
575 ThreadInVMfromNative __tiv(thread); \
576 debug_only(VMNativeEntryWrapper __vew;) \
577 VM_QUICK_ENTRY_BASE(result_type, header, thread)
578
579
580 #define JVM_LEAF(result_type, header) \
581 extern "C" { \
582 result_type JNICALL header { \
583 VM_Exit::block_if_vm_exited(); \
584 VM_LEAF_BASE(result_type, header)
585
586
587 #define JVM_END } }
588
589 #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
400 #define TRACE_CALL(result_type, header) \
401 InterfaceSupport::_number_of_calls++; \
402 if (CountRuntimeCalls) { \
403 static RuntimeHistogramElement* e = new RuntimeHistogramElement(#header); \
404 if (e != NULL) e->increment_count(); \
405 }
406 #else
407 #define TRACE_CALL(result_type, header) \
408 /* do nothing */
409 #endif
410
411
412 // LEAF routines do not lock, GC or throw exceptions
413
414 #define VM_LEAF_BASE(result_type, header) \
415 TRACE_CALL(result_type, header) \
416 debug_only(NoHandleMark __hm;) \
417 os::verify_stack_alignment(); \
418 /* begin of body */
419
420 #define VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread) \
421 TRACE_CALL(result_type, header) \
422 debug_only(ResetNoHandleMark __rnhm;) \
423 HandleMarkCleaner __hm(thread); \
424 Thread* THREAD = thread; \
425 os::verify_stack_alignment(); \
426 /* begin of body */
427
428
429 // ENTRY routines may lock, GC and throw exceptions
430
431 #define VM_ENTRY_BASE(result_type, header, thread) \
432 TRACE_CALL(result_type, header) \
433 HandleMarkCleaner __hm(thread); \
434 Thread* THREAD = thread; \
435 os::verify_stack_alignment(); \
436 /* begin of body */
437
438
439 // QUICK_ENTRY routines behave like ENTRY but without a handle mark
440
441 #define VM_QUICK_ENTRY_BASE(result_type, header, thread) \
442 TRACE_CALL(result_type, header) \
443 debug_only(NoHandleMark __hm;) \
444 Thread* THREAD = thread; \
445 os::verify_stack_alignment(); \
446 /* begin of body */
447
573 JavaThread* thread = JavaThread::current(); \
574 ThreadInVMfromNative __tiv(thread); \
575 debug_only(VMNativeEntryWrapper __vew;) \
576 VM_ENTRY_BASE(result_type, header, thread)
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;) \
585 VM_QUICK_ENTRY_BASE(result_type, header, thread)
586
587
588 #define JVM_LEAF(result_type, header) \
589 extern "C" { \
590 result_type JNICALL header { \
591 VM_Exit::block_if_vm_exited(); \
592 VM_LEAF_BASE(result_type, header)
593
594
595 #define JVM_ENTRY_FROM_LEAF(env, result_type, header) \
596 { { \
597 JavaThread* thread=JavaThread::thread_from_jni_environment(env); \
598 ThreadInVMfromNative __tiv(thread); \
599 debug_only(VMNativeEntryWrapper __vew;) \
600 VM_ENTRY_BASE_FROM_LEAF(result_type, header, thread)
601
602
603 #define JVM_END } }
604
605 #endif // SHARE_VM_RUNTIME_INTERFACESUPPORT_HPP
|