tags:

views:

180

answers:

2
+1  Q: 

Sun VM options

hi, what is Sun VM's equivalent option to IBM VM's -Xcheck:jni:alwayscopy ?

A: 

I am not sure if there is a IBM "check:jni:alwayscopy" option.
The IBM Developer Kit and Runtime Environment, Java 2 Technology Edition, Version 1.4.2, does mention a:

"-Xcheck:jni" option which causes a set of wrappers around the actual JNI functions to be activated.

But it is quite similar to the option check:jni introduced in the JRE1.3 and 1.3 (see also JNI design, and JNI tips)

java -classic -cp . -Xcheck:jni Max

(although the JRE1.6 might also require the "-XX:+RestoreMXCSROnJNICalls" option in certain condition)

VonC
+1  A: 

Do you have a reference to that option in the IBM JVM? I can see a description of -Xcheck:jni on its own, but the only reference on the entire internet to "-Xcheck:jni:alwayscopy" is this post of yours. Are there any documents on it, and failing that, what does it do that you'd like the Sun JVM to replicate?

In any case, as per this list of Sun JVM options, you've been able to pass the -Xcheck:jni flag, in order to perform additional checks on JNI functions, since 1.3.1. This achieves the same thing as the same flag in IBM's VM.

Are you sure that the alwayscopy part of the argument is actually being honoured by the IBM JVM, and not just silently ignored to act as if you typed -Xcheck:jni?

Andrzej Doyle
IBM JDK does supports this option. this instructs certain JNI [Get<PrimitiveType>ArrayElements @ http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/functions.html#wp17314 ]functions to always return a copy of the data. This is what the doc says "Since the returned array may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until Release<PrimitiveType>ArrayElements() is called.". By default, the same primitive array is returned, but using this option, instructs the VM to always return a copy of the array element.