changeset 51427:ca4eea543d23

8205400: [Graal] compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java fails with can't be enqueued for compilation on level 4 Summary: add -XX:-BackgroundCompilation to tests to eager initialize JVMCI Reviewed-by: thartmann
author kvn
date Tue, 26 Jun 2018 09:14:49 -0700
parents 59306e5a6cc7
children 0ab1cac936b8
files src/hotspot/share/prims/whitebox.cpp test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java test/hotspot/jtreg/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java
diffstat 3 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/prims/whitebox.cpp	Tue Jun 26 11:14:27 2018 -0400
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Jun 26 09:14:49 2018 -0700
@@ -855,7 +855,16 @@
 bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
   // Screen for unavailable/bad comp level or null method
   AbstractCompiler* comp = CompileBroker::compiler(comp_level);
-  if (method == NULL || comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier) || comp == NULL) {
+  if (method == NULL) {
+    tty->print_cr("WB error: request to compile NULL method");
+    return false;
+  }
+  if (comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
+    tty->print_cr("WB error: invalid compilation level %d", comp_level);
+    return false;
+  }
+  if (comp == NULL) {
+    tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
     return false;
   }
 
@@ -868,7 +877,17 @@
   // Compile method and check result
   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, THREAD);
   MutexLockerEx mu(Compile_lock);
-  return ((!is_blocking && mh->queued_for_compilation()) || nm != NULL);
+  bool is_queued = mh->queued_for_compilation();
+  if ((!is_blocking && is_queued) || nm != NULL) {
+    return true;
+  }
+  tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
+  mh->print_short_name(tty);
+  tty->cr();
+  if (is_blocking && is_queued) {
+    tty->print_cr("WB error: blocking compilation is still in queue!");
+  }
+  return false;
 }
 
 WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Tue Jun 26 11:14:27 2018 -0400
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Tue Jun 26 09:14:49 2018 -0700
@@ -41,6 +41,7 @@
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *                   -XX:-BackgroundCompilation
  *                   compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
  */
 
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Tue Jun 26 11:14:27 2018 -0400
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Tue Jun 26 09:14:49 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *                   -XX:-BackgroundCompilation
  *                   compiler.jvmci.compilerToVM.ExecuteInstalledCodeTest
  */