test/compiler/8009761/Test8009761.java

Print this page
rev 4507 : 8010399: Test8009761.java "Failed: init recursive calls: 5498. After deopt 5494".
Summary: test from 8009761 shouldn't be run with -Xcomp
Reviewed-by: kvn
rev 4508 : 8012037: Test8009761.java "Failed: init recursive calls: 7224. After deopt 58824"
Summary: test shouldn't be run with a modified CompileThreshold
Reviewed-by: kvn


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8009761
  27  * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates
  28  * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8009761
  29  *
  30  */
  31 
  32 public class Test8009761 {
  33 
  34     static class UnloadedClass {
  35         volatile int i;
  36     }
  37 
  38     static Object m1(boolean deopt) {
  39         // When running interpreted, on sparc, the caller's stack is
  40         // extended for the locals and the caller's frame is restored
  41         // on return.
  42         long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12,
  43         l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24,
  44         l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36,
  45         l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48,
  46         l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60,
  47         l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, l72,
  48         l73, l74, l75, l76, l77, l78, l79, l80, l81, l82, l83, l84,


 232         } catch(StackOverflowError soe) {
 233         }
 234         c1 = count;
 235         // Force the compilation of m3() that will inline m1()
 236         for (int i = 0; i < 20000; i++) {
 237             m3(false, false);
 238         }
 239         count = 0;
 240         // Force deoptimization of m3() in m1(), then return from m1()
 241         // to m3(), call recursively m2(). If deoptimization correctly
 242         // built the interpreter stack for m3()/m1() then we should be
 243         // able to call m2() recursively as many times as before.
 244         try {
 245             m3(false, true);
 246         } catch(StackOverflowError soe) {
 247         }
 248         if (c1 != count) {
 249             System.out.println("Failed: init recursive calls: " + c1 + ". After deopt " + count);
 250             System.exit(97);
 251         } else {
 252             System.out.println("PASSED");
 253         }
 254     }
 255 }


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8009761
  27  * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates
  28  * @run main/othervm -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761
  29  *
  30  */
  31 
  32 public class Test8009761 {
  33 
  34     static class UnloadedClass {
  35         volatile int i;
  36     }
  37 
  38     static Object m1(boolean deopt) {
  39         // When running interpreted, on sparc, the caller's stack is
  40         // extended for the locals and the caller's frame is restored
  41         // on return.
  42         long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12,
  43         l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24,
  44         l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36,
  45         l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48,
  46         l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60,
  47         l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, l72,
  48         l73, l74, l75, l76, l77, l78, l79, l80, l81, l82, l83, l84,


 232         } catch(StackOverflowError soe) {
 233         }
 234         c1 = count;
 235         // Force the compilation of m3() that will inline m1()
 236         for (int i = 0; i < 20000; i++) {
 237             m3(false, false);
 238         }
 239         count = 0;
 240         // Force deoptimization of m3() in m1(), then return from m1()
 241         // to m3(), call recursively m2(). If deoptimization correctly
 242         // built the interpreter stack for m3()/m1() then we should be
 243         // able to call m2() recursively as many times as before.
 244         try {
 245             m3(false, true);
 246         } catch(StackOverflowError soe) {
 247         }
 248         if (c1 != count) {
 249             System.out.println("Failed: init recursive calls: " + c1 + ". After deopt " + count);
 250             System.exit(97);
 251         } else {
 252             System.out.println("PASSED " + c1);
 253         }
 254     }
 255 }