Thu, 11 Apr 2013 09:39:57 -0700
Added tag jdk8-b85 for changeset 42fe530cd478
kvn@2877 | 1 | /* |
drchase@4618 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
kvn@2877 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
kvn@2877 | 4 | * |
kvn@2877 | 5 | * This code is free software; you can redistribute it and/or modify it |
kvn@2877 | 6 | * under the terms of the GNU General Public License version 2 only, as |
kvn@2877 | 7 | * published by the Free Software Foundation. |
kvn@2877 | 8 | * |
kvn@2877 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
kvn@2877 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
kvn@2877 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
kvn@2877 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
kvn@2877 | 13 | * accompanied this code). |
kvn@2877 | 14 | * |
kvn@2877 | 15 | * You should have received a copy of the GNU General Public License version |
kvn@2877 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
kvn@2877 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
kvn@2877 | 18 | * |
kvn@2877 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
kvn@2877 | 20 | * or visit www.oracle.com if you need additional information or have any |
kvn@2877 | 21 | * questions. |
kvn@2877 | 22 | * |
kvn@2877 | 23 | */ |
kvn@2877 | 24 | |
kvn@2877 | 25 | /** |
kvn@2877 | 26 | * @test |
kvn@2877 | 27 | * @bug 6905845 |
kvn@2877 | 28 | * @summary Server VM improperly optimizing away loop. |
kvn@2877 | 29 | * |
drchase@4618 | 30 | * @run main/timeout=480 Test6905845 |
kvn@2877 | 31 | */ |
kvn@2877 | 32 | |
kvn@2877 | 33 | public class Test6905845 { |
kvn@2877 | 34 | |
kvn@2877 | 35 | public static void main(String[] args){ |
kvn@2877 | 36 | for (int asdf = 0; asdf < 5; asdf++){ |
kvn@2877 | 37 | //test block |
kvn@2877 | 38 | { |
kvn@2877 | 39 | StringBuilder strBuf1 = new StringBuilder(65); |
kvn@2877 | 40 | long start = System.currentTimeMillis(); |
kvn@2877 | 41 | int count = 0; |
kvn@2877 | 42 | |
kvn@2877 | 43 | for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ |
kvn@2877 | 44 | strBuf1.append(i); |
kvn@2877 | 45 | count++; |
kvn@2877 | 46 | strBuf1.delete(0, 65); |
kvn@2877 | 47 | } |
kvn@2877 | 48 | |
kvn@2877 | 49 | System.out.println(count); |
kvn@2877 | 50 | if (count != 54366674) { |
kvn@2877 | 51 | System.out.println("wrong count: " + count +", should be 54366674"); |
kvn@2877 | 52 | System.exit(97); |
kvn@2877 | 53 | } |
kvn@2877 | 54 | } |
kvn@2877 | 55 | //test block |
kvn@2877 | 56 | { |
kvn@2877 | 57 | StringBuilder strBuf1 = new StringBuilder(65); |
kvn@2877 | 58 | long start = System.currentTimeMillis(); |
kvn@2877 | 59 | int count = 0; |
kvn@2877 | 60 | |
kvn@2877 | 61 | for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ |
kvn@2877 | 62 | strBuf1.append(i); |
kvn@2877 | 63 | count++; |
kvn@2877 | 64 | strBuf1.delete(0, 65); |
kvn@2877 | 65 | } |
kvn@2877 | 66 | |
kvn@2877 | 67 | System.out.println(count); |
kvn@2877 | 68 | if (count != 54366674) { |
kvn@2877 | 69 | System.out.println("wrong count: " + count +", should be 54366674"); |
kvn@2877 | 70 | System.exit(97); |
kvn@2877 | 71 | } |
kvn@2877 | 72 | } |
kvn@2877 | 73 | } |
kvn@2877 | 74 | } |
kvn@2877 | 75 | } |
kvn@2877 | 76 |