RFR (S) 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
David Simms
david.simms at oracle.com
Tue Jun 3 19:56:28 UTC 2014
Thanks Harold, and Zhengyu !
Will update.
Cheers
/David Simms
On 3/06/2014 9:51 p.m., harold seigel wrote:
> Hi David,
>
> The changes look good. The copyright is old in jniHandles.hpp.
>
> Also, would it be better to say "Method", instead of "MethodV", in
> calls to set_pending_jni_exception_check() for methods without MethodV
> in their names, like these:
>
> 865 JNI_ENTRY_CHECKED(ResultType, \
> 866 *checked_jni_Call##Result##Method*(JNIEnv *env, \
> 867 jobject obj, \
> 868 jmethodID methodID, \
> 869 ...)) \
> 870 functionEnter(thr); \
> 871 va_list args; \
> 872 IN_VM( \
> 873 jniCheck::validate_call_object(thr, obj, methodID); \
> 874 ) \
> 875 va_start(args,methodID); \
> 876 ResultType result =UNCHECKED()->Call##Result##MethodV(env,
> obj, methodID, \
> 877 args); \
> 878 va_end(args); \
> 879
> thr->set_pending_jni_exception_check("*Call"#Result"MethodV*"); \
> 880 functionExit(thr); \
> 881 return result; \
> 882 JNI_END \
>
>
> 1048 JNI_ENTRY_CHECKED(void,
> 1049 *checked_jni_CallNonvirtualVoidMethod*(JNIEnv *env,
> 1050 jobject obj,
> 1051 jclass clazz,
> 1052 jmethodID methodID,
> 1053 ...))
> 1054 functionEnter(thr);
> 1055 va_list args;
> 1056 IN_VM(
> 1057 jniCheck::validate_call_object(thr, obj, methodID);
> 1058 jniCheck::validate_call_class(thr, clazz, methodID);
> 1059 )
> 1060 va_start(args,methodID);
> 1061
> UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
> 1062 va_end(args);
> 1063
> thr->set_pending_jni_exception_check("*CallNonvirtualVoidMethodV*");
> 1064 functionExit(thr);
> 1065 JNI_END
>
> This would differentiate the messages from the messages in their
> sister methods that have MethodV in their names.
>
> Thanks, Harold
>
>
> On 5/28/2014 12:06 PM, Zhengyu Gu wrote:
>> Looks good.
>>
>> -Zhengyu
>>
>> On 5/15/2014 7:55 AM, David Simms wrote:
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8043224
>>>
>>> Web review: http://cr.openjdk.java.net/~dsimms/8043224/
>>>
>>> Check JNI:
>>>
>>> 1) Functions that require exception checks now set a flag. JNI
>>> exception checks clear said flag. Functions which do not allow
>>> exceptions now check the flag and warn if the programmer has failed
>>> to check for exceptions. Said flag is actually the name of the
>>> function requiring an exception check.
>>>
>>> 2) JNI function exit now check and warn if the number of local
>>> reference exceed the "planned number of references", i.e exceed
>>> initial frame capacity, "pushlocalframe" capacity or
>>> "ensurelocalcapacity".
>>>
>>> Testing:
>>>
>>> * jtreg, quick vm tests
>>> * Hand rolled test run locally (no support of JNI in test libs...will
>>> hold until there is support).
>>>
>>>
>>> Cheers
>>> /David Simms
>>
>
More information about the hotspot-runtime-dev
mailing list