< prev index next >

hotspot/src/share/vm/prims/jniCheck.cpp

Print this page
rev 7151 : 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
Summary: Warning when not checking exceptions from function that require so, also when local refs expand beyond capacity.
Reviewed-by: dsimms

*** 1,7 **** /* ! * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 51,60 **** --- 51,62 ---- #endif #ifdef TARGET_ARCH_ppc # include "jniTypes_ppc.hpp" #endif + // Complain every extra number of unplanned local refs + #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32 // Heap objects are allowed to be directly referenced only in VM code, // not in native code. #define ASSERT_OOPS_ALLOWED \
*** 166,181 **** /* * SUPPORT FUNCTIONS */ static inline void ! functionEnterCritical(JavaThread* thr) ! { if (thr->has_pending_exception()) { NativeReportJNIWarning(thr, "JNI call made with exception pending"); } } static inline void functionEnterCriticalExceptionAllowed(JavaThread* thr) { --- 168,213 ---- /* * SUPPORT FUNCTIONS */ + /** + * Check whether or not a programmer has actually checked for exceptions. According + * to the JNI Specification ("jni/spec/design.html#java_exceptions"): + * + * There are two cases where the programmer needs to check for exceptions without + * being able to first check an error code: + * + * - The JNI functions that invoke a Java method return the result of the Java method. + * The programmer must call ExceptionOccurred() to check for possible exceptions + * that occurred during the execution of the Java method. + * + * - Some of the JNI array access functions do not return an error code, but may + * throw an ArrayIndexOutOfBoundsException or ArrayStoreException. + * + * In all other cases, a non-error return value guarantees that no exceptions have been thrown. + */ static inline void ! check_pending_exception(JavaThread* thr) { if (thr->has_pending_exception()) { NativeReportJNIWarning(thr, "JNI call made with exception pending"); } + if (thr->is_pending_jni_exception_check()) { + IN_VM( + tty->print_cr("WARNING in native method: JNI call made without checking exceptions when required to from %s", + thr->get_pending_jni_exception_check()); + thr->print_stack(); + ) + thr->clear_pending_jni_exception_check(); // Just complain once + } + } + + + static inline void + functionEnterCritical(JavaThread* thr) + { + check_pending_exception(thr); } static inline void functionEnterCriticalExceptionAllowed(JavaThread* thr) {
*** 185,197 **** functionEnter(JavaThread* thr) { if (thr->in_critical()) { tty->print_cr("%s", warn_other_function_in_critical); } ! if (thr->has_pending_exception()) { ! NativeReportJNIWarning(thr, "JNI call made with exception pending"); ! } } static inline void functionEnterExceptionAllowed(JavaThread* thr) { --- 217,227 ---- functionEnter(JavaThread* thr) { if (thr->in_critical()) { tty->print_cr("%s", warn_other_function_in_critical); } ! check_pending_exception(thr); } static inline void functionEnterExceptionAllowed(JavaThread* thr) {
*** 199,211 **** tty->print_cr("%s", warn_other_function_in_critical); } } static inline void ! functionExit(JNIEnv *env) { ! /* nothing to do at this time */ } static inline void checkStaticFieldID(JavaThread* thr, jfieldID fid, jclass cls, int ftype) { --- 229,252 ---- tty->print_cr("%s", warn_other_function_in_critical); } } static inline void ! functionExit(JavaThread* thr) { ! JNIHandleBlock* handles = thr->active_handles(); ! size_t planned_capacity = handles->get_planned_capacity(); ! size_t live_handles = handles->get_number_of_live_handles(); ! if (live_handles > planned_capacity) { ! IN_VM( ! tty->print_cr("WARNING: JNI local refs: %zu, exceeds capacity: %zu", ! live_handles, planned_capacity); ! thr->print_stack(); ! ) ! // Complain just the once, reset to current + warn threshold ! handles->set_planned_capacity(live_handles + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); ! } } static inline void checkStaticFieldID(JavaThread* thr, jfieldID fid, jclass cls, int ftype) {
*** 506,516 **** functionEnter(thr); IN_VM( jniCheck::validate_object(thr, loader); ) jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_FindClass(JNIEnv *env, --- 547,557 ---- functionEnter(thr); IN_VM( jniCheck::validate_object(thr, loader); ) jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_FindClass(JNIEnv *env,
*** 518,528 **** functionEnter(thr); IN_VM( jniCheck::validate_class_descriptor(thr, name); ) jclass result = UNCHECKED()->FindClass(env, name); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jmethodID, checked_jni_FromReflectedMethod(JNIEnv *env, --- 559,569 ---- functionEnter(thr); IN_VM( jniCheck::validate_class_descriptor(thr, name); ) jclass result = UNCHECKED()->FindClass(env, name); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jmethodID, checked_jni_FromReflectedMethod(JNIEnv *env,
*** 530,540 **** functionEnter(thr); IN_VM( jniCheck::validate_object(thr, method); ) jmethodID result = UNCHECKED()->FromReflectedMethod(env, method); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_FromReflectedField(JNIEnv *env, --- 571,581 ---- functionEnter(thr); IN_VM( jniCheck::validate_object(thr, method); ) jmethodID result = UNCHECKED()->FromReflectedMethod(env, method); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_FromReflectedField(JNIEnv *env,
*** 542,552 **** functionEnter(thr); IN_VM( jniCheck::validate_object(thr, field); ) jfieldID result = UNCHECKED()->FromReflectedField(env, field); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_ToReflectedMethod(JNIEnv *env, --- 583,593 ---- functionEnter(thr); IN_VM( jniCheck::validate_object(thr, field); ) jfieldID result = UNCHECKED()->FromReflectedField(env, field); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_ToReflectedMethod(JNIEnv *env,
*** 558,568 **** jniCheck::validate_class(thr, cls, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID, isStatic); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_GetSuperclass(JNIEnv *env, --- 599,609 ---- jniCheck::validate_class(thr, cls, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID, isStatic); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_GetSuperclass(JNIEnv *env,
*** 570,580 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, sub, true); ) jclass result = UNCHECKED()->GetSuperclass(env, sub); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsAssignableFrom(JNIEnv *env, --- 611,621 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, sub, true); ) jclass result = UNCHECKED()->GetSuperclass(env, sub); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsAssignableFrom(JNIEnv *env,
*** 584,594 **** IN_VM( jniCheck::validate_class(thr, sub, true); jniCheck::validate_class(thr, sup, true); ) jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_ToReflectedField(JNIEnv *env, --- 625,635 ---- IN_VM( jniCheck::validate_class(thr, sub, true); jniCheck::validate_class(thr, sup, true); ) jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_ToReflectedField(JNIEnv *env,
*** 599,609 **** IN_VM( jniCheck::validate_class(thr, cls, false); ) jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID, isStatic); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_Throw(JNIEnv *env, --- 640,650 ---- IN_VM( jniCheck::validate_class(thr, cls, false); ) jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID, isStatic); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_Throw(JNIEnv *env,
*** 617,627 **** } else { jniCheck::validate_throwable_klass(thr, oopObj->klass()); } ) jint result = UNCHECKED()->Throw(env, obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_ThrowNew(JNIEnv *env, --- 658,668 ---- } else { jniCheck::validate_throwable_klass(thr, oopObj->klass()); } ) jint result = UNCHECKED()->Throw(env, obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_ThrowNew(JNIEnv *env,
*** 632,692 **** Klass* k = jniCheck::validate_class(thr, clazz, false); assert(k != NULL, "validate_class shouldn't return NULL Klass*"); jniCheck::validate_throwable_klass(thr, k); ) jint result = UNCHECKED()->ThrowNew(env, clazz, msg); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jthrowable, checked_jni_ExceptionOccurred(JNIEnv *env)) functionEnterExceptionAllowed(thr); jthrowable result = UNCHECKED()->ExceptionOccurred(env); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ExceptionDescribe(JNIEnv *env)) functionEnterExceptionAllowed(thr); UNCHECKED()->ExceptionDescribe(env); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ExceptionClear(JNIEnv *env)) functionEnterExceptionAllowed(thr); UNCHECKED()->ExceptionClear(env); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_FatalError(JNIEnv *env, const char *msg)) functionEnter(thr); UNCHECKED()->FatalError(env, msg); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_PushLocalFrame(JNIEnv *env, jint capacity)) functionEnterExceptionAllowed(thr); if (capacity < 0) NativeReportJNIFatalError(thr, "negative capacity"); jint result = UNCHECKED()->PushLocalFrame(env, capacity); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_PopLocalFrame(JNIEnv *env, jobject result)) functionEnterExceptionAllowed(thr); jobject res = UNCHECKED()->PopLocalFrame(env, result); ! functionExit(env); return res; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewGlobalRef(JNIEnv *env, --- 673,739 ---- Klass* k = jniCheck::validate_class(thr, clazz, false); assert(k != NULL, "validate_class shouldn't return NULL Klass*"); jniCheck::validate_throwable_klass(thr, k); ) jint result = UNCHECKED()->ThrowNew(env, clazz, msg); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jthrowable, checked_jni_ExceptionOccurred(JNIEnv *env)) + thr->clear_pending_jni_exception_check(); functionEnterExceptionAllowed(thr); jthrowable result = UNCHECKED()->ExceptionOccurred(env); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ExceptionDescribe(JNIEnv *env)) functionEnterExceptionAllowed(thr); UNCHECKED()->ExceptionDescribe(env); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ExceptionClear(JNIEnv *env)) + thr->clear_pending_jni_exception_check(); functionEnterExceptionAllowed(thr); UNCHECKED()->ExceptionClear(env); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_FatalError(JNIEnv *env, const char *msg)) + thr->clear_pending_jni_exception_check(); functionEnter(thr); UNCHECKED()->FatalError(env, msg); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_PushLocalFrame(JNIEnv *env, jint capacity)) functionEnterExceptionAllowed(thr); if (capacity < 0) NativeReportJNIFatalError(thr, "negative capacity"); jint result = UNCHECKED()->PushLocalFrame(env, capacity); ! if (result == JNI_OK) { ! thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); ! } ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_PopLocalFrame(JNIEnv *env, jobject result)) functionEnterExceptionAllowed(thr); jobject res = UNCHECKED()->PopLocalFrame(env, result); ! functionExit(thr); return res; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewGlobalRef(JNIEnv *env,
*** 696,706 **** if (lobj != NULL) { jniCheck::validate_handle(thr, lobj); } ) jobject result = UNCHECKED()->NewGlobalRef(env,lobj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteGlobalRef(JNIEnv *env, --- 743,753 ---- if (lobj != NULL) { jniCheck::validate_handle(thr, lobj); } ) jobject result = UNCHECKED()->NewGlobalRef(env,lobj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteGlobalRef(JNIEnv *env,
*** 712,722 **** ReportJNIFatalError(thr, "Invalid global JNI handle passed to DeleteGlobalRef"); } ) UNCHECKED()->DeleteGlobalRef(env,gref); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteLocalRef(JNIEnv *env, jobject obj)) --- 759,769 ---- ReportJNIFatalError(thr, "Invalid global JNI handle passed to DeleteGlobalRef"); } ) UNCHECKED()->DeleteGlobalRef(env,gref); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteLocalRef(JNIEnv *env, jobject obj))
*** 727,737 **** JNIHandles::is_frame_handle(thr, obj))) ReportJNIFatalError(thr, "Invalid local JNI handle passed to DeleteLocalRef"); ) UNCHECKED()->DeleteLocalRef(env, obj); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsSameObject(JNIEnv *env, jobject obj1, --- 774,784 ---- JNIHandles::is_frame_handle(thr, obj))) ReportJNIFatalError(thr, "Invalid local JNI handle passed to DeleteLocalRef"); ) UNCHECKED()->DeleteLocalRef(env, obj); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsSameObject(JNIEnv *env, jobject obj1,
*** 748,758 **** if (obj2 != NULL && jniCheck::validate_handle(thr, obj2) != NULL) { jniCheck::validate_object(thr, obj2); } ) jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewLocalRef(JNIEnv *env, --- 795,805 ---- if (obj2 != NULL && jniCheck::validate_handle(thr, obj2) != NULL) { jniCheck::validate_object(thr, obj2); } ) jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewLocalRef(JNIEnv *env,
*** 762,772 **** if (ref != NULL) { jniCheck::validate_handle(thr, ref); } ) jobject result = UNCHECKED()->NewLocalRef(env, ref); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_EnsureLocalCapacity(JNIEnv *env, --- 809,819 ---- if (ref != NULL) { jniCheck::validate_handle(thr, ref); } ) jobject result = UNCHECKED()->NewLocalRef(env, ref); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_EnsureLocalCapacity(JNIEnv *env,
*** 774,784 **** functionEnter(thr); if (capacity < 0) { NativeReportJNIFatalError(thr, "negative capacity"); } jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_AllocObject(JNIEnv *env, --- 821,834 ---- functionEnter(thr); if (capacity < 0) { NativeReportJNIFatalError(thr, "negative capacity"); } jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity); ! if (result == JNI_OK) { ! thr->active_handles()->set_planned_capacity(capacity + CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD); ! } ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_AllocObject(JNIEnv *env,
*** 786,796 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jobject result = UNCHECKED()->AllocObject(env,clazz); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObject(JNIEnv *env, --- 836,846 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jobject result = UNCHECKED()->AllocObject(env,clazz); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObject(JNIEnv *env,
*** 804,814 **** jniCheck::validate_jmethod_id(thr, methodID); ) va_start(args, methodID); jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args); va_end(args); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObjectV(JNIEnv *env, --- 854,864 ---- jniCheck::validate_jmethod_id(thr, methodID); ) va_start(args, methodID); jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args); va_end(args); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObjectV(JNIEnv *env,
*** 819,829 **** IN_VM( jniCheck::validate_class(thr, clazz, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObjectA(JNIEnv *env, --- 869,879 ---- IN_VM( jniCheck::validate_class(thr, clazz, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewObjectA(JNIEnv *env,
*** 834,844 **** IN_VM( jniCheck::validate_class(thr, clazz, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_GetObjectClass(JNIEnv *env, --- 884,894 ---- IN_VM( jniCheck::validate_class(thr, clazz, false); jniCheck::validate_jmethod_id(thr, methodID); ) jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jclass, checked_jni_GetObjectClass(JNIEnv *env,
*** 846,856 **** functionEnter(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jclass result = UNCHECKED()->GetObjectClass(env,obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsInstanceOf(JNIEnv *env, --- 896,906 ---- functionEnter(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jclass result = UNCHECKED()->GetObjectClass(env,obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_IsInstanceOf(JNIEnv *env,
*** 860,870 **** IN_VM( jniCheck::validate_object(thr, obj); jniCheck::validate_class(thr, clazz, true); ) jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jmethodID, checked_jni_GetMethodID(JNIEnv *env, --- 910,920 ---- IN_VM( jniCheck::validate_object(thr, obj); jniCheck::validate_class(thr, clazz, true); ) jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jmethodID, checked_jni_GetMethodID(JNIEnv *env,
*** 874,884 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig); ! functionExit(env); return result; JNI_END #define WRAPPER_CallMethod(ResultType, Result) \ JNI_ENTRY_CHECKED(ResultType, \ --- 924,934 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig); ! functionExit(thr); return result; JNI_END #define WRAPPER_CallMethod(ResultType, Result) \ JNI_ENTRY_CHECKED(ResultType, \
*** 893,903 **** ) \ va_start(args,methodID); \ ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \ args); \ va_end(args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_Call##Result##MethodV(JNIEnv *env, \ --- 943,954 ---- ) \ va_start(args,methodID); \ ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \ args); \ va_end(args); \ ! thr->set_pending_jni_exception_check("Call"#Result"Method"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_Call##Result##MethodV(JNIEnv *env, \
*** 908,918 **** IN_VM(\ jniCheck::validate_call_object(thr, obj, methodID); \ ) \ ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\ args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_Call##Result##MethodA(JNIEnv *env, \ --- 959,970 ---- IN_VM(\ jniCheck::validate_call_object(thr, obj, methodID); \ ) \ ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\ args); \ ! thr->set_pending_jni_exception_check("Call"#Result"MethodV"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_Call##Result##MethodA(JNIEnv *env, \
*** 923,933 **** IN_VM( \ jniCheck::validate_call_object(thr, obj, methodID); \ ) \ ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\ args); \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_CallMethod(jobject,Object) WRAPPER_CallMethod(jboolean,Boolean) --- 975,986 ---- IN_VM( \ jniCheck::validate_call_object(thr, obj, methodID); \ ) \ ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\ args); \ ! thr->set_pending_jni_exception_check("Call"#Result"MethodA"); \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_CallMethod(jobject,Object) WRAPPER_CallMethod(jboolean,Boolean)
*** 950,960 **** jniCheck::validate_call_object(thr, obj, methodID); ) va_start(args,methodID); UNCHECKED()->CallVoidMethodV(env,obj,methodID,args); va_end(args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallVoidMethodV(JNIEnv *env, jobject obj, --- 1003,1014 ---- jniCheck::validate_call_object(thr, obj, methodID); ) va_start(args,methodID); UNCHECKED()->CallVoidMethodV(env,obj,methodID,args); va_end(args); ! thr->set_pending_jni_exception_check("CallVoidMethod"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallVoidMethodV(JNIEnv *env, jobject obj,
*** 963,973 **** functionEnter(thr); IN_VM( jniCheck::validate_call_object(thr, obj, methodID); ) UNCHECKED()->CallVoidMethodV(env,obj,methodID,args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallVoidMethodA(JNIEnv *env, jobject obj, --- 1017,1028 ---- functionEnter(thr); IN_VM( jniCheck::validate_call_object(thr, obj, methodID); ) UNCHECKED()->CallVoidMethodV(env,obj,methodID,args); ! thr->set_pending_jni_exception_check("CallVoidMethodV"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallVoidMethodA(JNIEnv *env, jobject obj,
*** 976,986 **** functionEnter(thr); IN_VM( jniCheck::validate_call_object(thr, obj, methodID); ) UNCHECKED()->CallVoidMethodA(env,obj,methodID,args); ! functionExit(env); JNI_END #define WRAPPER_CallNonvirtualMethod(ResultType, Result) \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##Method(JNIEnv *env, \ --- 1031,1042 ---- functionEnter(thr); IN_VM( jniCheck::validate_call_object(thr, obj, methodID); ) UNCHECKED()->CallVoidMethodA(env,obj,methodID,args); ! thr->set_pending_jni_exception_check("CallVoidMethodA"); ! functionExit(thr); JNI_END #define WRAPPER_CallNonvirtualMethod(ResultType, Result) \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##Method(JNIEnv *env, \
*** 999,1009 **** obj, \ clazz, \ methodID,\ args); \ va_end(args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##MethodV(JNIEnv *env, \ --- 1055,1066 ---- obj, \ clazz, \ methodID,\ args); \ va_end(args); \ ! thr->set_pending_jni_exception_check("CallNonvirtual"#Result"Method"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##MethodV(JNIEnv *env, \
*** 1019,1029 **** ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \ obj, \ clazz, \ methodID,\ args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##MethodA(JNIEnv *env, \ --- 1076,1087 ---- ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \ obj, \ clazz, \ methodID,\ args); \ ! thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodV"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ResultType, \ checked_jni_CallNonvirtual##Result##MethodA(JNIEnv *env, \
*** 1039,1049 **** ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodA(env, \ obj, \ clazz, \ methodID,\ args); \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_CallNonvirtualMethod(jobject,Object) WRAPPER_CallNonvirtualMethod(jboolean,Boolean) --- 1097,1108 ---- ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodA(env, \ obj, \ clazz, \ methodID,\ args); \ ! thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodA"); \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_CallNonvirtualMethod(jobject,Object) WRAPPER_CallNonvirtualMethod(jboolean,Boolean)
*** 1068,1078 **** jniCheck::validate_call_class(thr, clazz, methodID); ) va_start(args,methodID); UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args); va_end(args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallNonvirtualVoidMethodV(JNIEnv *env, jobject obj, --- 1127,1138 ---- jniCheck::validate_call_class(thr, clazz, methodID); ) va_start(args,methodID); UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args); va_end(args); ! thr->set_pending_jni_exception_check("CallNonvirtualVoidMethod"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallNonvirtualVoidMethodV(JNIEnv *env, jobject obj,
*** 1083,1093 **** IN_VM( jniCheck::validate_call_object(thr, obj, methodID); jniCheck::validate_call_class(thr, clazz, methodID); ) UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallNonvirtualVoidMethodA(JNIEnv *env, jobject obj, --- 1143,1154 ---- IN_VM( jniCheck::validate_call_object(thr, obj, methodID); jniCheck::validate_call_class(thr, clazz, methodID); ) UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args); ! thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodV"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallNonvirtualVoidMethodA(JNIEnv *env, jobject obj,
*** 1098,1108 **** IN_VM( jniCheck::validate_call_object(thr, obj, methodID); jniCheck::validate_call_class(thr, clazz, methodID); ) UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_GetFieldID(JNIEnv *env, jclass clazz, --- 1159,1170 ---- IN_VM( jniCheck::validate_call_object(thr, obj, methodID); jniCheck::validate_call_class(thr, clazz, methodID); ) UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args); ! thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodA"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_GetFieldID(JNIEnv *env, jclass clazz,
*** 1111,1121 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig); ! functionExit(env); return result; JNI_END #define WRAPPER_GetField(ReturnType,Result,FieldType) \ JNI_ENTRY_CHECKED(ReturnType, \ --- 1173,1183 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig); ! functionExit(thr); return result; JNI_END #define WRAPPER_GetField(ReturnType,Result,FieldType) \ JNI_ENTRY_CHECKED(ReturnType, \
*** 1125,1135 **** functionEnter(thr); \ IN_VM( \ checkInstanceFieldID(thr, fieldID, obj, FieldType); \ ) \ ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_GetField(jobject, Object, T_OBJECT) WRAPPER_GetField(jboolean, Boolean, T_BOOLEAN) --- 1187,1197 ---- functionEnter(thr); \ IN_VM( \ checkInstanceFieldID(thr, fieldID, obj, FieldType); \ ) \ ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_GetField(jobject, Object, T_OBJECT) WRAPPER_GetField(jboolean, Boolean, T_BOOLEAN)
*** 1150,1160 **** functionEnter(thr); \ IN_VM( \ checkInstanceFieldID(thr, fieldID, obj, FieldType); \ ) \ UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \ ! functionExit(env); \ JNI_END WRAPPER_SetField(jobject, Object, T_OBJECT) WRAPPER_SetField(jboolean, Boolean, T_BOOLEAN) WRAPPER_SetField(jbyte, Byte, T_BYTE) --- 1212,1222 ---- functionEnter(thr); \ IN_VM( \ checkInstanceFieldID(thr, fieldID, obj, FieldType); \ ) \ UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \ ! functionExit(thr); \ JNI_END WRAPPER_SetField(jobject, Object, T_OBJECT) WRAPPER_SetField(jboolean, Boolean, T_BOOLEAN) WRAPPER_SetField(jbyte, Byte, T_BYTE)
*** 1174,1184 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig); ! functionExit(env); return result; JNI_END #define WRAPPER_CallStaticMethod(ReturnType,Result) \ JNI_ENTRY_CHECKED(ReturnType, \ --- 1236,1246 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig); ! functionExit(thr); return result; JNI_END #define WRAPPER_CallStaticMethod(ReturnType,Result) \ JNI_ENTRY_CHECKED(ReturnType, \
*** 1196,1206 **** ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \ clazz, \ methodID, \ args); \ va_end(args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ReturnType, \ checked_jni_CallStatic##Result##MethodV(JNIEnv *env, \ --- 1258,1269 ---- ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \ clazz, \ methodID, \ args); \ va_end(args); \ ! thr->set_pending_jni_exception_check("CallStatic"#Result"Method"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ReturnType, \ checked_jni_CallStatic##Result##MethodV(JNIEnv *env, \
*** 1214,1224 **** ) \ ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \ clazz, \ methodID, \ args); \ ! functionExit(env); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ReturnType, \ checked_jni_CallStatic##Result##MethodA(JNIEnv *env, \ --- 1277,1288 ---- ) \ ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \ clazz, \ methodID, \ args); \ ! thr->set_pending_jni_exception_check("CallStatic"#Result"MethodV"); \ ! functionExit(thr); \ return result; \ JNI_END \ \ JNI_ENTRY_CHECKED(ReturnType, \ checked_jni_CallStatic##Result##MethodA(JNIEnv *env, \
*** 1232,1242 **** ) \ ReturnType result = UNCHECKED()->CallStatic##Result##MethodA(env, \ clazz, \ methodID, \ args); \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_CallStaticMethod(jobject,Object) WRAPPER_CallStaticMethod(jboolean,Boolean) --- 1296,1307 ---- ) \ ReturnType result = UNCHECKED()->CallStatic##Result##MethodA(env, \ clazz, \ methodID, \ args); \ ! thr->set_pending_jni_exception_check("CallStatic"#Result"MethodA"); \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_CallStaticMethod(jobject,Object) WRAPPER_CallStaticMethod(jboolean,Boolean)
*** 1260,1270 **** jniCheck::validate_class(thr, cls, false); ) va_start(args,methodID); UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args); va_end(args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallStaticVoidMethodV(JNIEnv *env, jclass cls, --- 1325,1336 ---- jniCheck::validate_class(thr, cls, false); ) va_start(args,methodID); UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args); va_end(args); ! thr->set_pending_jni_exception_check("CallStaticVoidMethod"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallStaticVoidMethodV(JNIEnv *env, jclass cls,
*** 1274,1284 **** IN_VM( jniCheck::validate_jmethod_id(thr, methodID); jniCheck::validate_class(thr, cls, false); ) UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallStaticVoidMethodA(JNIEnv *env, jclass cls, --- 1340,1351 ---- IN_VM( jniCheck::validate_jmethod_id(thr, methodID); jniCheck::validate_class(thr, cls, false); ) UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args); ! thr->set_pending_jni_exception_check("CallStaticVoidMethodV"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_CallStaticVoidMethodA(JNIEnv *env, jclass cls,
*** 1288,1298 **** IN_VM( jniCheck::validate_jmethod_id(thr, methodID); jniCheck::validate_class(thr, cls, false); ) UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_GetStaticFieldID(JNIEnv *env, jclass clazz, --- 1355,1366 ---- IN_VM( jniCheck::validate_jmethod_id(thr, methodID); jniCheck::validate_class(thr, cls, false); ) UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args); ! thr->set_pending_jni_exception_check("CallStaticVoidMethodA"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jfieldID, checked_jni_GetStaticFieldID(JNIEnv *env, jclass clazz,
*** 1301,1311 **** functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig); ! functionExit(env); return result; JNI_END #define WRAPPER_GetStaticField(ReturnType,Result,FieldType) \ JNI_ENTRY_CHECKED(ReturnType, \ --- 1369,1379 ---- functionEnter(thr); IN_VM( jniCheck::validate_class(thr, clazz, false); ) jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig); ! functionExit(thr); return result; JNI_END #define WRAPPER_GetStaticField(ReturnType,Result,FieldType) \ JNI_ENTRY_CHECKED(ReturnType, \
*** 1318,1328 **** checkStaticFieldID(thr, fieldID, clazz, FieldType); \ ) \ ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \ clazz, \ fieldID); \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_GetStaticField(jobject, Object, T_OBJECT) WRAPPER_GetStaticField(jboolean, Boolean, T_BOOLEAN) --- 1386,1396 ---- checkStaticFieldID(thr, fieldID, clazz, FieldType); \ ) \ ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \ clazz, \ fieldID); \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_GetStaticField(jobject, Object, T_OBJECT) WRAPPER_GetStaticField(jboolean, Boolean, T_BOOLEAN)
*** 1344,1354 **** IN_VM( \ jniCheck::validate_class(thr, clazz, false); \ checkStaticFieldID(thr, fieldID, clazz, FieldType); \ ) \ UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \ ! functionExit(env); \ JNI_END WRAPPER_SetStaticField(jobject, Object, T_OBJECT) WRAPPER_SetStaticField(jboolean, Boolean, T_BOOLEAN) WRAPPER_SetStaticField(jbyte, Byte, T_BYTE) --- 1412,1422 ---- IN_VM( \ jniCheck::validate_class(thr, clazz, false); \ checkStaticFieldID(thr, fieldID, clazz, FieldType); \ ) \ UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \ ! functionExit(thr); \ JNI_END WRAPPER_SetStaticField(jobject, Object, T_OBJECT) WRAPPER_SetStaticField(jboolean, Boolean, T_BOOLEAN) WRAPPER_SetStaticField(jbyte, Byte, T_BYTE)
*** 1364,1374 **** checked_jni_NewString(JNIEnv *env, const jchar *unicode, jsize len)) functionEnter(thr); jstring result = UNCHECKED()->NewString(env,unicode,len); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetStringLength(JNIEnv *env, --- 1432,1442 ---- checked_jni_NewString(JNIEnv *env, const jchar *unicode, jsize len)) functionEnter(thr); jstring result = UNCHECKED()->NewString(env,unicode,len); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetStringLength(JNIEnv *env,
*** 1376,1386 **** functionEnter(thr); IN_VM( checkString(thr, str); ) jsize result = UNCHECKED()->GetStringLength(env,str); ! functionExit(env); return result; JNI_END // Arbitrary (but well-known) tag const void* STRING_TAG = (void*)0x47114711; --- 1444,1454 ---- functionEnter(thr); IN_VM( checkString(thr, str); ) jsize result = UNCHECKED()->GetStringLength(env,str); ! functionExit(thr); return result; JNI_END // Arbitrary (but well-known) tag const void* STRING_TAG = (void*)0x47114711;
*** 1405,1415 **** } // Avoiding call to UNCHECKED()->ReleaseStringChars() since that will fire unexpected dtrace probes // Note that the dtrace arguments for the allocated memory will not match up with this solution. FreeHeap((char*)result); } ! functionExit(env); return new_result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringChars(JNIEnv *env, --- 1473,1483 ---- } // Avoiding call to UNCHECKED()->ReleaseStringChars() since that will fire unexpected dtrace probes // Note that the dtrace arguments for the allocated memory will not match up with this solution. FreeHeap((char*)result); } ! functionExit(thr); return new_result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringChars(JNIEnv *env,
*** 1440,1458 **** "not allocated by GetStringChars"); } UNCHECKED()->ReleaseStringChars(env, str, (const jchar*) guarded.release_for_freeing()); } ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jstring, checked_jni_NewStringUTF(JNIEnv *env, const char *utf)) functionEnter(thr); jstring result = UNCHECKED()->NewStringUTF(env,utf); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetStringUTFLength(JNIEnv *env, --- 1508,1526 ---- "not allocated by GetStringChars"); } UNCHECKED()->ReleaseStringChars(env, str, (const jchar*) guarded.release_for_freeing()); } ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jstring, checked_jni_NewStringUTF(JNIEnv *env, const char *utf)) functionEnter(thr); jstring result = UNCHECKED()->NewStringUTF(env,utf); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetStringUTFLength(JNIEnv *env,
*** 1460,1470 **** functionEnter(thr); IN_VM( checkString(thr, str); ) jsize result = UNCHECKED()->GetStringUTFLength(env,str); ! functionExit(env); return result; JNI_END // Arbitrary (but well-known) tag - different than GetStringChars const void* STRING_UTF_TAG = (void*) 0x48124812; --- 1528,1538 ---- functionEnter(thr); IN_VM( checkString(thr, str); ) jsize result = UNCHECKED()->GetStringUTFLength(env,str); ! functionExit(thr); return result; JNI_END // Arbitrary (but well-known) tag - different than GetStringChars const void* STRING_UTF_TAG = (void*) 0x48124812;
*** 1488,1498 **** } // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes // Note that the dtrace arguments for the allocated memory will not match up with this solution. FreeHeap((char*)result, mtInternal); } ! functionExit(env); return new_result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringUTFChars(JNIEnv *env, --- 1556,1566 ---- } // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes // Note that the dtrace arguments for the allocated memory will not match up with this solution. FreeHeap((char*)result, mtInternal); } ! functionExit(thr); return new_result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringUTFChars(JNIEnv *env,
*** 1523,1555 **** "called on something not allocated by GetStringUTFChars"); } UNCHECKED()->ReleaseStringUTFChars(env, str, (const char*) guarded.release_for_freeing()); } ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetArrayLength(JNIEnv *env, jarray array)) functionEnter(thr); IN_VM( check_is_array(thr, array); ) jsize result = UNCHECKED()->GetArrayLength(env,array); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobjectArray, checked_jni_NewObjectArray(JNIEnv *env, jsize len, jclass clazz, jobject init)) functionEnter(thr); jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_GetObjectArrayElement(JNIEnv *env, --- 1591,1623 ---- "called on something not allocated by GetStringUTFChars"); } UNCHECKED()->ReleaseStringUTFChars(env, str, (const char*) guarded.release_for_freeing()); } ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jsize, checked_jni_GetArrayLength(JNIEnv *env, jarray array)) functionEnter(thr); IN_VM( check_is_array(thr, array); ) jsize result = UNCHECKED()->GetArrayLength(env,array); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobjectArray, checked_jni_NewObjectArray(JNIEnv *env, jsize len, jclass clazz, jobject init)) functionEnter(thr); jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_GetObjectArrayElement(JNIEnv *env,
*** 1558,1568 **** functionEnter(thr); IN_VM( check_is_obj_array(thr, array); ) jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_SetObjectArrayElement(JNIEnv *env, --- 1626,1637 ---- functionEnter(thr); IN_VM( check_is_obj_array(thr, array); ) jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index); ! thr->set_pending_jni_exception_check("GetObjectArrayElement"); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_SetObjectArrayElement(JNIEnv *env,
*** 1572,1591 **** functionEnter(thr); IN_VM( check_is_obj_array(thr, array); ) UNCHECKED()->SetObjectArrayElement(env,array,index,val); ! functionExit(env); JNI_END #define WRAPPER_NewScalarArray(Return, Result) \ JNI_ENTRY_CHECKED(Return, \ checked_jni_New##Result##Array(JNIEnv *env, \ jsize len)) \ functionEnter(thr); \ Return result = UNCHECKED()->New##Result##Array(env,len); \ ! functionExit(env); \ return (Return) result; \ JNI_END WRAPPER_NewScalarArray(jbooleanArray, Boolean) WRAPPER_NewScalarArray(jbyteArray, Byte) --- 1641,1661 ---- functionEnter(thr); IN_VM( check_is_obj_array(thr, array); ) UNCHECKED()->SetObjectArrayElement(env,array,index,val); ! thr->set_pending_jni_exception_check("SetObjectArrayElement"); ! functionExit(thr); JNI_END #define WRAPPER_NewScalarArray(Return, Result) \ JNI_ENTRY_CHECKED(Return, \ checked_jni_New##Result##Array(JNIEnv *env, \ jsize len)) \ functionEnter(thr); \ Return result = UNCHECKED()->New##Result##Array(env,len); \ ! functionExit(thr); \ return (Return) result; \ JNI_END WRAPPER_NewScalarArray(jbooleanArray, Boolean) WRAPPER_NewScalarArray(jbyteArray, Byte)
*** 1609,1619 **** array, \ isCopy); \ if (result != NULL) { \ result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \ } \ ! functionExit(env); \ return result; \ JNI_END WRAPPER_GetScalarArrayElements(T_BOOLEAN, jboolean, Boolean) WRAPPER_GetScalarArrayElements(T_BYTE, jbyte, Byte) --- 1679,1689 ---- array, \ isCopy); \ if (result != NULL) { \ result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \ } \ ! functionExit(thr); \ return result; \ JNI_END WRAPPER_GetScalarArrayElements(T_BOOLEAN, jboolean, Boolean) WRAPPER_GetScalarArrayElements(T_BYTE, jbyte, Byte)
*** 1637,1647 **** typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \ ) \ ElementType* orig_result = (ElementType *) check_wrapped_array_release( \ thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \ UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \ ! functionExit(env); \ JNI_END WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool) WRAPPER_ReleaseScalarArrayElements(T_BYTE, jbyte, Byte, byte) WRAPPER_ReleaseScalarArrayElements(T_SHORT, jshort, Short, short) --- 1707,1717 ---- typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \ ) \ ElementType* orig_result = (ElementType *) check_wrapped_array_release( \ thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \ UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \ ! functionExit(thr); \ JNI_END WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool) WRAPPER_ReleaseScalarArrayElements(T_BYTE, jbyte, Byte, byte) WRAPPER_ReleaseScalarArrayElements(T_SHORT, jshort, Short, short)
*** 1661,1671 **** functionEnter(thr); \ IN_VM( \ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \ ! functionExit(env); \ JNI_END WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean) WRAPPER_GetScalarArrayRegion(T_BYTE, jbyte, Byte) WRAPPER_GetScalarArrayRegion(T_SHORT, jshort, Short) --- 1731,1742 ---- functionEnter(thr); \ IN_VM( \ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \ ! thr->set_pending_jni_exception_check("Get"#Result"ArrayRegion"); \ ! functionExit(thr); \ JNI_END WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean) WRAPPER_GetScalarArrayRegion(T_BYTE, jbyte, Byte) WRAPPER_GetScalarArrayRegion(T_SHORT, jshort, Short)
*** 1685,1695 **** functionEnter(thr); \ IN_VM( \ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \ ! functionExit(env); \ JNI_END WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean) WRAPPER_SetScalarArrayRegion(T_BYTE, jbyte, Byte) WRAPPER_SetScalarArrayRegion(T_SHORT, jshort, Short) --- 1756,1767 ---- functionEnter(thr); \ IN_VM( \ check_primitive_array_type(thr, array, ElementTag); \ ) \ UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \ ! thr->set_pending_jni_exception_check("Set"#Result"ArrayRegion"); \ ! functionExit(thr); \ JNI_END WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean) WRAPPER_SetScalarArrayRegion(T_BYTE, jbyte, Byte) WRAPPER_SetScalarArrayRegion(T_SHORT, jshort, Short)
*** 1704,1723 **** jclass clazz, const JNINativeMethod *methods, jint nMethods)) functionEnter(thr); jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_UnregisterNatives(JNIEnv *env, jclass clazz)) functionEnter(thr); jint result = UNCHECKED()->UnregisterNatives(env,clazz); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_MonitorEnter(JNIEnv *env, --- 1776,1795 ---- jclass clazz, const JNINativeMethod *methods, jint nMethods)) functionEnter(thr); jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_UnregisterNatives(JNIEnv *env, jclass clazz)) functionEnter(thr); jint result = UNCHECKED()->UnregisterNatives(env,clazz); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_MonitorEnter(JNIEnv *env,
*** 1725,1735 **** functionEnter(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jint result = UNCHECKED()->MonitorEnter(env,obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_MonitorExit(JNIEnv *env, --- 1797,1807 ---- functionEnter(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jint result = UNCHECKED()->MonitorEnter(env,obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_MonitorExit(JNIEnv *env,
*** 1737,1756 **** functionEnterExceptionAllowed(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jint result = UNCHECKED()->MonitorExit(env,obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_GetJavaVM(JNIEnv *env, JavaVM **vm)) functionEnter(thr); jint result = UNCHECKED()->GetJavaVM(env,vm); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_GetStringRegion(JNIEnv *env, --- 1809,1828 ---- functionEnterExceptionAllowed(thr); IN_VM( jniCheck::validate_object(thr, obj); ) jint result = UNCHECKED()->MonitorExit(env,obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_GetJavaVM(JNIEnv *env, JavaVM **vm)) functionEnter(thr); jint result = UNCHECKED()->GetJavaVM(env,vm); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_GetStringRegion(JNIEnv *env,
*** 1761,1771 **** functionEnter(thr); IN_VM( checkString(thr, str); ) UNCHECKED()->GetStringRegion(env, str, start, len, buf); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_GetStringUTFRegion(JNIEnv *env, jstring str, --- 1833,1844 ---- functionEnter(thr); IN_VM( checkString(thr, str); ) UNCHECKED()->GetStringRegion(env, str, start, len, buf); ! thr->set_pending_jni_exception_check("GetStringRegion"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void, checked_jni_GetStringUTFRegion(JNIEnv *env, jstring str,
*** 1775,1785 **** functionEnter(thr); IN_VM( checkString(thr, str); ) UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(void *, checked_jni_GetPrimitiveArrayCritical(JNIEnv *env, jarray array, --- 1848,1859 ---- functionEnter(thr); IN_VM( checkString(thr, str); ) UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf); ! thr->set_pending_jni_exception_check("GetStringUTFRegion"); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(void *, checked_jni_GetPrimitiveArrayCritical(JNIEnv *env, jarray array,
*** 1790,1800 **** ) void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy); if (result != NULL) { result = check_jni_wrap_copy_array(thr, array, result); } ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleasePrimitiveArrayCritical(JNIEnv *env, --- 1864,1874 ---- ) void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy); if (result != NULL) { result = check_jni_wrap_copy_array(thr, array, result); } ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleasePrimitiveArrayCritical(JNIEnv *env,
*** 1806,1816 **** check_is_primitive_array(thr, array); ) // Check the element array... void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode); UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(const jchar*, checked_jni_GetStringCritical(JNIEnv *env, jstring string, --- 1880,1890 ---- check_is_primitive_array(thr, array); ) // Check the element array... void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode); UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(const jchar*, checked_jni_GetStringCritical(JNIEnv *env, jstring string,
*** 1818,1828 **** functionEnterCritical(thr); IN_VM( checkString(thr, string); ) const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringCritical(JNIEnv *env, --- 1892,1902 ---- functionEnterCritical(thr); IN_VM( checkString(thr, string); ) const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_ReleaseStringCritical(JNIEnv *env,
*** 1834,1844 **** ) /* The Hotspot JNI code does not use the parameters, so just check the * string parameter as a minor sanity check */ UNCHECKED()->ReleaseStringCritical(env, str, chars); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jweak, checked_jni_NewWeakGlobalRef(JNIEnv *env, jobject obj)) --- 1908,1918 ---- ) /* The Hotspot JNI code does not use the parameters, so just check the * string parameter as a minor sanity check */ UNCHECKED()->ReleaseStringCritical(env, str, chars); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jweak, checked_jni_NewWeakGlobalRef(JNIEnv *env, jobject obj))
*** 1847,1901 **** if (obj != NULL) { jniCheck::validate_handle(thr, obj); } ) jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteWeakGlobalRef(JNIEnv *env, jweak ref)) functionEnterExceptionAllowed(thr); UNCHECKED()->DeleteWeakGlobalRef(env, ref); ! functionExit(env); JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_ExceptionCheck(JNIEnv *env)) functionEnterExceptionAllowed(thr); jboolean result = UNCHECKED()->ExceptionCheck(env); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewDirectByteBuffer(JNIEnv *env, void *address, jlong capacity)) functionEnter(thr); jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(void *, checked_jni_GetDirectBufferAddress(JNIEnv *env, jobject buf)) functionEnter(thr); void* result = UNCHECKED()->GetDirectBufferAddress(env, buf); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jlong, checked_jni_GetDirectBufferCapacity(JNIEnv *env, jobject buf)) functionEnter(thr); jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jobjectRefType, checked_jni_GetObjectRefType(JNIEnv *env, --- 1921,1976 ---- if (obj != NULL) { jniCheck::validate_handle(thr, obj); } ) jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void, checked_jni_DeleteWeakGlobalRef(JNIEnv *env, jweak ref)) functionEnterExceptionAllowed(thr); UNCHECKED()->DeleteWeakGlobalRef(env, ref); ! functionExit(thr); JNI_END JNI_ENTRY_CHECKED(jboolean, checked_jni_ExceptionCheck(JNIEnv *env)) + thr->clear_pending_jni_exception_check(); functionEnterExceptionAllowed(thr); jboolean result = UNCHECKED()->ExceptionCheck(env); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobject, checked_jni_NewDirectByteBuffer(JNIEnv *env, void *address, jlong capacity)) functionEnter(thr); jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(void *, checked_jni_GetDirectBufferAddress(JNIEnv *env, jobject buf)) functionEnter(thr); void* result = UNCHECKED()->GetDirectBufferAddress(env, buf); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jlong, checked_jni_GetDirectBufferCapacity(JNIEnv *env, jobject buf)) functionEnter(thr); jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jobjectRefType, checked_jni_GetObjectRefType(JNIEnv *env,
*** 1904,1923 **** /* validate the object being passed */ IN_VM( jniCheck::validate_object(thr, obj); ) jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj); ! functionExit(env); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_GetVersion(JNIEnv *env)) functionEnter(thr); jint result = UNCHECKED()->GetVersion(env); ! functionExit(env); return result; JNI_END --- 1979,1998 ---- /* validate the object being passed */ IN_VM( jniCheck::validate_object(thr, obj); ) jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj); ! functionExit(thr); return result; JNI_END JNI_ENTRY_CHECKED(jint, checked_jni_GetVersion(JNIEnv *env)) functionEnter(thr); jint result = UNCHECKED()->GetVersion(env); ! functionExit(thr); return result; JNI_END
< prev index next >