annotate test/compiler/whitebox/DeoptimizeMultipleOSRTest.java @ 20915:916aac9fe6f7

LinearScan: use RegisterAllocationConfig.
author Josef Eisl <josef.eisl@jku.at>
date Mon, 13 Apr 2015 15:10:55 +0200
parents 3c87c13918fb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20611
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
1 /*
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
4 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
7 * published by the Free Software Foundation.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
8 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
13 * accompanied this code).
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
14 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
18 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
21 * questions.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
22 */
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
23
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
24 import sun.hotspot.WhiteBox;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
25 import java.lang.reflect.Executable;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
26 import java.lang.reflect.Method;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
27
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
28 /*
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
29 * @test DeoptimizeMultipleOSRTest
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
30 * @bug 8061817
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
31 * @library /testlibrary /testlibrary/whitebox
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
32 * @build DeoptimizeMultipleOSRTest
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
33 * @run main ClassFileInstaller sun.hotspot.WhiteBox
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
34 * sun.hotspot.WhiteBox$WhiteBoxPermission
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
35 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,DeoptimizeMultipleOSRTest::triggerOSR DeoptimizeMultipleOSRTest
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
36 * @summary testing of WB::deoptimizeMethod()
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
37 */
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
38 public class DeoptimizeMultipleOSRTest {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
39 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
40 private static final long BACKEDGE_THRESHOLD = 150000;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
41 private Method method;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
42 private int counter = 0;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
43
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
44 public static void main(String[] args) throws Exception {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
45 DeoptimizeMultipleOSRTest test = new DeoptimizeMultipleOSRTest();
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
46 test.test();
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
47 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
48
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
49 /**
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
50 * Triggers two different OSR compilations for the same method and
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
51 * checks if WhiteBox.deoptimizeMethod() deoptimizes both.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
52 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
53 * @throws Exception
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
54 */
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
55 public void test() throws Exception {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
56 method = DeoptimizeMultipleOSRTest.class.getDeclaredMethod("triggerOSR", boolean.class, long.class);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
57 // Trigger two OSR compiled versions
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
58 triggerOSR(true, BACKEDGE_THRESHOLD);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
59 triggerOSR(false, BACKEDGE_THRESHOLD);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
60 // Wait for compilation
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
61 CompilerWhiteBoxTest.waitBackgroundCompilation(method);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
62 // Deoptimize
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
63 WHITE_BOX.deoptimizeMethod(method, true);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
64 if (WHITE_BOX.isMethodCompiled(method, true)) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
65 throw new AssertionError("Not all OSR compiled versions were deoptimized");
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
66 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
67 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
68
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
69 /**
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
70 * Triggers OSR compilations by executing loops.
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
71 *
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
72 * @param first Determines which loop to execute
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
73 * @param limit The number of loop iterations
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
74 */
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
75 public void triggerOSR(boolean first, long limit) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
76 if (limit != 1) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
77 // Warmup method to avoid uncommon traps
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
78 for (int i = 0; i < limit; ++i) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
79 triggerOSR(first, 1);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
80 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
81 CompilerWhiteBoxTest.waitBackgroundCompilation(method);
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
82 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
83 if (first) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
84 // Trigger OSR compilation 1
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
85 for (int i = 0; i < limit; ++i) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
86 counter++;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
87 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
88 } else {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
89 // Trigger OSR compilation 2
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
90 for (int i = 0; i < limit; ++i) {
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
91 counter++;
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
92 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
93 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
94 }
3c87c13918fb 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
thartmann
parents:
diff changeset
95 }