hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
author chegar
Tue, 22 Mar 2016 15:26:07 +0000
changeset 36694 182a5e7a519e
parent 35753 ee7921f045d2
child 36551 77f29c57ed2e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     1
/*
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     4
 *
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     8
 *
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    13
 * accompanied this code).
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    14
 *
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    18
 *
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    21
 * questions.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    22
 */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    23
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    24
/*
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    25
 * @test
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    26
 * @bug 8138651
35753
ee7921f045d2 8148012: get rid of slash-dot-dot in @library directives
iignatyev
parents: 33480
diff changeset
    27
 * @library /testlibrary /test/lib
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    28
 * @build IntrinsicDisabledTest
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    29
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    30
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    31
 * @run main/othervm -Xbootclasspath/a:.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    32
 *                   -XX:+UnlockDiagnosticVMOptions
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    33
 *                   -XX:+WhiteBoxAPI
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    34
 *                   -XX:DisableIntrinsic=_putCharVolatile,_putInt
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    35
 *                   -XX:DisableIntrinsic=_putIntVolatile
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    36
 *                   -XX:CompileCommand=option,sun.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    37
 *                   -XX:CompileCommand=option,sun.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    38
 *                   IntrinsicDisabledTest
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    39
 */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    40
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    41
import java.lang.reflect.Executable;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    42
import java.util.Objects;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    43
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    44
import sun.hotspot.WhiteBox;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    45
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    46
import jdk.test.lib.Platform;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    47
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    48
public class IntrinsicDisabledTest {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    49
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    50
    private static final WhiteBox wb = WhiteBox.getWhiteBox();
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    51
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    52
    /* Compilation level corresponding to C1. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    53
    private static final int COMP_LEVEL_SIMPLE = 1;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    54
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    55
    /* Compilation level corresponding to C2. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    56
    private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    57
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    58
    /* Determine if tiered compilation is enabled. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    59
    private static boolean isTieredCompilationEnabled() {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    60
        return Boolean.valueOf(Objects.toString(wb.getVMFlag("TieredCompilation")));
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    61
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    62
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    63
    /* This test uses several methods from sun.misc.Unsafe. The method
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    64
     * getMethod() returns a different Executable for each different
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    65
     * combination of its input parameters. There are eight possible
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    66
     * combinations, getMethod can return an Executable representing
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    67
     * the following methods: putChar, putCharVolatile, getChar,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    68
     * getCharVolatile, putInt, putIntVolatile, getInt,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    69
     * getIntVolatile. These methods were selected because they can
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    70
     * be intrinsified by both the C1 and the C2 compiler.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    71
     */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    72
    static Executable getMethod(boolean isChar, boolean isPut, boolean isVolatile) throws RuntimeException {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    73
        Executable aMethod;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    74
        String methodTypeName = isChar ? "Char" : "Int";
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    75
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    76
        try {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    77
            Class aClass = Class.forName("sun.misc.Unsafe");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    78
            if (isPut) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    79
                aMethod = aClass.getDeclaredMethod("put" + methodTypeName + (isVolatile ? "Volatile" : ""),
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    80
                                                   Object.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    81
                                                   long.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    82
                                                   isChar ? char.class : int.class);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    83
            } else {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    84
                aMethod = aClass.getDeclaredMethod("get" + methodTypeName + (isVolatile ? "Volatile" : ""),
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    85
                                                   Object.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    86
                                                   long.class);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    87
            }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    88
        } catch (NoSuchMethodException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    89
            throw new RuntimeException("Test bug, method is unavailable. " + e);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    90
        } catch (ClassNotFoundException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    91
            throw new RuntimeException("Test bug, class is unavailable. " + e);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    92
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    93
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    94
        return aMethod;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    95
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    96
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    97
    public static void test(int compLevel) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    98
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    99
        Executable putChar = getMethod(true, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   100
        Executable getChar = getMethod(true, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   101
        Executable putCharVolatile = getMethod(true, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   102
        Executable getCharVolatile = getMethod(true, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   103
        Executable putInt = getMethod(false, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   104
        Executable getInt = getMethod(false, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   105
        Executable putIntVolatile = getMethod(false, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   106
        Executable getIntVolatile = getMethod(false, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   107
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   108
        /* Test if globally disabling intrinsics works. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   109
        if (!wb.isIntrinsicAvailable(putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   110
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   111
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   112
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   113
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   114
        if (wb.isIntrinsicAvailable(putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   115
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   116
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   117
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   118
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   119
        if (wb.isIntrinsicAvailable(putInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   120
            throw new RuntimeException("Intrinsic for [" + putInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   121
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   122
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   123
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   124
        if (wb.isIntrinsicAvailable(putIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   125
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   126
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   127
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   128
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   129
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   130
         * works. The method for which intrinsics are
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   131
         * disabled (the compilation context) is putChar. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   132
        if (!wb.isIntrinsicAvailable(getChar, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   133
            throw new RuntimeException("Intrinsic for [" + getChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   134
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   135
                                       putChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   136
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   137
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   138
        if (wb.isIntrinsicAvailable(getCharVolatile, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   139
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   140
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   141
                                       putChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   142
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   143
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   144
        if (wb.isIntrinsicAvailable(getInt, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   145
            throw new RuntimeException("Intrinsic for [" + getInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   146
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   147
                                       putChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   148
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   149
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   150
        if (wb.isIntrinsicAvailable(getIntVolatile, putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   151
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   152
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   153
                                       putCharVolatile.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   154
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   155
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   156
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   157
         * leaves those intrinsics enabled globally. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   158
        if (!wb.isIntrinsicAvailable(getCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   159
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   160
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   161
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   162
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   163
        if (!wb.isIntrinsicAvailable(getInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   164
            throw new RuntimeException("Intrinsic for [" + getInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   165
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   166
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   167
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   168
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   169
        if (!wb.isIntrinsicAvailable(getIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   170
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   171
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   172
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   173
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   174
        /* Test if disabling an intrinsic globally disables it on a
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   175
         * per-method level as well. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   176
        if (!wb.isIntrinsicAvailable(putChar, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   177
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   178
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   179
                                       getChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   180
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   181
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   182
        if (wb.isIntrinsicAvailable(putCharVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   183
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   184
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   185
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   186
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   187
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   188
        if (wb.isIntrinsicAvailable(putInt, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   189
            throw new RuntimeException("Intrinsic for [" + putInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   190
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   191
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   192
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   193
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   194
        if (wb.isIntrinsicAvailable(putIntVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   195
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   196
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   197
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   198
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   199
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   200
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   201
    public static void main(String args[]) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   202
        if (Platform.isServer()) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   203
            if (isTieredCompilationEnabled()) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   204
                test(COMP_LEVEL_SIMPLE);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   205
            }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   206
            test(COMP_LEVEL_FULL_OPTIMIZATION);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   207
        } else {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   208
            test(COMP_LEVEL_SIMPLE);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   209
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   210
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   211
}