hotspot/test/compiler/6891750/Test6891750.java
author ccheung
Fri, 04 Oct 2013 21:00:43 -0700
changeset 20384 49bfb2ec8f8f
parent 5547 f4b087cbb361
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4092
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4092
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4092
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     4
 *
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     8
 *
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    13
 * accompanied this code).
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    14
 *
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4092
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4092
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: 4092
diff changeset
    21
 * questions.
4092
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    22
 *
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    23
 */
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    24
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    25
/**
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    26
 * @test
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    27
 * @bug 6891750
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    28
 * @summary deopt blob kills values in O5
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    29
 *
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    30
 * @run main Test6891750
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    31
 */
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    32
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    33
abstract class Base6891750 extends Thread {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    34
    abstract public long m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    35
}
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    36
class Other6891750 extends Base6891750 {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    37
    public long m() {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    38
        return 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    39
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    40
}
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    41
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    42
public class Test6891750 extends Base6891750 {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    43
    Base6891750 d;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    44
    volatile long  value = 9;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    45
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    46
    static int limit = 400000;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    47
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    48
    Test6891750() {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    49
        d = this;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    50
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    51
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    52
    public long m() {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    53
        return value;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    54
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    55
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    56
    public long test(boolean doit) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    57
        if (doit) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    58
            long total0 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    59
            long total1 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    60
            long total2 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    61
            long total3 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    62
            long total4 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    63
            long total5 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    64
            long total6 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    65
            long total7 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    66
            long total8 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    67
            long total9 = 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    68
            for (int i = 0; i < limit; i++) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    69
                total0 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    70
                total1 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    71
                total2 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    72
                total3 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    73
                total4 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    74
                total5 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    75
                total6 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    76
                total7 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    77
                total8 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    78
                total9 += d.m();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    79
            }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    80
            return total0 + total1 + total2 + total3 + total4 + total5 + total6 + total7 + total8 + total9;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    81
        }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    82
        return 0;
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    83
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    84
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    85
    public void run() {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    86
        long result = test(true);
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    87
        for (int i = 0; i < 300; i++) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    88
            long result2 = test(true);
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    89
            if (result != result2) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    90
                throw new InternalError(result + " != " + result2);
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    91
            }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    92
        }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    93
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    94
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    95
    public static void main(String[] args) throws Exception {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    96
        Test6891750 Test6891750 = new Test6891750();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    97
        // warm it up
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    98
        for (int i = 0; i < 200000; i++) {
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
    99
            Test6891750.test(false);
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   100
        }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   101
        // set in off running
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   102
        Test6891750.start();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   103
        Thread.sleep(2000);
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   104
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   105
        // Load a class to invalidate CHA
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   106
        new Other6891750();
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   107
    }
3765f3db43c1 6891750: deopt blob kills values in O5
never
parents:
diff changeset
   108
}