hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java
author fzhinkin
Wed, 24 Dec 2014 19:32:13 +0300
changeset 28389 bbd61e9179a5
child 29678 dd2f3932c21e
permissions -rw-r--r--
8068183: Add isTieredSupported method to c.o.j.t.Platforms Reviewed-by: kvn, iignatyev
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28389
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     1
/*
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     4
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     8
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    13
 * accompanied this code).
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    14
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    18
 *
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    21
 * questions.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    22
 */
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    23
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    24
import com.oracle.java.testlibrary.Asserts;
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    25
import com.oracle.java.testlibrary.Platform;
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    26
import sun.hotspot.WhiteBox;
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    27
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    28
/**
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    29
 * @test
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    30
 * @summary Verifies that Platform::isTieredSupported returns correct value.
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    31
 * @library /testlibrary /../../test/lib
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    32
 * @build TestPlatformIsTieredSupported
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    33
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    34
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    35
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    36
 *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    37
 *                   TestPlatformIsTieredSupported
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    38
 */
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    39
public class TestPlatformIsTieredSupported {
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    40
    public static void main(String args[]) {
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    41
        WhiteBox whiteBox = WhiteBox.getWhiteBox();
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    42
        boolean tieredCompilation = whiteBox.getBooleanVMFlag(
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    43
                "TieredCompilation");
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    44
        Asserts.assertEQ(Platform.isTieredSupported(), tieredCompilation,
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    45
                "Platform::isTieredSupported should report the same value as "
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    46
                        + "TieredCompilation flag's value when "
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    47
                        + "+TieredCompilation was explicitly passed to JVM.");
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    48
    }
bbd61e9179a5 8068183: Add isTieredSupported method to c.o.j.t.Platforms
fzhinkin
parents:
diff changeset
    49
}