test/hotspot/jtreg/compiler/loopopts/StoreMovedBeforeInfiniteLoop.java
author jiangli
Fri, 02 Nov 2018 19:30:31 -0400
changeset 52397 1322829d1501
parent 48964 86143b5899dc
permissions -rw-r--r--
8209564: runtime/appcds/CDSandJFR.java timeout on tier6 on sparc Summary: Set timeout 500 in CDSandJFR.java Reviewed-by: dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48964
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     1
/*
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     2
 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     4
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     8
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    13
 * accompanied this code).
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    14
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    18
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    21
 * questions.
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    22
 */
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    23
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    24
/**
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    25
 * @test
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    26
 * @bug 8197563
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    27
 * @summary assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    28
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    29
 * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=StoreMovedBeforeInfiniteLoop::test  StoreMovedBeforeInfiniteLoop
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    30
 *
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    31
 */
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    32
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    33
public class StoreMovedBeforeInfiniteLoop {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    34
    public static void main(String[] args) {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    35
        field = -1;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    36
        test(new Object());
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    37
    }
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    38
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    39
    static int field;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    40
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    41
    static int constant() {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    42
        return 65;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    43
    }
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    44
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    45
    private static int test(Object o) {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    46
        do {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    47
            if (field <= 0) {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    48
                return -109;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    49
            }
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    50
            do {
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    51
                field = 4;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    52
            } while (constant() >= 0);
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    53
        } while (o == null);
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    54
        return -109;
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    55
    }
86143b5899dc 8197563: assert(is_Loop()) crash in PhaseIdealLoop::try_move_store_before_loop()
roland
parents:
diff changeset
    56
}