author | lana |
Mon, 26 Aug 2013 22:18:48 -0700 | |
changeset 19596 | fed75ff60b44 |
parent 19282 | 9764b5a041b6 |
child 19332 | ee4c8c2af356 |
permissions | -rw-r--r-- |
15621 | 1 |
/* |
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
24 |
import com.sun.management.HotSpotDiagnosticMXBean; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
25 |
import com.sun.management.VMOption; |
15621 | 26 |
import sun.hotspot.WhiteBox; |
27 |
import sun.management.ManagementFactoryHelper; |
|
28 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
29 |
import java.lang.reflect.Constructor; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
30 |
import java.lang.reflect.Executable; |
15621 | 31 |
import java.lang.reflect.Method; |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
32 |
import java.util.Objects; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
33 |
import java.util.concurrent.Callable; |
15621 | 34 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
35 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
36 |
* Abstract class for WhiteBox testing of JIT. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
37 |
* |
15621 | 38 |
* @author igor.ignatyev@oracle.com |
39 |
*/ |
|
40 |
public abstract class CompilerWhiteBoxTest { |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
41 |
/** {@code CompLevel::CompLevel_none} -- Interpreter */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
42 |
protected static int COMP_LEVEL_NONE = 0; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
43 |
/** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
44 |
protected static int COMP_LEVEL_ANY = -1; |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
45 |
/** {@code CompLevel::CompLevel_simple} -- C1 */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
46 |
protected static int COMP_LEVEL_SIMPLE = 1; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
47 |
/** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
48 |
protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
49 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
50 |
/** Instance of WhiteBox */ |
15621 | 51 |
protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
52 |
/** Value of {@code -XX:CompileThreshold} */ |
15621 | 53 |
protected static final int COMPILE_THRESHOLD |
54 |
= Integer.parseInt(getVMOption("CompileThreshold", "10000")); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
55 |
/** Value of {@code -XX:BackgroundCompilation} */ |
16367 | 56 |
protected static final boolean BACKGROUND_COMPILATION |
57 |
= Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
58 |
/** Value of {@code -XX:TieredCompilation} */ |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
59 |
protected static final boolean TIERED_COMPILATION |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
60 |
= Boolean.valueOf(getVMOption("TieredCompilation", "false")); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
61 |
/** Value of {@code -XX:TieredStopAtLevel} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
62 |
protected static final int TIERED_STOP_AT_LEVEL |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
63 |
= Integer.parseInt(getVMOption("TieredStopAtLevel", "0")); |
19282
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
64 |
/** Flag for verbose output, true if {@code -Dverbose} specified */ |
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
65 |
protected static final boolean IS_VERBOSE |
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
66 |
= System.getProperty("verbose") != null; |
15621 | 67 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
68 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
69 |
* Returns value of VM option. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
70 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
71 |
* @param name option's name |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
72 |
* @return value of option or {@code null}, if option doesn't exist |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
73 |
* @throws NullPointerException if name is null |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
74 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
75 |
protected static String getVMOption(String name) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
76 |
Objects.requireNonNull(name); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
77 |
HotSpotDiagnosticMXBean diagnostic |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
78 |
= ManagementFactoryHelper.getDiagnosticMXBean(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
79 |
VMOption tmp; |
15621 | 80 |
try { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
81 |
tmp = diagnostic.getVMOption(name); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
82 |
} catch (IllegalArgumentException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
83 |
tmp = null; |
15621 | 84 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
85 |
return (tmp == null ? null : tmp.getValue()); |
15621 | 86 |
} |
87 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
88 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
89 |
* Returns value of VM option or default value. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
90 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
91 |
* @param name option's name |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
92 |
* @param defaultValue default value |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
93 |
* @return value of option or {@code defaultValue}, if option doesn't exist |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
94 |
* @throws NullPointerException if name is null |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
95 |
* @see #getVMOption(String) |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
96 |
*/ |
16367 | 97 |
protected static String getVMOption(String name, String defaultValue) { |
98 |
String result = getVMOption(name); |
|
15621 | 99 |
return result == null ? defaultValue : result; |
100 |
} |
|
101 |
||
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
102 |
/** copy of is_c1_compile(int) from utilities/globalDefinitions.hpp */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
103 |
protected static boolean isC1Compile(int compLevel) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
104 |
return (compLevel > COMP_LEVEL_NONE) |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
105 |
&& (compLevel < COMP_LEVEL_FULL_OPTIMIZATION); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
106 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
107 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
108 |
/** copy of is_c2_compile(int) from utilities/globalDefinitions.hpp */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
109 |
protected static boolean isC2Compile(int compLevel) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
110 |
return compLevel == COMP_LEVEL_FULL_OPTIMIZATION; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
111 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
112 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
113 |
/** tested method */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
114 |
protected final Executable method; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
115 |
private final Callable<Integer> callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
116 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
117 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
118 |
* Constructor. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
119 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
120 |
* @param testCase object, that contains tested method and way to invoke it. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
121 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
122 |
protected CompilerWhiteBoxTest(TestCase testCase) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
123 |
Objects.requireNonNull(testCase); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
124 |
System.out.println("TEST CASE:" + testCase.name()); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
125 |
method = testCase.executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
126 |
callable = testCase.callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
127 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
128 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
129 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
130 |
* Template method for testing. Prints tested method's info before |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
131 |
* {@linkplain #test()} and after {@linkplain #test()} or on thrown |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
132 |
* exception. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
133 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
134 |
* @throws RuntimeException if method {@linkplain #test()} throws any |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
135 |
* exception |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
136 |
* @see #test() |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
137 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
138 |
protected final void runTest() { |
15621 | 139 |
if (ManagementFactoryHelper.getCompilationMXBean() == null) { |
140 |
System.err.println( |
|
141 |
"Warning: test is not applicable in interpreted mode"); |
|
142 |
return; |
|
143 |
} |
|
144 |
System.out.println("at test's start:"); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
145 |
printInfo(); |
15621 | 146 |
try { |
147 |
test(); |
|
148 |
} catch (Exception e) { |
|
149 |
System.out.printf("on exception '%s':", e.getMessage()); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
150 |
printInfo(); |
16367 | 151 |
e.printStackTrace(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
152 |
if (e instanceof RuntimeException) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
153 |
throw (RuntimeException) e; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
154 |
} |
15621 | 155 |
throw new RuntimeException(e); |
156 |
} |
|
157 |
System.out.println("at test's end:"); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
158 |
printInfo(); |
15621 | 159 |
} |
160 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
161 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
162 |
* Checks, that {@linkplain #method} is not compiled. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
163 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
164 |
* @throws RuntimeException if {@linkplain #method} is in compiler queue or |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
165 |
* is compiled, or if {@linkplain #method} has zero |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
166 |
* compilation level. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
167 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
168 |
protected final void checkNotCompiled() { |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
169 |
if (WHITE_BOX.isMethodQueuedForCompilation(method)) { |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
170 |
throw new RuntimeException(method + " must not be in queue"); |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
171 |
} |
15621 | 172 |
if (WHITE_BOX.isMethodCompiled(method)) { |
173 |
throw new RuntimeException(method + " must be not compiled"); |
|
174 |
} |
|
175 |
if (WHITE_BOX.getMethodCompilationLevel(method) != 0) { |
|
176 |
throw new RuntimeException(method + " comp_level must be == 0"); |
|
177 |
} |
|
178 |
} |
|
179 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
180 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
181 |
* Checks, that {@linkplain #method} is compiled. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
182 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
183 |
* @throws RuntimeException if {@linkplain #method} isn't in compiler queue |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
184 |
* and isn't compiled, or if {@linkplain #method} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
185 |
* has nonzero compilation level |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
186 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
187 |
protected final void checkCompiled() { |
15621 | 188 |
final long start = System.currentTimeMillis(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
189 |
waitBackgroundCompilation(); |
15621 | 190 |
if (WHITE_BOX.isMethodQueuedForCompilation(method)) { |
191 |
System.err.printf("Warning: %s is still in queue after %dms%n", |
|
192 |
method, System.currentTimeMillis() - start); |
|
193 |
return; |
|
194 |
} |
|
195 |
if (!WHITE_BOX.isMethodCompiled(method)) { |
|
196 |
throw new RuntimeException(method + " must be compiled"); |
|
197 |
} |
|
198 |
if (WHITE_BOX.getMethodCompilationLevel(method) == 0) { |
|
199 |
throw new RuntimeException(method + " comp_level must be != 0"); |
|
200 |
} |
|
201 |
} |
|
202 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
203 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
204 |
* Waits for completion of background compilation of {@linkplain #method}. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
205 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
206 |
protected final void waitBackgroundCompilation() { |
16367 | 207 |
if (!BACKGROUND_COMPILATION) { |
208 |
return; |
|
209 |
} |
|
15621 | 210 |
final Object obj = new Object(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
211 |
for (int i = 0; i < 10 |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
212 |
&& WHITE_BOX.isMethodQueuedForCompilation(method); ++i) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
213 |
synchronized (obj) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
214 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
215 |
obj.wait(1000); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
216 |
} catch (InterruptedException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
217 |
Thread.currentThread().interrupt(); |
15621 | 218 |
} |
219 |
} |
|
220 |
} |
|
221 |
} |
|
222 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
223 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
224 |
* Prints information about {@linkplain #method}. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
225 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
226 |
protected final void printInfo() { |
15621 | 227 |
System.out.printf("%n%s:%n", method); |
228 |
System.out.printf("\tcompilable:\t%b%n", |
|
229 |
WHITE_BOX.isMethodCompilable(method)); |
|
230 |
System.out.printf("\tcompiled:\t%b%n", |
|
231 |
WHITE_BOX.isMethodCompiled(method)); |
|
232 |
System.out.printf("\tcomp_level:\t%d%n", |
|
233 |
WHITE_BOX.getMethodCompilationLevel(method)); |
|
234 |
System.out.printf("\tin_queue:\t%b%n", |
|
235 |
WHITE_BOX.isMethodQueuedForCompilation(method)); |
|
236 |
System.out.printf("compile_queues_size:\t%d%n%n", |
|
237 |
WHITE_BOX.getCompileQueuesSize()); |
|
238 |
} |
|
239 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
240 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
241 |
* Executes testing. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
242 |
*/ |
15621 | 243 |
protected abstract void test() throws Exception; |
244 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
245 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
246 |
* Tries to trigger compilation of {@linkplain #method} by call |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
247 |
* {@linkplain #callable} enough times. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
248 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
249 |
* @return accumulated result |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
250 |
* @see #compile(int) |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
251 |
*/ |
15621 | 252 |
protected final int compile() { |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
253 |
return compile(Math.max(COMPILE_THRESHOLD, 150000)); |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
254 |
} |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
255 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
256 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
257 |
* Tries to trigger compilation of {@linkplain #method} by call |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
258 |
* {@linkplain #callable} specified times. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
259 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
260 |
* @param count invocation count |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
261 |
* @return accumulated result |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
262 |
*/ |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
263 |
protected final int compile(int count) { |
15621 | 264 |
int result = 0; |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
265 |
Integer tmp; |
16367 | 266 |
for (int i = 0; i < count; ++i) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
267 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
268 |
tmp = callable.call(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
269 |
} catch (Exception e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
270 |
tmp = null; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
271 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
272 |
result += tmp == null ? 0 : tmp; |
15621 | 273 |
} |
19282
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
274 |
if (IS_VERBOSE) { |
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
275 |
System.out.println("method was invoked " + count + " times"); |
9764b5a041b6
8019915: whitebox testClearMethodStateTest fails with tiered on sparc
iignatyev
parents:
17126
diff
changeset
|
276 |
} |
15621 | 277 |
return result; |
278 |
} |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
279 |
} |
15621 | 280 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
281 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
282 |
* Utility structure containing tested method and object to invoke it. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
283 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
284 |
enum TestCase { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
285 |
/** constructor test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
286 |
CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE), |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
287 |
/** method test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
288 |
METOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE), |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
289 |
/** static method test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
290 |
STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
291 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
292 |
/** tested method */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
293 |
final Executable executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
294 |
/** object to invoke {@linkplain #executable} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
295 |
final Callable<Integer> callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
296 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
297 |
private TestCase(Executable executable, Callable<Integer> callable) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
298 |
this.executable = executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
299 |
this.callable = callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
300 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
301 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
302 |
private static class Helper { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
303 |
private static final Callable<Integer> CONSTRUCTOR_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
304 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
305 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
306 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
307 |
return new Helper(1337).hashCode(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
308 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
309 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
310 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
311 |
private static final Callable<Integer> METHOD_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
312 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
313 |
private final Helper helper = new Helper(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
314 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
315 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
316 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
317 |
return helper.method(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
318 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
319 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
320 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
321 |
private static final Callable<Integer> STATIC_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
322 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
323 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
324 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
325 |
return staticMethod(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
326 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
327 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
328 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
329 |
private static final Constructor CONSTRUCTOR; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
330 |
private static final Method METHOD; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
331 |
private static final Method STATIC; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
332 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
333 |
static { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
334 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
335 |
CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
336 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
337 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
338 |
"exception on getting method Helper.<init>(int)", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
339 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
340 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
341 |
METHOD = Helper.class.getDeclaredMethod("method"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
342 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
343 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
344 |
"exception on getting method Helper.method()", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
345 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
346 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
347 |
STATIC = Helper.class.getDeclaredMethod("staticMethod"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
348 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
349 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
350 |
"exception on getting method Helper.staticMethod()", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
351 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
352 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
353 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
354 |
private static int staticMethod() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
355 |
return 1138; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
356 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
357 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
358 |
private int method() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
359 |
return 42; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
360 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
361 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
362 |
private final int x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
363 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
364 |
public Helper() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
365 |
x = 0; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
366 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
367 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
368 |
private Helper(int x) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
369 |
this.x = x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
370 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
371 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
372 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
373 |
public int hashCode() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
374 |
return x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
375 |
} |
15621 | 376 |
} |
377 |
} |