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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "jni.h" 27 #include "jvm.h" 28 #include "classfile/javaClasses.inline.hpp" 29 #include "classfile/systemDictionary.hpp" 30 #include "classfile/vmSymbols.hpp" 31 #include "memory/allocation.inline.hpp" 32 #include "memory/guardedMemory.hpp" 33 #include "oops/instanceKlass.hpp" 34 #include "oops/oop.inline.hpp" 35 #include "oops/symbol.hpp" 36 #include "prims/jniCheck.hpp" 37 #include "prims/jvm_misc.hpp" 38 #include "runtime/fieldDescriptor.hpp" 39 #include "runtime/handles.hpp" 40 #include "runtime/interfaceSupport.hpp" 41 #include "runtime/jfieldIDWorkaround.hpp" 42 #include "runtime/jniHandles.inline.hpp" 43 #include "runtime/thread.inline.hpp" 44 45 // Complain every extra number of unplanned local refs 46 #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32 47 48 // Heap objects are allowed to be directly referenced only in VM code, 49 // not in native code. 50 51 #define ASSERT_OOPS_ALLOWED \ 52 assert(JavaThread::current()->thread_state() == _thread_in_vm, \ 53 "jniCheck examining oops in bad state.") 54 55 56 // Execute the given block of source code with the thread in VM state. 57 // To do this, transition from the NATIVE state to the VM state, execute 58 // the code, and transtition back. The ThreadInVMfromNative constructor 59 // performs the transition to VM state, its destructor restores the 60 // NATIVE state. | 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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "jni.h" 27 #include "jvm.h" 28 #include "classfile/javaClasses.inline.hpp" 29 #include "classfile/systemDictionary.hpp" 30 #include "classfile/vmSymbols.hpp" 31 #include "memory/allocation.inline.hpp" 32 #include "memory/guardedMemory.hpp" 33 #include "oops/instanceKlass.hpp" 34 #include "oops/oop.inline.hpp" 35 #include "oops/symbol.hpp" 36 #include "prims/jniCheck.hpp" 37 #include "prims/jvm_misc.hpp" 38 #include "runtime/fieldDescriptor.hpp" 39 #include "runtime/handles.inline.hpp" 40 #include "runtime/interfaceSupport.inline.hpp" 41 #include "runtime/jfieldIDWorkaround.hpp" 42 #include "runtime/jniHandles.inline.hpp" 43 #include "runtime/thread.inline.hpp" 44 45 // Complain every extra number of unplanned local refs 46 #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32 47 48 // Heap objects are allowed to be directly referenced only in VM code, 49 // not in native code. 50 51 #define ASSERT_OOPS_ALLOWED \ 52 assert(JavaThread::current()->thread_state() == _thread_in_vm, \ 53 "jniCheck examining oops in bad state.") 54 55 56 // Execute the given block of source code with the thread in VM state. 57 // To do this, transition from the NATIVE state to the VM state, execute 58 // the code, and transtition back. The ThreadInVMfromNative constructor 59 // performs the transition to VM state, its destructor restores the 60 // NATIVE state. |