70
71 static struct JNINativeInterface_ * unchecked_jni_NativeInterface;
72
73
74 /*
75 * MACRO DEFINITIONS
76 */
77
78 // All JNI checked functions here use JNI_ENTRY_CHECKED() instead of the
79 // QUICK_ENTRY or LEAF variants found in jni.cpp. This allows handles
80 // to be created if a fatal error should occur.
81
82 // Check for thread not attached to VM; need to catch this before
83 // assertions in the wrapper routines might fire
84
85 // Check for env being the one value appropriate for this thread.
86
87 #define JNI_ENTRY_CHECKED(result_type, header) \
88 extern "C" { \
89 result_type JNICALL header { \
90 JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
91 if (thr == NULL || !thr->is_Java_thread()) { \
92 tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \
93 os::abort(true); \
94 } \
95 JNIEnv* xenv = thr->jni_environment(); \
96 if (env != xenv) { \
97 NativeReportJNIFatalError(thr, warn_wrong_jnienv); \
98 } \
99 VM_ENTRY_BASE(result_type, header, thr)
100
101
102 #define UNCHECKED() (unchecked_jni_NativeInterface)
103
104 static const char * warn_wrong_jnienv = "Using JNIEnv in the wrong thread";
105 static const char * warn_bad_class_descriptor1 = "JNI FindClass received a bad class descriptor \"";
106 static const char * warn_bad_class_descriptor2 = "\". A correct class descriptor " \
107 "has no leading \"L\" or trailing \";\". Incorrect descriptors will not be accepted in future releases.";
108 static const char * fatal_using_jnienv_in_nonjava = "FATAL ERROR in native method: Using JNIEnv in non-Java thread";
109 static const char * warn_other_function_in_critical = "Warning: Calling other JNI functions in the scope of " \
110 "Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical";
|
70
71 static struct JNINativeInterface_ * unchecked_jni_NativeInterface;
72
73
74 /*
75 * MACRO DEFINITIONS
76 */
77
78 // All JNI checked functions here use JNI_ENTRY_CHECKED() instead of the
79 // QUICK_ENTRY or LEAF variants found in jni.cpp. This allows handles
80 // to be created if a fatal error should occur.
81
82 // Check for thread not attached to VM; need to catch this before
83 // assertions in the wrapper routines might fire
84
85 // Check for env being the one value appropriate for this thread.
86
87 #define JNI_ENTRY_CHECKED(result_type, header) \
88 extern "C" { \
89 result_type JNICALL header { \
90 JavaThread* thr = (JavaThread*) Thread::current_or_null(); \
91 if (thr == NULL || !thr->is_Java_thread()) { \
92 tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \
93 os::abort(true); \
94 } \
95 JNIEnv* xenv = thr->jni_environment(); \
96 if (env != xenv) { \
97 NativeReportJNIFatalError(thr, warn_wrong_jnienv); \
98 } \
99 VM_ENTRY_BASE(result_type, header, thr)
100
101
102 #define UNCHECKED() (unchecked_jni_NativeInterface)
103
104 static const char * warn_wrong_jnienv = "Using JNIEnv in the wrong thread";
105 static const char * warn_bad_class_descriptor1 = "JNI FindClass received a bad class descriptor \"";
106 static const char * warn_bad_class_descriptor2 = "\". A correct class descriptor " \
107 "has no leading \"L\" or trailing \";\". Incorrect descriptors will not be accepted in future releases.";
108 static const char * fatal_using_jnienv_in_nonjava = "FATAL ERROR in native method: Using JNIEnv in non-Java thread";
109 static const char * warn_other_function_in_critical = "Warning: Calling other JNI functions in the scope of " \
110 "Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical";
|