test/compiler/8009761/Test8009761.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/test/compiler/8009761/Test8009761.java	Thu May 15 12:49:20 2014
--- new/test/compiler/8009761/Test8009761.java	Thu May 15 12:49:20 2014

*** 19,41 **** --- 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 ! * @run main/othervm -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 * ! * @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 { static class UnloadedClass { ! volatile int i; } + 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 **** --- 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) { UnloadedClass res = new UnloadedClass(); // sufficient to force deopt with c2 but not c1 res.i = 0; // forces deopt with c1 return res; + // 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 **** --- 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() for (int i = 0; i < 20000; i++) { m3(false, false); + 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