test/hotspot/jtreg/compiler/gcbarriers/EqvUncastStepOverBarrier.java
author roland
Thu, 08 Nov 2018 10:08:52 +0100
changeset 52449 bac05440d98c
permissions -rw-r--r--
8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance" Reviewed-by: thartmann, kvn, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52449
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     1
/*
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     2
 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     4
 *
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     8
 *
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    13
 * accompanied this code).
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    14
 *
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    18
 *
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    21
 * questions.
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    22
 */
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    23
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    24
/*
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    25
 * @test
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    26
 * @bug 8212673
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    27
 * @summary Node::eqv_uncast() shouldn't step over load barriers unconditionally
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    28
 * @library /test/lib /
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    29
 * @modules java.base/jdk.internal.misc
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    30
 *
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    31
 * @build sun.hotspot.WhiteBox
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    32
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    33
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    34
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseOnStackReplacement -XX:-TieredCompilation -XX:-BackgroundCompilation EqvUncastStepOverBarrier
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    35
 */
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    36
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    37
import sun.hotspot.WhiteBox;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    38
import java.lang.reflect.Method;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    39
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    40
public class EqvUncastStepOverBarrier {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    41
    static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    42
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    43
    private static Object field = new A();
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    44
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    45
    public static void main(String[] args) throws Exception {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    46
        for (int i = 0; i < 20_000; i++) {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    47
            test();
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    48
            test();
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    49
            test_helper(null, 0);
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    50
        }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    51
        Method m = EqvUncastStepOverBarrier.class.getDeclaredMethod("test");
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    52
        WHITE_BOX.enqueueMethodForCompilation(m, 4);
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    53
        if (!WHITE_BOX.isMethodCompiled(m, false)) {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    54
            throw new RuntimeException("Method compilation failed");
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    55
        }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    56
    }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    57
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    58
    private static Object test() {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    59
        Object o = field;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    60
        if (o == null) {}
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    61
        for (int i = 1; i < 100; i *= 2) {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    62
            int j = 0;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    63
            for (; j < 4; j++) ;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    64
            o = test_helper(o, j);
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    65
        }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    66
        return o;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    67
    }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    68
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    69
    private static Object test_helper(Object o, int j) {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    70
        if (j == 4) {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    71
            A a = (A) o;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    72
            o = a;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    73
        } else {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    74
            o = new Object();
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    75
        }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    76
        return o;
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    77
    }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    78
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    79
    private static class A {
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    80
    }
bac05440d98c 8212673: jtreg/applications/runthese/RunThese30M.java fails in C2 with "assert(!had_error) failed: bad dominance"
roland
parents:
diff changeset
    81
}