diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index a4b1d0ece6d..01038b879ab 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -920,14 +920,19 @@ WB_ENTRY(jboolean, WB_IsIntrinsicAvailable(JNIEnv* env, jobject o, jobject metho if (compLevel < CompLevel_none || compLevel > CompilationPolicy::highest_compile_level()) { return false; // Intrinsic is not available on a non-existent compilation level. } + AbstractCompiler* comp = CompileBroker::compiler((int)compLevel); + if (comp == nullptr) { + // Could have compLevel == 0, or !TieredCompilation and incompatible values of TieredStopAtLevel and compLevel. + tty->print_cr("WB error: no compiler for requested compilation level %d", compLevel); + return false; + } + jmethodID method_id, compilation_context_id; method_id = reflected_method_to_jmid(thread, env, method); CHECK_JNI_EXCEPTION_(env, JNI_FALSE); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(method_id)); DirectiveSet* directive; - AbstractCompiler* comp = CompileBroker::compiler((int)compLevel); - assert(comp != nullptr, "compiler not available"); if (compilation_context != nullptr) { compilation_context_id = reflected_method_to_jmid(thread, env, compilation_context); CHECK_JNI_EXCEPTION_(env, JNI_FALSE);