test/compiler/intrinsics/mathexact/SplitThruPhiTest.java

Tue, 12 Nov 2013 13:47:57 +0100

author
rbackman
date
Tue, 12 Nov 2013 13:47:57 +0100
changeset 6101
f675976a61e7
parent 0
f90c822e73f8
child 6152
9949533a8623
permissions
-rw-r--r--

8028198: SIGSEGV in PhaseIdealLoop::build_loop_late_post
Reviewed-by: iveresov, kvn

     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     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  */
    24 /*
    25  * @test
    26  * @bug 8028198
    27  * @summary Verify that split through phi does the right thing
    28  * @compile SplitThruPhiTest.java
    29  * @run main SplitThruPhiTest
    30  *
    31  */
    33 public class SplitThruPhiTest {
    34   public static volatile int value = 19;
    35   public static int store = 0;
    36   public static void main(String[] args) {
    37     for (int i = 0; i < 150000; ++i) {
    38       store = runTest(value);
    39     }
    40   }
    42   public static int runTest(int val) {
    43     int result = Math.addExact(val, 1);
    44     int total = 0;
    45     for (int i = val; i < 200; i = Math.addExact(i, 1)) {
    46       total += i;
    47     }
    48     return total;
    49   }
    50 }

mercurial