test/compiler/loopopts/TestBeautifyLoops.java

Mon, 23 Mar 2020 19:52:34 +0800

author
fyang
date
Mon, 23 Mar 2020 19:52:34 +0800
changeset 9910
4373df7c4a92
permissions
-rw-r--r--

8240576: JVM crashes after transformation in C2 IdealLoopTree::merge_many_backedges
Reviewed-by: kvn
Contributed-by: hedongbo@huawei.com

     1 /*
     2  * Copyright (c) 2020, Huawei Technologies Co. Ltd. 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 8240576
    27  * @summary JVM crashes after transformation in C2 IdealLoopTree::merge_many_backedges
    28  *
    29  * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
    30  *      compiler.loopopts.TestBeautifyLoops
    31  */
    33 package compiler.loopopts;
    35 public class TestBeautifyLoops {
    36     private int mI = 0;
    37     private long mJ = 0;
    38     private float mF = 0f;
    40     public void testMethod() {
    41         for (int i0 = 0; i0 < 100; i0++) {
    42             if (mF != 0) {
    43                 // do nothing
    44             } else {
    45                 try {
    46                     mJ = Long.MAX_VALUE;
    47                     for (int i1 = 0; i1 < 101; i1++) {
    48                         for (int i2 = 0; i2 < 102; i2++) {
    49                             mI = new Integer(0x1234);
    50                         }
    51                     }
    52                 } catch (Exception ignored) {}
    53             }
    54         }
    55     }
    57     public static void main(String[] args) {
    58         TestBeautifyLoops obj = new TestBeautifyLoops();
    59         obj.testMethod();
    60     }
    61 }

mercurial