test/compiler/8009761/Test8009761.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8021775 Cdiff test/compiler/8009761/Test8009761.java

test/compiler/8009761/Test8009761.java

Print this page

        

*** 19,41 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 8009761 * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates ! * @run main/othervm -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 ! * */ - public class Test8009761 { ! static class UnloadedClass { ! volatile int i; ! } static Object m1(boolean deopt) { // When running interpreted, on sparc, the caller's stack is // extended for the locals and the caller's frame is restored // on return. --- 19,45 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ + import sun.hotspot.WhiteBox; + import java.lang.reflect.Method; + /* * @test * @bug 8009761 + * @library /testlibrary /testlibrary/whitebox * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates ! * @build Test8009761 ! * @run main ClassFileInstaller sun.hotspot.WhiteBox ! * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 */ public class Test8009761 { ! private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); ! private static int COMP_LEVEL_FULL_OPTIMIZATION = 4; ! private static Method m3 = null; static Object m1(boolean deopt) { // When running interpreted, on sparc, the caller's stack is // extended for the locals and the caller's frame is restored // on return.
*** 140,152 **** ll488, ll489, ll490, ll491, ll492, ll493, ll494, ll495, ll496, ll497, ll498, ll499, ll500, ll501, ll502, ll503, ll504, ll505, ll506, ll507, ll508, ll509, ll510, ll511; if (deopt) { ! UnloadedClass res = new UnloadedClass(); // sufficient to force deopt with c2 but not c1 ! res.i = 0; // forces deopt with c1 ! return res; } return null; } static int count = 0; --- 144,158 ---- ll488, ll489, ll490, ll491, ll492, ll493, ll494, ll495, ll496, ll497, ll498, ll499, ll500, ll501, ll502, ll503, ll504, ll505, ll506, ll507, ll508, ll509, ll510, ll511; if (deopt) { ! // Force deoptimization of m3 ! WHITE_BOX.deoptimizeMethod(m3); ! if(WHITE_BOX.isMethodCompiled(m3)) { ! throw new RuntimeException(m3 + " not deoptimized"); ! } } return null; } static int count = 0;
*** 223,243 **** } return o; } static public void main(String[] args) { int c1; // Call m2 from m3 recursively until stack overflow. Count the number of recursive calls. try { m3(true, false); } catch(StackOverflowError soe) { } c1 = count; // Force the compilation of m3() that will inline m1() ! for (int i = 0; i < 20000; i++) { ! m3(false, false); } count = 0; // Force deoptimization of m3() in m1(), then return from m1() // to m3(), call recursively m2(). If deoptimization correctly // built the interpreter stack for m3()/m1() then we should be // able to call m2() recursively as many times as before. --- 229,259 ---- } return o; } static public void main(String[] args) { + try { + // Get Method object for m3 + m3 = Test8009761.class.getDeclaredMethod("m3", boolean.class, boolean.class); + } catch (NoSuchMethodException | SecurityException ex) { + throw new RuntimeException("Failed to retrieve method m3"); + } + int c1; // Call m2 from m3 recursively until stack overflow. Count the number of recursive calls. try { m3(true, false); } catch(StackOverflowError soe) { } c1 = count; + // Force the compilation of m3() that will inline m1() ! WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION); ! if(!WHITE_BOX.isMethodCompiled(m3)) { ! throw new RuntimeException(m3 + " not compiled"); } + count = 0; // Force deoptimization of m3() in m1(), then return from m1() // to m3(), call recursively m2(). If deoptimization correctly // built the interpreter stack for m3()/m1() then we should be // able to call m2() recursively as many times as before.
test/compiler/8009761/Test8009761.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File