Review request (S): 6539281 -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
Staffan Larsen
staffan.larsen at oracle.com
Mon Dec 6 00:32:52 PST 2010
Update webrev: http://cr.openjdk.java.net/~sla/6539281/webrev.01/
Changes in this version:
1) Use "const jint" instead of "#define".
2) GetStringChars/GetStringUTFChars: assert that 'isCopy' == JNI_TRUE
3) ReleaseStringChars/ReleaseStringUTFChars: check 'chars' for NULL
4) GetStringUTFChars : To reduce copying I added a method java_lang_String::as_utf8_string which takes a pre-allocated buffer. Thus, the number of copies for unchecked JNI is reduced to one (previously two) and two for checked JNI (previously three). This could potentially speed up unchecked JNI if GetStringUTFChars is heavily used.
Thanks,
/Staffan
More information about the hotspot-runtime-dev
mailing list