< prev index next >

test/hotspot/jtreg/compiler/runtime/criticalnatives/lookup/LookUp.java

Print this page

        

*** 22,35 **** */ /* @test * @bug 8167408 ! * @run main/othervm/native -Xcomp compiler.runtime.criticalnatives.lookup.LookUp */ package compiler.runtime.criticalnatives.lookup; public class LookUp { static { System.loadLibrary("CNLookUp"); } static native void m1(byte a1, long a2, char a3, int a4, float a5, double a6, byte[] result); static native void m2(int a1, int[] a2, long a3, long[] a4, float a5,float[] a6, double a7, double[] a8, byte result[]); --- 22,41 ---- */ /* @test * @bug 8167408 ! * @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.lookup.LookUp */ package compiler.runtime.criticalnatives.lookup; + import sun.hotspot.WhiteBox; public class LookUp { + private static final boolean CRITICAL_JNI_ON = WhiteBox.getWhiteBox().getBooleanVMFlag("CriticalJNINatives"); static { System.loadLibrary("CNLookUp"); } static native void m1(byte a1, long a2, char a3, int a4, float a5, double a6, byte[] result); static native void m2(int a1, int[] a2, long a3, long[] a4, float a5,float[] a6, double a7, double[] a8, byte result[]);
*** 47,56 **** --- 53,63 ---- result[0] = -1; m2(12345678, l1, 4444444455555555L, l2, 343434.0F, l3, 6666666677777777.0D, l4, 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 >