test/hotspot/jtreg/compiler/c2/Test6724218.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 47216 71c04702a3d5
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 955
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     4
 *
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     8
 *
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    13
 * accompanied this code).
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    14
 *
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 955
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 955
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 955
diff changeset
    21
 * questions.
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    22
 */
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    23
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    24
/*
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    25
 * @test
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    26
 * @bug 6724218
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    27
 * @summary Fix raise_LCA_above_marks() early termination
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    28
 *
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main/othervm -Xbatch
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    30
 *      -XX:CompileCommand=exclude,compiler.c2.Test6724218::update
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    31
 *      compiler.c2.Test6724218
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    32
 */
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    33
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    34
package compiler.c2;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    35
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    36
public class Test6724218 {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    37
    Test6724218 next  = null;
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    38
    Object value = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    39
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    40
    static boolean _closed = false;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    41
    static int size = 0;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    42
    static Test6724218 list  = null;
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    43
    static int cache_size = 0;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    44
    static Test6724218 cache = null;
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    45
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    46
    Object get(int i) {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    47
        Test6724218 t = list;
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    48
        list = t.next;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    49
        size -= 1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    50
        Object o = t.value;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    51
        if (i > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    52
            t.next = cache;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    53
            t.value = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    54
            cache = t;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    55
            cache_size = +1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    56
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    57
        return o;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    58
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    59
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    60
    void update() {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    61
        // Exclude compilation of this one.
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    62
        if (size == 0) {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    63
            Test6724218 t;
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    64
            if (cache_size > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    65
                t = cache;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    66
                cache = t.next;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    67
                cache_size = -1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    68
            } else {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    69
                t = new Test6724218();
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    70
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    71
            t.value = new Object();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    72
            t.next = list;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    73
            list = t;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    74
            size += 1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    75
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    76
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    77
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    78
    synchronized Object test(int i) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    79
        while (true) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    80
            if (_closed) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    81
                return null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    82
            } else if (size > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    83
                return get(i);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    84
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    85
            update();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    86
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    87
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    88
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    89
    public static void main(String argv[]) throws Exception {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    90
        Test6724218 t = new Test6724218();
955
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    91
        int lim = 500000;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    92
        Object o;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    93
        for (int j = 0; j < lim; j++) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    94
            o = t.test(j&1);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    95
            if (o == null) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    96
              throw new Exception("*** Failed on iteration " + j);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    97
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    98
            if ((j&1) == 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    99
              t.update();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
   100
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
   101
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
   102
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
   103
}