< prev index next >
test/hotspot/jtreg/compiler/runtime/criticalnatives/argumentcorruption/CheckLongArgs.java
Print this page
*** 22,35 ****
*/
/* @test
* @bug 8167409
! * @run main/othervm/native -Xcomp compiler.runtime.criticalnatives.argumentcorruption.CheckLongArgs
*/
package compiler.runtime.criticalnatives.argumentcorruption;
public class CheckLongArgs {
static {
System.loadLibrary("CNCheckLongArgs");
}
static native void m1(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, byte[] result);
static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result);
--- 22,41 ----
*/
/* @test
* @bug 8167409
! * @library /test/lib
! * @build sun.hotspot.WhiteBox
! * @run main ClassFileInstaller sun.hotspot.WhiteBox
! * sun.hotspot.WhiteBox$WhiteBoxPermission
! * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp compiler.runtime.criticalnatives.argumentcorruption.CheckLongArgs
*/
package compiler.runtime.criticalnatives.argumentcorruption;
+ import sun.hotspot.WhiteBox;
public class CheckLongArgs {
+ private static final boolean CRITICAL_JNI_ON = WhiteBox.getWhiteBox().getBooleanVMFlag("CriticalJNINatives");
static {
System.loadLibrary("CNCheckLongArgs");
}
static native void m1(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, byte[] result);
static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result);
*** 48,57 ****
--- 54,64 ----
result[0] = -1;
m2(1111111122222222L, l1, 3333333344444444L, l2, 5555555566666666L, l3, 7777777788888888L, l4, 9999999900000000L, result);
check(result[0]);
}
private static void check(byte result) throws Exception {
+ if (!CRITICAL_JNI_ON) return; // just check that VM doesn't crash
if (result != 2) {
if (result == 1) {
throw new Exception("critical native arguments mismatch");
}
throw new Exception("critical native lookup failed");
< prev index next >