hotspot/test/runtime/contended/HasNonStatic.java
author mgerdin
Mon, 11 Aug 2014 17:12:41 +0400
changeset 25958 8dc85547d6d6
parent 17831 d8112d90739f
child 29678 dd2f3932c21e
permissions -rw-r--r--
8011397: JTREG needs to copy additional WhiteBox class file to JTwork/scratch/sun/hotspot Reviewed-by: kvn, iignatyev, mgerdin Contributed-by: andrey.x.zakharov@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17831
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     1
/*
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     4
 *
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     8
 *
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    13
 * accompanied this code).
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    14
 *
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    18
 *
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    21
 * questions.
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    22
 */
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    23
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    24
import java.io.BufferedReader;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    25
import java.io.InputStreamReader;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    26
import java.lang.Class;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    27
import java.lang.String;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    28
import java.lang.System;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    29
import java.lang.management.ManagementFactory;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    30
import java.lang.management.RuntimeMXBean;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    31
import java.util.ArrayList;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    32
import java.util.List;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    33
import java.util.concurrent.CyclicBarrier;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    34
import java.util.regex.Matcher;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    35
import java.util.regex.Pattern;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    36
import java.lang.reflect.Field;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    37
import java.lang.reflect.Modifier;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    38
import sun.misc.Unsafe;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    39
import sun.misc.Contended;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    40
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    41
/*
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    42
 * @test
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    43
 * @bug     8015270
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    44
 * @summary \@Contended: fix multiple issues in the layout code
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    45
 *
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    46
 * @run main/othervm -XX:-RestrictContended HasNonStatic
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    47
 */
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    48
public class HasNonStatic {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    49
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    50
    public static void main(String[] args) throws Exception {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    51
        R1 r1 = new R1();
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    52
        R2 r2 = new R2();
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    53
        R3 r3 = new R3();
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    54
        R4 r4 = new R4();
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    55
    }
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    56
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    57
    public static class R1 {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    58
        @Contended
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    59
        Object o;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    60
    }
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    61
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    62
    @Contended
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    63
    public static class R2 {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    64
        Object o;
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    65
    }
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    66
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    67
    @Contended
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    68
    public static class R3 {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    69
    }
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    70
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    71
    public static class R4 extends R3 {
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    72
    }
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    73
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    74
}
d8112d90739f 8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff changeset
    75