test/compiler/6823453/Test.java

changeset 1139
ad8c635e757e
child 1431
d6b9fd78f389
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/compiler/6823453/Test.java	Fri Apr 03 13:33:32 2009 -0700
     1.3 @@ -0,0 +1,96 @@
     1.4 +/*
     1.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +/*
    1.29 + * @test
    1.30 + * @bug 6823453
    1.31 + * @summary DeoptimizeALot causes fastdebug server jvm to fail with assert(false,"unscheduable graph")
    1.32 + * @run main/othervm -Xcomp -XX:CompileOnly=Test -XX:+DeoptimizeALot Test
    1.33 + */
    1.34 +
    1.35 +public class Test {
    1.36 +
    1.37 +   static long vara_1 = 1L;
    1.38 +
    1.39 +   static void testa() {
    1.40 +      short var_2 = (byte) 1.0E10;
    1.41 +
    1.42 +      for ( Object temp = new byte[(byte)1.0E10];  true ;
    1.43 +            var_2 = "1".equals("0") ? ((byte) vara_1) : 1 ) {}
    1.44 +   }
    1.45 +
    1.46 +   static void testb() {
    1.47 +      long var_1 = -1L;
    1.48 +
    1.49 +      short var_2 = (byte) 1.0E10;
    1.50 +
    1.51 +      for ( Object temp = new byte[(byte)1.0E10];  true ;
    1.52 +            var_2 = "1".equals("0") ? ((byte) var_1) : 1 ) {}
    1.53 +   }
    1.54 +
    1.55 +   static void testc() {
    1.56 +      long var_1 = -1L;
    1.57 +      if (vara_1 > 0)  var_1 = 1L;
    1.58 +
    1.59 +      int var_2 = (byte)var_1 - 128;
    1.60 +
    1.61 +      for ( Object temp = new byte[var_2];  true ;
    1.62 +            var_2 = "1".equals("0") ? 2 : 1 ) {}
    1.63 +   }
    1.64 +
    1.65 +   static void testd() {
    1.66 +      long var_1 = 0L;
    1.67 +
    1.68 +      int var_2 = (byte)var_1 + 1;
    1.69 +      for (int i=0; i<2 ; i++)  var_2 = var_2 - 1;
    1.70 +
    1.71 +      for ( Object temp = new byte[var_2];  true ;
    1.72 +            var_2 = "1".equals("0") ? 2 : 1 ) {}
    1.73 +   }
    1.74 +
    1.75 +   public static void main(String[] args) throws Exception {
    1.76 +      int nex = 0;
    1.77 +
    1.78 +      try {
    1.79 +         testa();
    1.80 +      }
    1.81 +      catch (java.lang.NegativeArraySizeException ex) { nex++; }
    1.82 +      try {
    1.83 +         testb();
    1.84 +      }
    1.85 +      catch (java.lang.NegativeArraySizeException ex) { nex++; }
    1.86 +      try {
    1.87 +         testc();
    1.88 +      }
    1.89 +      catch (java.lang.NegativeArraySizeException ex) { nex++; }
    1.90 +      try {
    1.91 +         testd();
    1.92 +      }
    1.93 +      catch (java.lang.NegativeArraySizeException ex) { nex++; }
    1.94 +
    1.95 +      if (nex != 4)
    1.96 +        System.exit(97);
    1.97 +   }
    1.98 +}
    1.99 +

mercurial