hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 43455 96560cffef4d
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
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
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40631
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;
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40631
diff changeset
    47
import compiler.whitebox.CompilerWhiteBoxTest;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    48
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    49
import java.lang.reflect.Executable;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    50
import java.util.Objects;
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
public class IntrinsicDisabledTest {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    53
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    54
    private static final WhiteBox wb = WhiteBox.getWhiteBox();
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    55
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    56
    /* Determine if tiered compilation is enabled. */
40364
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
    57
    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
    58
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
    59
    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
    60
36551
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    61
    /* 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
    62
     * getMethod() returns a different Executable for each different
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    63
     * combination of its input parameters. There are eight possible
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    64
     * combinations, getMethod can return an Executable representing
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    65
     * the following methods: putChar, putCharVolatile, getChar,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    66
     * getCharVolatile, putInt, putIntVolatile, getInt,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    67
     * getIntVolatile. These methods were selected because they can
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    68
     * be intrinsified by both the C1 and the C2 compiler.
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    69
     */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    70
    static Executable getMethod(boolean isChar, boolean isPut, boolean isVolatile) throws RuntimeException {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    71
        Executable aMethod;
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    72
        String methodTypeName = isChar ? "Char" : "Int";
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    73
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    74
        try {
36551
77f29c57ed2e 8149159: Clean up Unsafe
mikael
parents: 35753
diff changeset
    75
            Class aClass = Class.forName("jdk.internal.misc.Unsafe");
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    76
            if (isPut) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    77
                aMethod = aClass.getDeclaredMethod("put" + methodTypeName + (isVolatile ? "Volatile" : ""),
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    78
                                                   Object.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    79
                                                   long.class,
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    80
                                                   isChar ? char.class : int.class);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    81
            } else {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    82
                aMethod = aClass.getDeclaredMethod("get" + 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
            }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    86
        } catch (NoSuchMethodException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    87
            throw new RuntimeException("Test bug, method is unavailable. " + e);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    88
        } catch (ClassNotFoundException e) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    89
            throw new RuntimeException("Test bug, class is unavailable. " + e);
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    92
        return aMethod;
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    95
    public static void test(int compLevel) {
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
        Executable putChar = getMethod(true, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    98
        Executable getChar = getMethod(true, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
    99
        Executable putCharVolatile = getMethod(true, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   100
        Executable getCharVolatile = getMethod(true, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   101
        Executable putInt = getMethod(false, /*isPut =*/ true, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   102
        Executable getInt = getMethod(false, /*isPut =*/ false, /*isVolatile = */ false);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   103
        Executable putIntVolatile = getMethod(false, /*isPut =*/ true, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   104
        Executable getIntVolatile = getMethod(false, /*isPut =*/ false, /*isVolatile = */ true);
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   105
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   106
        /* Test if globally disabling intrinsics works. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   107
        if (!wb.isIntrinsicAvailable(putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   108
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   109
                                       "] is not available globally although it should be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   112
        if (wb.isIntrinsicAvailable(putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   113
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   114
                                       "] is available globally although it should not 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(putInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   118
            throw new RuntimeException("Intrinsic for [" + putInt.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(putIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   123
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.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
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   128
         * works. The method for which intrinsics are
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   129
         * disabled (the compilation context) is putChar. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   130
        if (!wb.isIntrinsicAvailable(getChar, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   131
            throw new RuntimeException("Intrinsic for [" + getChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   132
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   133
                                       putChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   134
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   135
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   136
        if (wb.isIntrinsicAvailable(getCharVolatile, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   137
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   138
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   139
                                       putChar.toGenericString() + "] although it should not be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   142
        if (wb.isIntrinsicAvailable(getInt, putChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   143
            throw new RuntimeException("Intrinsic for [" + getInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   144
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   145
                                       putChar.toGenericString() + "] although it should not be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   148
        if (wb.isIntrinsicAvailable(getIntVolatile, putCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   149
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   150
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   151
                                       putCharVolatile.toGenericString() + "] although it should not be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   154
        /* Test if disabling intrinsics on a per-method level
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   155
         * leaves those intrinsics enabled globally. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   156
        if (!wb.isIntrinsicAvailable(getCharVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   157
            throw new RuntimeException("Intrinsic for [" + getCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   158
                                       "] is not available globally although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   159
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   160
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   161
        if (!wb.isIntrinsicAvailable(getInt, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   162
            throw new RuntimeException("Intrinsic for [" + getInt.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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   167
        if (!wb.isIntrinsicAvailable(getIntVolatile, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   168
            throw new RuntimeException("Intrinsic for [" + getIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   169
                                       "] is not available globally although it should be.");
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
        /* Test if disabling an intrinsic globally disables it on a
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   173
         * per-method level as well. */
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   174
        if (!wb.isIntrinsicAvailable(putChar, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   175
            throw new RuntimeException("Intrinsic for [" + putChar.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   176
                                       "] is not available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   177
                                       getChar.toGenericString() + "] although it should be.");
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   178
        }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   179
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   180
        if (wb.isIntrinsicAvailable(putCharVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   181
            throw new RuntimeException("Intrinsic for [" + putCharVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   182
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   183
                                       getChar.toGenericString() + "] although it should not be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   186
        if (wb.isIntrinsicAvailable(putInt, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   187
            throw new RuntimeException("Intrinsic for [" + putInt.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   188
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   189
                                       getChar.toGenericString() + "] although it should not be.");
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
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   192
        if (wb.isIntrinsicAvailable(putIntVolatile, getChar, compLevel)) {
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   193
            throw new RuntimeException("Intrinsic for [" + putIntVolatile.toGenericString() +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   194
                                       "] is available for intrinsification in [" +
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   195
                                       getChar.toGenericString() + "] although it should not be.");
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
    }
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
    public static void main(String args[]) {
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
   200
        if (Platform.isServer() && !Platform.isEmulatedClient() &&
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
   201
                                   (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION)) {
40364
5bf8fa4fddfd 8162881: Effect of -XX:CICompilerCount depends on ordering of other flags
thartmann
parents: 40059
diff changeset
   202
            if (TIERED_COMPILATION) {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40631
diff changeset
   203
                test(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   204
            }
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40631
diff changeset
   205
            test(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
33480
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   206
        } else {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 40631
diff changeset
   207
            test(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
33480
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
    }
e4cef6796874 8138651: -XX:DisableIntrinsic matches intrinsics overly eagerly
zmajo
parents:
diff changeset
   210
}