hotspot/test/compiler/6724218/Test.java
author trims
Thu, 27 May 2010 19:08:38 -0700
changeset 5547 f4b087cbb361
parent 955 723d7b577fba
permissions -rw-r--r--
6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
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
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    28
 * @run main/othervm -Xbatch -XX:CompileCommand=exclude,Test.update Test
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    29
 */
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    30
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    31
public class Test {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    32
    Test   next  = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    33
    Object value = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    34
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    35
    static boolean _closed = false;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    36
    static int size = 0;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    37
    static Test list  = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    38
    static int cache_size = 0;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    39
    static Test cache = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    40
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    41
    Object get(int i) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    42
        Test t = list;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    43
        list = t.next;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    44
        size -= 1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    45
        Object o = t.value;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    46
        if (i > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    47
            t.next = cache;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    48
            t.value = null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    49
            cache = t;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    50
            cache_size = +1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    51
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    52
        return o;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    53
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    54
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    55
    void update() {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    56
        // Exclude compilation of this one.
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    57
        if (size == 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    58
            Test t;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    59
            if (cache_size > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    60
                t = cache;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    61
                cache = t.next;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    62
                cache_size = -1;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    63
            } else {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    64
                t = new Test();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    65
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    66
            t.value = new Object();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    67
            t.next = list;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    68
            list = t;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    69
            size += 1;
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
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    72
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    73
    synchronized Object test(int i) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    74
        while (true) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    75
            if (_closed) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    76
                return null;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    77
            } else if (size > 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    78
                return get(i);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    79
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    80
            update();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    81
        }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    82
    }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    83
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    84
    public static void main(String argv[]) throws Exception {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    85
        Test t = new Test();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    86
        int lim = 500000;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    87
        Object o;
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    88
        for (int j = 0; j < lim; j++) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    89
            o = t.test(j&1);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    90
            if (o == null) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    91
              throw new Exception("*** Failed on iteration " + j);
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    92
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    93
            if ((j&1) == 0) {
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    94
              t.update();
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    95
            }
723d7b577fba 6723160: Nightly failure: Error: meet not symmetric
kvn
parents:
diff changeset
    96
        }
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
}