< prev index next >

test/compiler/c2/Test6905845.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


  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 /**
  26  * @test
  27  * @bug 6905845
  28  * @summary Server VM improperly optimizing away loop.
  29  *
  30  * @run main/timeout=480 Test6905845
  31  */
  32 


  33 public class Test6905845 {
  34 
  35    public static void main(String[] args){
  36       for (int asdf = 0; asdf < 5; asdf++){
  37          //test block
  38          {
  39             StringBuilder strBuf1 = new StringBuilder(65);
  40             long          start   = System.currentTimeMillis();
  41             int           count   = 0;
  42 
  43             for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){
  44                strBuf1.append(i);
  45                count++;
  46                strBuf1.delete(0, 65);
  47             }
  48 
  49             System.out.println(count);
  50             if (count != 54366674) {
  51               System.out.println("wrong count: " + count +", should be 54366674");
  52               System.exit(97);
  53             }
  54          }
  55          //test block
  56          {
  57             StringBuilder strBuf1 = new StringBuilder(65);
  58             long          start   = System.currentTimeMillis();
  59             int           count   = 0;
  60 
  61             for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){
  62                strBuf1.append(i);
  63                count++;
  64                strBuf1.delete(0, 65);
  65             }
  66 
  67             System.out.println(count);
  68             if (count != 54366674) {
  69               System.out.println("wrong count: " + count +", should be 54366674");
  70               System.exit(97);
  71             }
  72          }
  73       }
  74    }
  75 }
  76 


  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 /**
  26  * @test
  27  * @bug 6905845
  28  * @summary Server VM improperly optimizing away loop.
  29  *
  30  * @run main/timeout=480 compiler.c2.Test6905845
  31  */
  32 
  33 package compiler.c2;
  34 
  35 public class Test6905845 {
  36 
  37     public static void main(String[] args) {
  38         for (int asdf = 0; asdf < 5; asdf++) {
  39             //test block
  40             {
  41                 StringBuilder strBuf1 = new StringBuilder(65);
  42                 long start = System.currentTimeMillis();
  43                 int count = 0;
  44 
  45                 for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) {
  46                     strBuf1.append(i);
  47                     count++;
  48                     strBuf1.delete(0, 65);
  49                 }
  50 
  51                 System.out.println(count);
  52                 if (count != 54366674) {
  53                     System.out.println("wrong count: " + count + ", should be 54366674");
  54                     System.exit(97);
  55                 }
  56             }
  57             //test block
  58             {
  59                 StringBuilder strBuf1 = new StringBuilder(65);
  60                 long start = System.currentTimeMillis();
  61                 int count = 0;
  62 
  63                 for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79) {
  64                     strBuf1.append(i);
  65                     count++;
  66                     strBuf1.delete(0, 65);
  67                 }
  68 
  69                 System.out.println(count);
  70                 if (count != 54366674) {
  71                     System.out.println("wrong count: " + count + ", should be 54366674");
  72                     System.exit(97);
  73                 }
  74             }
  75         }
  76     }
  77 }
  78 
< prev index next >