hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
author ctornqvi
Fri, 19 Aug 2016 10:06:30 -0400
changeset 40631 ed82623d7831
parent 40364 5bf8fa4fddfd
child 42650 1f304d0c888b
permissions -rw-r--r--
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder Reviewed-by: coleenp, gtriantafill, mseledtsov, iignatyev, dholmes, dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40364
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
33480
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
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 36551
diff changeset
    27
 * @modules java.base/jdk.internal.misc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40364
diff changeset
    28
 * @library /test/lib
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    29
 *
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40364
diff changeset
    30
 * @build sun.hotspot.WhiteBox
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    31
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    32
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    33
 * @run main/othervm -Xbootclasspath/a:.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    34
 *                   -XX:+UnlockDiagnosticVMOptions
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    35
 *                   -XX:+WhiteBoxAPI
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    36
 *                   -XX:DisableIntrinsic=_putCharVolatile,_putInt
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    37
 *                   -XX:DisableIntrinsic=_putIntVolatile
36551
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    38
 *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    39
 *                   -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    40
 *                   compiler.intrinsics.IntrinsicDisabledTest
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    41
 */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    42
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    43
package compiler.intrinsics;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    44
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    45
import jdk.test.lib.Platform;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    46
import sun.hotspot.WhiteBox;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    47
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    48
import java.lang.reflect.Executable;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    49
import java.util.Objects;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    50
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    51
public class IntrinsicDisabledTest {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    52
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    53
    private static final WhiteBox wb = WhiteBox.getWhiteBox();
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 C1. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    56
    private static final int COMP_LEVEL_SIMPLE = 1;
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
    /* Compilation level corresponding to C2. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    59
    private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    60
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    61
    /* Determine if tiered compilation is enabled. */
40364
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
    62
    private static final boolean TIERED_COMPILATION = wb.getBooleanVMFlag("TieredCompilation");
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
    63
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
    64
    private static final int TIERED_STOP_AT_LEVEL = wb.getIntxVMFlag("TieredStopAtLevel").intValue();
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    65
36551
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    66
    /* This test uses several methods from jdk.internal.misc.Unsafe. The method
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    67
     * getMethod() returns a different Executable for each different
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    68
     * combination of its input parameters. There are eight possible
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    69
     * combinations, getMethod can return an Executable representing
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    70
     * the following methods: putChar, putCharVolatile, getChar,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    71
     * getCharVolatile, putInt, putIntVolatile, getInt,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    72
     * getIntVolatile. These methods were selected because they can
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    73
     * be intrinsified by both the C1 and the C2 compiler.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    74
     */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    75
    static Executable getMethod(boolean isChar, boolean isPut, boolean isVolatile) throws RuntimeException {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    76
        Executable aMethod;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    77
        String methodTypeName = isChar ? "Char" : "Int";
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    78
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    79
        try {
36551
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    80
            Class aClass = Class.forName("jdk.internal.misc.Unsafe");
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    81
            if (isPut) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    82
                aMethod = aClass.getDeclaredMethod("put" + methodTypeName + (isVolatile ? "Volatile" : ""),
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    83
                                                   Object.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    84
                                                   long.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    85
                                                   isChar ? char.class : int.class);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    86
            } else {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    87
                aMethod = aClass.getDeclaredMethod("get" + methodTypeName + (isVolatile ? "Volatile" : ""),
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    88
                                                   Object.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    89
                                                   long.class);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    90
            }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    91
        } catch (NoSuchMethodException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    92
            throw new RuntimeException("Test bug, method is unavailable. " + e);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    93
        } catch (ClassNotFoundException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    94
            throw new RuntimeException("Test bug, class is unavailable. " + e);
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
        return aMethod;
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   100
    public static void test(int compLevel) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   101
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   102
        Executable putChar = getMethod(true, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   103
        Executable getChar = getMethod(true, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   104
        Executable putCharVolatile = getMethod(true, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   105
        Executable getCharVolatile = getMethod(true, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   106
        Executable putInt = getMethod(false, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   107
        Executable getInt = getMethod(false, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   108
        Executable putIntVolatile = getMethod(false, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   109
        Executable getIntVolatile = getMethod(false, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   110
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   111
        /* Test if globally disabling intrinsics works. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   112
        if (!wb.isIntrinsicAvailable(putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   113
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   114
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   115
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   116
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   117
        if (wb.isIntrinsicAvailable(putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   118
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   119
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   120
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   121
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   122
        if (wb.isIntrinsicAvailable(putInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   123
            throw new RuntimeException("Intrinsic for [" + putInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   124
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   125
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   126
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   127
        if (wb.isIntrinsicAvailable(putIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   128
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   129
                                       "] is available globally although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   130
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   131
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   132
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   133
         * works. The method for which intrinsics are
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   134
         * disabled (the compilation context) is putChar. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   135
        if (!wb.isIntrinsicAvailable(getChar, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   136
            throw new RuntimeException("Intrinsic for [" + getChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   137
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   138
                                       putChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   139
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   140
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   141
        if (wb.isIntrinsicAvailable(getCharVolatile, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   142
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   143
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   144
                                       putChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   145
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   146
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   147
        if (wb.isIntrinsicAvailable(getInt, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   148
            throw new RuntimeException("Intrinsic for [" + getInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   149
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   150
                                       putChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   151
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   152
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   153
        if (wb.isIntrinsicAvailable(getIntVolatile, putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   154
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   155
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   156
                                       putCharVolatile.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   157
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   158
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   159
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   160
         * leaves those intrinsics enabled globally. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   161
        if (!wb.isIntrinsicAvailable(getCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   162
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   163
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   164
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   165
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   166
        if (!wb.isIntrinsicAvailable(getInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   167
            throw new RuntimeException("Intrinsic for [" + getInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   168
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   169
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   170
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   171
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   172
        if (!wb.isIntrinsicAvailable(getIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   173
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   174
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   175
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   176
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   177
        /* Test if disabling an intrinsic globally disables it on a
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   178
         * per-method level as well. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   179
        if (!wb.isIntrinsicAvailable(putChar, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   180
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   181
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   182
                                       getChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   183
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   184
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   185
        if (wb.isIntrinsicAvailable(putCharVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   186
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   187
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   188
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   189
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   190
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   191
        if (wb.isIntrinsicAvailable(putInt, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   192
            throw new RuntimeException("Intrinsic for [" + putInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   193
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   194
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   195
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   196
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   197
        if (wb.isIntrinsicAvailable(putIntVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   198
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   199
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   200
                                       getChar.toGenericString() + "] although it should not be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   201
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   202
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   203
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   204
    public static void main(String args[]) {
40364
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
   205
        if (Platform.isServer() && (TIERED_STOP_AT_LEVEL == COMP_LEVEL_FULL_OPTIMIZATION)) {
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
   206
            if (TIERED_COMPILATION) {
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   207
                test(COMP_LEVEL_SIMPLE);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   208
            }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   209
            test(COMP_LEVEL_FULL_OPTIMIZATION);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   210
        } else {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   211
            test(COMP_LEVEL_SIMPLE);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   212
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   213
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   214
}