annotate test/compiler/whitebox/CompilerWhiteBoxTest.java @ 21188:2acf1d23d3af

Move PhiResolver from c.o.g.compiler.gen to c.o.g.lir.gen.
author Josef Eisl <josef.eisl@jku.at>
date Mon, 20 Apr 2015 14:24:55 +0200
parents 7848fc12602b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
1 /*
17711
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
4 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
7 * published by the Free Software Foundation.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
8 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
13 * accompanied this code).
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
14 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
18 *
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
21 * questions.
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
22 */
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
23
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
24 import com.sun.management.HotSpotDiagnosticMXBean;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
25 import com.sun.management.VMOption;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
26 import sun.hotspot.WhiteBox;
17817
4abb719c5620 8038240: new WB API to get nmethod
iignatyev
parents: 17711
diff changeset
27 import sun.hotspot.code.NMethod;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
28 import sun.management.ManagementFactoryHelper;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
29
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
30 import java.lang.reflect.Constructor;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
31 import java.lang.reflect.Executable;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
32 import java.lang.reflect.Method;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
33 import java.util.Objects;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
34 import java.util.concurrent.Callable;
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
35 import java.util.function.Function;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
36
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
37 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
38 * Abstract class for WhiteBox testing of JIT.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
39 *
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
40 * @author igor.ignatyev@oracle.com
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
41 */
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
42 public abstract class CompilerWhiteBoxTest {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
43 /** {@code CompLevel::CompLevel_none} -- Interpreter */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
44 protected static int COMP_LEVEL_NONE = 0;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
45 /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
46 protected static int COMP_LEVEL_ANY = -1;
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
47 /** {@code CompLevel::CompLevel_simple} -- C1 */
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
48 protected static int COMP_LEVEL_SIMPLE = 1;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
49 /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation &amp; backedge counters */
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
50 protected static int COMP_LEVEL_LIMITED_PROFILE = 2;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
51 /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation &amp; backedge counters + mdo */
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
52 protected static int COMP_LEVEL_FULL_PROFILE = 3;
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
53 /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
54 protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
55 /** Maximal value for CompLevel */
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
56 protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
57
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
58 /** Instance of WhiteBox */
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
59 protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
60 /** Value of {@code -XX:CompileThreshold} */
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
61 protected static final int COMPILE_THRESHOLD
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
62 = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
63 /** Value of {@code -XX:BackgroundCompilation} */
8766
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
64 protected static final boolean BACKGROUND_COMPILATION
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
65 = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
66 /** Value of {@code -XX:TieredCompilation} */
9080
b84fd7d73702 8007288: Additional WB API for compiler's testing
iignatyev
parents: 8766
diff changeset
67 protected static final boolean TIERED_COMPILATION
b84fd7d73702 8007288: Additional WB API for compiler's testing
iignatyev
parents: 8766
diff changeset
68 = Boolean.valueOf(getVMOption("TieredCompilation", "false"));
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
69 /** Value of {@code -XX:TieredStopAtLevel} */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
70 protected static final int TIERED_STOP_AT_LEVEL
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
71 = Integer.parseInt(getVMOption("TieredStopAtLevel", "0"));
12026
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
72 /** Flag for verbose output, true if {@code -Dverbose} specified */
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
73 protected static final boolean IS_VERBOSE
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
74 = System.getProperty("verbose") != null;
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
75 /** invocation count to trigger compilation */
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
76 protected static final int THRESHOLD;
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
77 /** invocation count to trigger OSR compilation */
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
78 protected static final long BACKEDGE_THRESHOLD;
12328
303826f477c6 8023452: TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 12073
diff changeset
79 /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
80 protected static final String MODE = System.getProperty("java.vm.info");
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
81
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
82 static {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
83 if (TIERED_COMPILATION) {
12958
600c83f8e6a5 8023318: compiler/whitebox tests timeout with enabled TieredCompilation
iignatyev
parents: 12328
diff changeset
84 BACKEDGE_THRESHOLD = THRESHOLD = 150000;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
85 } else {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
86 THRESHOLD = COMPILE_THRESHOLD;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
87 BACKEDGE_THRESHOLD = COMPILE_THRESHOLD * Long.parseLong(getVMOption(
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
88 "OnStackReplacePercentage"));
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
89 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
90 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
91
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
92 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
93 * Returns value of VM option.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
94 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
95 * @param name option's name
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
96 * @return value of option or {@code null}, if option doesn't exist
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
97 * @throws NullPointerException if name is null
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
98 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
99 protected static String getVMOption(String name) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
100 Objects.requireNonNull(name);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
101 HotSpotDiagnosticMXBean diagnostic
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
102 = ManagementFactoryHelper.getDiagnosticMXBean();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
103 VMOption tmp;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
104 try {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
105 tmp = diagnostic.getVMOption(name);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
106 } catch (IllegalArgumentException e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
107 tmp = null;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
108 }
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
109 return (tmp == null ? null : tmp.getValue());
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
110 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
111
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
112 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
113 * Returns value of VM option or default value.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
114 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
115 * @param name option's name
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
116 * @param defaultValue default value
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
117 * @return value of option or {@code defaultValue}, if option doesn't exist
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
118 * @throws NullPointerException if name is null
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
119 * @see #getVMOption(String)
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
120 */
8766
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
121 protected static String getVMOption(String name, String defaultValue) {
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
122 String result = getVMOption(name);
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
123 return result == null ? defaultValue : result;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
124 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
125
10200
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
126 /** copy of is_c1_compile(int) from utilities/globalDefinitions.hpp */
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
127 protected static boolean isC1Compile(int compLevel) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
128 return (compLevel > COMP_LEVEL_NONE)
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
129 && (compLevel < COMP_LEVEL_FULL_OPTIMIZATION);
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
130 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
131
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
132 /** copy of is_c2_compile(int) from utilities/globalDefinitions.hpp */
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
133 protected static boolean isC2Compile(int compLevel) {
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
134 return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
135 }
d1c9384eecb4 8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents: 10113
diff changeset
136
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
137 protected static void main(
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
138 Function<TestCase, CompilerWhiteBoxTest> constructor,
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
139 String[] args) {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
140 if (args.length == 0) {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
141 for (TestCase test : SimpleTestCase.values()) {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
142 constructor.apply(test).runTest();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
143 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
144 } else {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
145 for (String name : args) {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
146 constructor.apply(SimpleTestCase.valueOf(name)).runTest();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
147 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
148 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
149 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
150
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
151 /** tested method */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
152 protected final Executable method;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
153 protected final TestCase testCase;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
154
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
155 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
156 * Constructor.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
157 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
158 * @param testCase object, that contains tested method and way to invoke it.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
159 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
160 protected CompilerWhiteBoxTest(TestCase testCase) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
161 Objects.requireNonNull(testCase);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
162 System.out.println("TEST CASE:" + testCase.name());
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
163 method = testCase.getExecutable();
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
164 this.testCase = testCase;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
165 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
166
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
167 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
168 * Template method for testing. Prints tested method's info before
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
169 * {@linkplain #test()} and after {@linkplain #test()} or on thrown
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
170 * exception.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
171 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
172 * @throws RuntimeException if method {@linkplain #test()} throws any
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
173 * exception
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
174 * @see #test()
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
175 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
176 protected final void runTest() {
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
177 if (ManagementFactoryHelper.getCompilationMXBean() == null) {
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
178 System.err.println(
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
179 "Warning: test is not applicable in interpreted mode");
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
180 return;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
181 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
182 System.out.println("at test's start:");
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
183 printInfo();
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
184 try {
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
185 test();
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
186 } catch (Exception e) {
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
187 System.out.printf("on exception '%s':", e.getMessage());
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
188 printInfo();
8766
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
189 e.printStackTrace();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
190 if (e instanceof RuntimeException) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
191 throw (RuntimeException) e;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
192 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
193 throw new RuntimeException(e);
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
194 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
195 System.out.println("at test's end:");
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
196 printInfo();
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
197 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
198
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
199 /**
17869
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
200 * Checks, that {@linkplain #method} is not compiled at the given compilation
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
201 * level or above.
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
202 *
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
203 * @param compLevel
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
204 *
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
205 * @throws RuntimeException if {@linkplain #method} is in compiler queue or
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
206 * is compiled, or if {@linkplain #method} has zero
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
207 * compilation level.
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
208 */
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
209 protected final void checkNotCompiled(int compLevel) {
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
210 if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
211 throw new RuntimeException(method + " must not be in queue");
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
212 }
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
213 if (WHITE_BOX.getMethodCompilationLevel(method, false) >= compLevel) {
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
214 throw new RuntimeException(method + " comp_level must be >= maxCompLevel");
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
215 }
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
216 if (WHITE_BOX.getMethodCompilationLevel(method, true) >= compLevel) {
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
217 throw new RuntimeException(method + " osr_comp_level must be >= maxCompLevel");
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
218 }
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
219 }
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
220
5e6f84e7a942 8007270: Make IsMethodCompilable test work with tiered
neliasso
parents: 17817
diff changeset
221 /**
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
222 * Checks, that {@linkplain #method} is not compiled.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
223 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
224 * @throws RuntimeException if {@linkplain #method} is in compiler queue or
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
225 * is compiled, or if {@linkplain #method} has zero
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
226 * compilation level.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
227 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
228 protected final void checkNotCompiled() {
20607
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
229 checkNotCompiled(true);
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
230 checkNotCompiled(false);
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
231 }
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
232
20607
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
233 /**
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
234 * Checks, that {@linkplain #method} is not (OSR-)compiled.
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
235 *
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
236 * @param isOsr Check for OSR compilation if true
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
237 * @throws RuntimeException if {@linkplain #method} is in compiler queue or
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
238 * is compiled, or if {@linkplain #method} has zero
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
239 * compilation level.
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
240 */
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
241 protected final void checkNotCompiled(boolean isOsr) {
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
242 waitBackgroundCompilation();
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
243 if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
244 throw new RuntimeException(method + " must not be in queue");
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
245 }
20607
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
246 if (WHITE_BOX.isMethodCompiled(method, isOsr)) {
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
247 throw new RuntimeException(method + " must not be " +
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
248 (isOsr ? "osr_" : "") + "compiled");
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
249 }
20607
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
250 if (WHITE_BOX.getMethodCompilationLevel(method, isOsr) != 0) {
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
251 throw new RuntimeException(method + (isOsr ? " osr_" : " ") +
f5f752e74840 8061983: [TESTBUG] compiler/whitebox/MakeMethodNotCompilableTest.java fails with "must not be in queue"
thartmann
parents: 20606
diff changeset
252 "comp_level must be == 0");
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
253 }
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
254 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
255
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
256 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
257 * Checks, that {@linkplain #method} is compiled.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
258 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
259 * @throws RuntimeException if {@linkplain #method} isn't in compiler queue
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
260 * and isn't compiled, or if {@linkplain #method}
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
261 * has nonzero compilation level
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
262 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
263 protected final void checkCompiled() {
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
264 final long start = System.currentTimeMillis();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
265 waitBackgroundCompilation();
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
266 if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
267 System.err.printf("Warning: %s is still in queue after %dms%n",
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
268 method, System.currentTimeMillis() - start);
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
269 return;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
270 }
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
271 if (!WHITE_BOX.isMethodCompiled(method, testCase.isOsr())) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
272 throw new RuntimeException(method + " must be "
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
273 + (testCase.isOsr() ? "osr_" : "") + "compiled");
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
274 }
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
275 if (WHITE_BOX.getMethodCompilationLevel(method, testCase.isOsr())
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
276 == 0) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
277 throw new RuntimeException(method
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
278 + (testCase.isOsr() ? " osr_" : " ")
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
279 + "comp_level must be != 0");
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
280 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
281 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
282
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
283 protected final void deoptimize() {
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
284 WHITE_BOX.deoptimizeMethod(method, testCase.isOsr());
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
285 if (testCase.isOsr()) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
286 WHITE_BOX.deoptimizeMethod(method, false);
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
287 }
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
288 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
289
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
290 protected final int getCompLevel() {
17817
4abb719c5620 8038240: new WB API to get nmethod
iignatyev
parents: 17711
diff changeset
291 NMethod nm = NMethod.get(method, testCase.isOsr());
4abb719c5620 8038240: new WB API to get nmethod
iignatyev
parents: 17711
diff changeset
292 return nm == null ? COMP_LEVEL_NONE : nm.comp_level;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
293 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
294
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
295 protected final boolean isCompilable() {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
296 return WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY,
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
297 testCase.isOsr());
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
298 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
299
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
300 protected final boolean isCompilable(int compLevel) {
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
301 return WHITE_BOX
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
302 .isMethodCompilable(method, compLevel, testCase.isOsr());
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
303 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
304
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
305 protected final void makeNotCompilable() {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
306 WHITE_BOX.makeMethodNotCompilable(method, COMP_LEVEL_ANY,
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
307 testCase.isOsr());
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
308 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
309
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
310 protected final void makeNotCompilable(int compLevel) {
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
311 WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
312 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
313
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
314 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
315 * Waits for completion of background compilation of {@linkplain #method}.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
316 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
317 protected final void waitBackgroundCompilation() {
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
318 waitBackgroundCompilation(method);
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
319 }
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
320
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
321 /**
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
322 * Waits for completion of background compilation of the given executable.
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
323 *
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
324 * @param executable Executable
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
325 */
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
326 protected static final void waitBackgroundCompilation(Executable executable) {
8766
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
327 if (!BACKGROUND_COMPILATION) {
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
328 return;
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
329 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
330 final Object obj = new Object();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
331 for (int i = 0; i < 10
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
332 && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
333 synchronized (obj) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
334 try {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
335 obj.wait(1000);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
336 } catch (InterruptedException e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
337 Thread.currentThread().interrupt();
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
338 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
339 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
340 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
341 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
342
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
343 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
344 * Prints information about {@linkplain #method}.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
345 */
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
346 protected final void printInfo() {
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
347 System.out.printf("%n%s:%n", method);
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
348 System.out.printf("\tcompilable:\t%b%n",
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
349 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
350 System.out.printf("\tcompiled:\t%b%n",
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
351 WHITE_BOX.isMethodCompiled(method, false));
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
352 System.out.printf("\tcomp_level:\t%d%n",
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
353 WHITE_BOX.getMethodCompilationLevel(method, false));
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
354 System.out.printf("\tosr_compilable:\t%b%n",
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
355 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
356 System.out.printf("\tosr_compiled:\t%b%n",
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
357 WHITE_BOX.isMethodCompiled(method, true));
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
358 System.out.printf("\tosr_comp_level:\t%d%n",
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
359 WHITE_BOX.getMethodCompilationLevel(method, true));
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
360 System.out.printf("\tin_queue:\t%b%n",
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
361 WHITE_BOX.isMethodQueuedForCompilation(method));
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
362 System.out.printf("compile_queues_size:\t%d%n%n",
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
363 WHITE_BOX.getCompileQueuesSize());
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
364 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
365
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
366 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
367 * Executes testing.
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
368 */
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
369 protected abstract void test() throws Exception;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
370
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
371 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
372 * Tries to trigger compilation of {@linkplain #method} by call
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
373 * {@linkplain TestCase#getCallable()} enough times.
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
374 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
375 * @return accumulated result
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
376 * @see #compile(int)
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
377 */
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
378 protected final int compile() {
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
379 if (testCase.isOsr()) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
380 return compile(1);
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
381 } else {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
382 return compile(THRESHOLD);
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
383 }
9080
b84fd7d73702 8007288: Additional WB API for compiler's testing
iignatyev
parents: 8766
diff changeset
384 }
b84fd7d73702 8007288: Additional WB API for compiler's testing
iignatyev
parents: 8766
diff changeset
385
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
386 /**
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
387 * Tries to trigger compilation of {@linkplain #method} by call
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
388 * {@linkplain TestCase#getCallable()} specified times.
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
389 *
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
390 * @param count invocation count
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
391 * @return accumulated result
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
392 */
9080
b84fd7d73702 8007288: Additional WB API for compiler's testing
iignatyev
parents: 8766
diff changeset
393 protected final int compile(int count) {
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
394 int result = 0;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
395 Integer tmp;
8766
4efac99a998b 8008211: Some of WB tests on compiler fail
iignatyev
parents: 8051
diff changeset
396 for (int i = 0; i < count; ++i) {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
397 try {
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
398 tmp = testCase.getCallable().call();
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
399 } catch (Exception e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
400 tmp = null;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
401 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
402 result += tmp == null ? 0 : tmp;
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
403 }
12026
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
404 if (IS_VERBOSE) {
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
405 System.out.println("method was invoked " + count + " times");
11237ee74aae 8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents: 10200
diff changeset
406 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
407 return result;
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
408 }
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
409
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
410 /**
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
411 * Utility interface provides tested method and object to invoke it.
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
412 */
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
413 public interface TestCase {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
414 /** the name of test case */
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
415 String name();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
416
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
417 /** tested method */
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
418 Executable getExecutable();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
419
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
420 /** object to invoke {@linkplain #getExecutable()} */
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
421 Callable<Integer> getCallable();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
422
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
423 /** flag for OSR test case */
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
424 boolean isOsr();
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
425 }
17711
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
426
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
427 /**
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
428 * @return {@code true} if the current test case is OSR and the mode is
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
429 * Xcomp, otherwise {@code false}
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
430 */
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
431 protected boolean skipXcompOSR() {
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
432 boolean result = testCase.isOsr()
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
433 && CompilerWhiteBoxTest.MODE.startsWith("compiled ");
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
434 if (result && IS_VERBOSE) {
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
435 System.err.printf("Warning: %s is not applicable in %s%n",
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
436 testCase.name(), CompilerWhiteBoxTest.MODE);
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
437 }
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
438 return result;
d559dbbded7a 8027124: [TESTBUG] NonTieredLevelsTest: java.lang.RuntimeException: private TestCase$Helper(java.lang.Object) must be osr_compiled
iignatyev
parents: 14203
diff changeset
439 }
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
440 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
441
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
442 enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
443 /** constructor test case */
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
444 CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false),
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
445 /** method test case */
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
446 METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false),
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
447 /** static method test case */
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
448 STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false),
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
449 /** OSR constructor test case */
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
450 OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR,
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
451 Helper.OSR_CONSTRUCTOR_CALLABLE, true),
12958
600c83f8e6a5 8023318: compiler/whitebox tests timeout with enabled TieredCompilation
iignatyev
parents: 12328
diff changeset
452 /** OSR method test case */
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
453 OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true),
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
454 /** OSR static method test case */
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
455 OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
456
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
457 private final Executable executable;
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
458 private final Callable<Integer> callable;
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
459 private final boolean isOsr;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
460
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
461 private SimpleTestCase(Executable executable, Callable<Integer> callable,
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
462 boolean isOsr) {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
463 this.executable = executable;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
464 this.callable = callable;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
465 this.isOsr = isOsr;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
466 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
467
14203
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
468 @Override
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
469 public Executable getExecutable() {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
470 return executable;
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
471 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
472
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
473 @Override
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
474 public Callable<Integer> getCallable() {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
475 return callable;
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
476 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
477
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
478 @Override
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
479 public boolean isOsr() {
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
480 return isOsr;
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
481 }
f9a4b59ae350 8028587: New tests development for intrisics for basic operators - add, neg, inc, dec, sub, mul
iignatyev
parents: 12958
diff changeset
482
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
483 private static class Helper {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
484
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
485 private static final Callable<Integer> CONSTRUCTOR_CALLABLE
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
486 = new Callable<Integer>() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
487 @Override
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
488 public Integer call() throws Exception {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
489 return new Helper(1337).hashCode();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
490 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
491 };
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
492
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
493 private static final Callable<Integer> METHOD_CALLABLE
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
494 = new Callable<Integer>() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
495 private final Helper helper = new Helper();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
496
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
497 @Override
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
498 public Integer call() throws Exception {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
499 return helper.method();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
500 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
501 };
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
502
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
503 private static final Callable<Integer> STATIC_CALLABLE
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
504 = new Callable<Integer>() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
505 @Override
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
506 public Integer call() throws Exception {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
507 return staticMethod();
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
508 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
509 };
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
510
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
511 private static final Callable<Integer> OSR_CONSTRUCTOR_CALLABLE
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
512 = new Callable<Integer>() {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
513 @Override
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
514 public Integer call() throws Exception {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
515 return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode();
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
516 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
517 };
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
518
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
519 private static final Callable<Integer> OSR_METHOD_CALLABLE
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
520 = new Callable<Integer>() {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
521 private final Helper helper = new Helper();
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
522
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
523 @Override
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
524 public Integer call() throws Exception {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
525 return helper.osrMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
526 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
527 };
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
528
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
529 private static final Callable<Integer> OSR_STATIC_CALLABLE
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
530 = new Callable<Integer>() {
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
531 @Override
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
532 public Integer call() throws Exception {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
533 return osrStaticMethod(CompilerWhiteBoxTest.BACKEDGE_THRESHOLD);
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
534 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
535 };
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
536
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
537 private static final Constructor CONSTRUCTOR;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
538 private static final Constructor OSR_CONSTRUCTOR;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
539 private static final Method METHOD;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
540 private static final Method STATIC;
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
541 private static final Method OSR_METHOD;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
542 private static final Method OSR_STATIC;
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
543
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
544 static {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
545 try {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
546 CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
547 } catch (NoSuchMethodException | SecurityException e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
548 throw new RuntimeException(
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
549 "exception on getting method Helper.<init>(int)", e);
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
550 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
551 try {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
552 OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor(
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
553 Object.class, long.class);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
554 } catch (NoSuchMethodException | SecurityException e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
555 throw new RuntimeException(
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
556 "exception on getting method Helper.<init>(Object, long)", e);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
557 }
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
558 METHOD = getMethod("method");
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
559 STATIC = getMethod("staticMethod");
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
560 OSR_METHOD = getMethod("osrMethod", long.class);
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
561 OSR_STATIC = getMethod("osrStaticMethod", long.class);
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
562 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
563
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
564 private static Method getMethod(String name, Class<?>... parameterTypes) {
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
565 try {
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
566 return Helper.class.getDeclaredMethod(name, parameterTypes);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
567 } catch (NoSuchMethodException | SecurityException e) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
568 throw new RuntimeException(
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
569 "exception on getting method Helper." + name, e);
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
570 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
571 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
572
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
573 private static int staticMethod() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
574 return 1138;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
575 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
576
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
577 private int method() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
578 return 42;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
579 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
580
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
581 /**
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
582 * Deoptimizes all non-osr versions of the given executable after
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
583 * compilation finished.
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
584 *
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
585 * @param e Executable
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
586 * @throws Exception
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
587 */
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
588 private static void waitAndDeoptimize(Executable e) {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
589 CompilerWhiteBoxTest.waitBackgroundCompilation(e);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
590 if (WhiteBox.getWhiteBox().isMethodQueuedForCompilation(e)) {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
591 throw new RuntimeException(e + " must not be in queue");
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
592 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
593 // Deoptimize non-osr versions of executable
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
594 WhiteBox.getWhiteBox().deoptimizeMethod(e, false);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
595 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
596
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
597 /**
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
598 * Executes the method multiple times to make sure we have
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
599 * enough profiling information before triggering an OSR
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
600 * compilation. Otherwise the C2 compiler may add uncommon traps.
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
601 *
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
602 * @param m Method to be executed
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
603 * @return Number of times the method was executed
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
604 * @throws Exception
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
605 */
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
606 private static int warmup(Method m) throws Exception {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
607 waitAndDeoptimize(m);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
608 Helper helper = new Helper();
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
609 int result = 0;
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
610 for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
611 result += (int)m.invoke(helper, 1);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
612 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
613 // Wait to make sure OSR compilation is not blocked by
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
614 // non-OSR compilation in the compile queue
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
615 CompilerWhiteBoxTest.waitBackgroundCompilation(m);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
616 return result;
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
617 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
618
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
619 /**
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
620 * Executes the constructor multiple times to make sure we
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
621 * have enough profiling information before triggering an OSR
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
622 * compilation. Otherwise the C2 compiler may add uncommon traps.
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
623 *
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
624 * @param c Constructor to be executed
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
625 * @return Number of times the constructor was executed
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
626 * @throws Exception
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
627 */
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
628 private static int warmup(Constructor c) throws Exception {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
629 waitAndDeoptimize(c);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
630 int result = 0;
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
631 for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
632 result += c.newInstance(null, 1).hashCode();
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
633 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
634 // Wait to make sure OSR compilation is not blocked by
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
635 // non-OSR compilation in the compile queue
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
636 CompilerWhiteBoxTest.waitBackgroundCompilation(c);
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
637 return result;
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
638 }
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
639
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
640 private static int osrStaticMethod(long limit) throws Exception {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
641 int result = 0;
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
642 if (limit != 1) {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
643 result = warmup(OSR_STATIC);
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
644 }
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
645 // Trigger osr compilation
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
646 for (long i = 0; i < limit; ++i) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
647 result += staticMethod();
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
648 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
649 return result;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
650 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
651
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
652 private int osrMethod(long limit) throws Exception {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
653 int result = 0;
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
654 if (limit != 1) {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
655 result = warmup(OSR_METHOD);
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
656 }
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
657 // Trigger osr compilation
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
658 for (long i = 0; i < limit; ++i) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
659 result += method();
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
660 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
661 return result;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
662 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
663
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
664 private final int x;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
665
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
666 // for method and OSR method test case
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
667 public Helper() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
668 x = 0;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
669 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
670
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
671 // for OSR constructor test case
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
672 private Helper(Object o, long limit) throws Exception {
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
673 int result = 0;
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
674 if (limit != 1) {
20606
d1e732bbe4e5 8061486: [TESTBUG] compiler/whitebox/ tests fail : must be osr_compiled (reappeared in nightlies)
thartmann
parents: 20605
diff changeset
675 result = warmup(OSR_CONSTRUCTOR);
20605
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
676 }
564d97997064 8060454: [TESTBUG] Whitebox tests fail with -XX:CompileThreshold=100
thartmann
parents: 20604
diff changeset
677 // Trigger osr compilation
20604
c88a4554854c 8046268: compiler/whitebox/ tests fail : must be osr_compiled
thartmann
parents: 17869
diff changeset
678 for (long i = 0; i < limit; ++i) {
12073
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
679 result += method();
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
680 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
681 x = result;
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
682 }
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
683
f99558245e5c 8022832: Add WB APIs for OSR compilation
iignatyev
parents: 12026
diff changeset
684 // for constructor test case
10113
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
685 private Helper(int x) {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
686 this.x = x;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
687 }
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
688
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
689 @Override
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
690 public int hashCode() {
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
691 return x;
4b2eebe03f93 8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents: 9080
diff changeset
692 }
8051
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
693 }
12e01444ca2d 8006683: Add WhiteBox API to testing of compiler
iignatyev
parents:
diff changeset
694 }