hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
author thartmann
Thu, 12 May 2016 08:23:25 +0200
changeset 38675 066fcb1eb80a
parent 36851 03e2f4d0a421
child 39438 206a712f8f16
permissions -rw-r--r--
8155643: Java crash with assert in Xcomp mode and disabled ReduceInitialCardMarks Summary: We should not emit a subtype check for CloneOop arraycopy. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35122
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     1
/*
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     4
 *
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     8
 *
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    14
 *
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    18
 *
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    21
 * questions.
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    22
 *
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    23
 */
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    24
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    25
import jdk.test.lib.cli.predicate.NotPredicate;
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    26
import jdk.test.lib.OutputAnalyzer;
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    27
import jdk.test.lib.ProcessTools;
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    28
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    29
/*
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    30
 * @test
35753
ee7921f045d2 8148012: get rid of slash-dot-dot in @library directives
iignatyev
parents: 35122
diff changeset
    31
 * @library /testlibrary /test/lib /compiler/whitebox
35122
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    32
 *          /compiler/testlibrary /compiler/codegen/7184394
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35753
diff changeset
    33
 * @modules java.base/jdk.internal.misc
35122
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    34
 *          java.management
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    35
 * @build TestAESIntrinsicsOnUnsupportedConfig TestAESMain
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    36
 * @run main ClassFileInstaller
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    37
 * sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    38
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    39
 *       -XX:+WhiteBoxAPI -Xbatch  TestAESIntrinsicsOnUnsupportedConfig
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    40
 */
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    41
public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    42
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    43
    private static final String INTRINSICS_NOT_AVAILABLE_MSG = "warning: AES "
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    44
            + "intrinsics are not available on this CPU";
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    45
    private static final String AES_NOT_AVAILABLE_MSG = "warning: AES "
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    46
            + "instructions are not available on this CPU";
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    47
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    48
    /**
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    49
     * Constructs new TestAESIntrinsicsOnUnsupportedConfig that will be
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    50
     * executed only if AESSupportPredicate returns false
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    51
     */
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    52
    private TestAESIntrinsicsOnUnsupportedConfig() {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    53
        super(new NotPredicate(AESIntrinsicsBase.AES_SUPPORTED_PREDICATE));
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    54
    }
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    55
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    56
    @Override
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    57
    protected void runTestCases() throws Throwable {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    58
        testUseAES();
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    59
        testUseAESIntrinsics();
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    60
    }
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    61
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    62
    /**
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    63
     * Test checks following situation: <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    64
     * UseAESIntrinsics flag is set to true, TestAESMain is executed <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    65
     * Expected result: UseAESIntrinsics flag is set to false <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    66
     * UseAES flag is set to false <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    67
     * Output shouldn't contain intrinsics usage <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    68
     * Output should contain message about intrinsics unavailability
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    69
     * @throws Throwable
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    70
     */
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    71
    private void testUseAESIntrinsics() throws Throwable {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    72
        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    73
                AESIntrinsicsBase.prepareArguments(prepareBooleanFlag(
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    74
                        AESIntrinsicsBase.USE_AES_INTRINSICS, true)));
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    75
        final String errorMessage = "Case testUseAESIntrinsics failed";
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    76
        verifyOutput(new String[] {INTRINSICS_NOT_AVAILABLE_MSG},
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    77
                new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC,
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    78
                        AESIntrinsicsBase.AES_INTRINSIC},
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    79
                errorMessage, outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    80
        verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    81
                errorMessage, outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    82
        verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage,
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    83
                outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    84
    }
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    85
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    86
    /**
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    87
     * Test checks following situation: <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    88
     * UseAESIntrinsics flag is set to true, TestAESMain is executed <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    89
     * Expected result: UseAES flag is set to false <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    90
     * UseAES flag is set to false <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    91
     * Output shouldn't contain intrinsics usage <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    92
     * Output should contain message about AES unavailability <br/>
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    93
     * @throws Throwable
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    94
     */
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    95
    private void testUseAES() throws Throwable {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    96
        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    97
                AESIntrinsicsBase.prepareArguments(prepareBooleanFlag
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    98
                        (AESIntrinsicsBase.USE_AES, true)));
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
    99
        final String errorMessage = "Case testUseAES failed";
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   100
        verifyOutput(new String[] {AES_NOT_AVAILABLE_MSG},
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   101
                new String[] {AESIntrinsicsBase.CIPHER_INTRINSIC,
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   102
                AESIntrinsicsBase.AES_INTRINSIC}, errorMessage, outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   103
        verifyOptionValue(AESIntrinsicsBase.USE_AES_INTRINSICS, "false",
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   104
                errorMessage, outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   105
        verifyOptionValue(AESIntrinsicsBase.USE_AES, "false", errorMessage,
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   106
                outputAnalyzer);
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   107
    }
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   108
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   109
    public static void main(String args[]) throws Throwable {
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   110
        new TestAESIntrinsicsOnUnsupportedConfig().test();
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   111
    }
3f7b7fe1bfcb 8079667: port vm/compiler/AESIntrinsics/CheckIntrinsics into jtreg
iignatyev
parents:
diff changeset
   112
}