RFR (S) 8043224: -Xcheck:jni improvements to exception checking and excessive local refs

Coleen Phillimore coleen.phillimore at oracle.com
Tue May 27 22:11:12 UTC 2014

There's a typo in the comment in thread.cpp:

+  // Checked JNI, is the programmer required to check for exceptions, specify which function

noof?  I don't think replacing all the "noof" to number_of adds too much 
extra reading, especially if it's a function name.

+// Complain every extra noof unplanned local refs

This is a good change.  Dumb question: did you run the tests with 
-Xcheck:jni?   So the JDK is clean and doesn't have these problems?   
Did you run something like Java2Demo on Windows with -Xcheck:jni?


On 5/15/14, 9:35 AM, David Simms wrote:
> Thanks for spotting that leftover, updated review ("WARNING: JNI local 
> refs: %zu, exceeds capacity: %zu")
> On 05/15/2014 03:26 PM, harold seigel wrote:
>> Hi David,
>> Did you mean 'noof' or 'number of' here?
>> +      tty->print_cr("WARNING: JNI local refs: %zu, exceeds nof 
>> planned: %zu",
>> Thanks, Harold
>> 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