Skip to content

Commit 432d962

Browse files
committed
8048003: test/compiler/8009761/Test8009761.java failed with: java.lang.RuntimeException: static java.lang.Object Test8009761.m3(boolean,boolean) not compiled
Compile m3 with C1 if C2 is not available. Backport-of: b4d4c8a3922f6563013d4e997e149bd0198222d2
1 parent 42c6c17 commit 432d962

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

hotspot/test/compiler/8009761/Test8009761.java

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
* questions.
2222
*/
2323

24-
import com.sun.management.HotSpotDiagnosticMXBean;
25-
import com.sun.management.VMOption;
2624
import sun.hotspot.WhiteBox;
27-
import sun.management.ManagementFactoryHelper;
28-
2925
import java.lang.reflect.Method;
3026

3127
/*
@@ -41,6 +37,7 @@
4137
public class Test8009761 {
4238

4339
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
40+
private static int COMP_LEVEL_SIMPLE = 1;
4441
private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
4542
private static Method m3 = null;
4643

@@ -237,7 +234,7 @@ static Object m3(boolean overflow_stack, boolean deopt) {
237234

238235
static public void main(String[] args) {
239236
// Make sure background compilation is disabled
240-
if (backgroundCompilationEnabled()) {
237+
if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {
241238
throw new RuntimeException("Background compilation enabled");
242239
}
243240

@@ -257,7 +254,11 @@ static public void main(String[] args) {
257254
c1 = count;
258255

259256
// Force the compilation of m3() that will inline m1()
260-
WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION);
257+
if(!WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION)) {
258+
// C2 compiler not available, compile with C1
259+
WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_SIMPLE);
260+
}
261+
261262
// Because background compilation is disabled, method should now be compiled
262263
if(!WHITE_BOX.isMethodCompiled(m3)) {
263264
throw new RuntimeException(m3 + " not compiled");
@@ -279,19 +280,4 @@ static public void main(String[] args) {
279280
System.out.println("PASSED " + c1);
280281
}
281282
}
282-
283-
/**
284-
* Checks if background compilation (-XX:+BackgroundCompilation) is enabled.
285-
* @return True if background compilation is enabled, false otherwise
286-
*/
287-
private static boolean backgroundCompilationEnabled() {
288-
HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
289-
VMOption backgroundCompilation;
290-
try {
291-
backgroundCompilation = diagnostic.getVMOption("BackgroundCompilation");
292-
} catch (IllegalArgumentException e) {
293-
return false;
294-
}
295-
return Boolean.valueOf(backgroundCompilation.getValue());
296-
}
297283
}

0 commit comments

Comments
 (0)