annotate test/compiler/rtm/locking/TestUseRTMDeopt.java @ 21192:4c7c22aa4bd7

LinearScan: add more information to assertion.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 22 Apr 2015 10:50:36 +0200
parents ba8268c23fa2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17873
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
1 /*
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
4 *
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
7 * published by the Free Software Foundation.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
8 *
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
13 * accompanied this code).
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
14 *
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
18 *
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
21 * questions.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
22 *
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
23 */
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
24
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
25 /**
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
26 * @test
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
27 * @bug 8031320
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
28 * @summary Verify that UseRTMDeopt affects uncommon trap installation in
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
29 * copmpiled methods with synchronized block.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
30 * @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
31 * @build TestUseRTMDeopt
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
32 * @run main ClassFileInstaller sun.hotspot.WhiteBox
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
33 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
34 * -XX:+WhiteBoxAPI TestUseRTMDeopt
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
35 */
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
36
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
37 import com.oracle.java.testlibrary.*;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
38 import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
39 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
40 import rtm.*;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
41 import rtm.predicate.SupportedCPU;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
42 import rtm.predicate.SupportedVM;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
43
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
44 /**
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
45 * Test verifies that usage of UseRTMDeopt option affects uncommon traps usage
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
46 * for methods that use locking.
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
47 */
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
48 public class TestUseRTMDeopt extends CommandLineOptionTest {
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
49 private TestUseRTMDeopt() {
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
50 super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
51 }
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
52
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
53 @Override
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
54 protected void runTestCases() throws Throwable {
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
55 verifyUseRTMDeopt(false);
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
56 verifyUseRTMDeopt(true);
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
57 }
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
58
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
59 private void verifyUseRTMDeopt(boolean useRTMDeopt) throws Throwable {
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
60 AbortProvoker provoker = AbortType.XABORT.provoker();
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
61 String logFileName = String.format("rtm_%s_deopt.xml",
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
62 useRTMDeopt ? "use" : "no");
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
63
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
64 OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
65 logFileName,
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
66 provoker,
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
67 CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt",
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
68 useRTMDeopt),
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
69 AbortProvoker.class.getName(),
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
70 AbortType.XABORT.toString()
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
71 );
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
72
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
73 outputAnalyzer.shouldHaveExitValue(0);
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
74
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
75 int expectedUncommonTraps = useRTMDeopt ? 1 : 0;
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
76 int installedUncommonTraps
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
77 = RTMTestBase.installedRTMStateChangeTraps(logFileName);
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
78
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
79 Asserts.assertEQ(expectedUncommonTraps, installedUncommonTraps,
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
80 String.format("Expected to find %d uncommon traps "
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
81 + "installed with reason rtm_state_change.",
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
82 expectedUncommonTraps));
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
83 }
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
84
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
85 public static void main(String args[]) throws Throwable {
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
86 new TestUseRTMDeopt().test();
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
87 }
ba8268c23fa2 8037860: Add tests to cover Intel RTM instructions support
iignatyev
parents:
diff changeset
88 }