< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page

1083   if (method->is_abstract()) {
1084     tty->print_cr("WB error: request to compile abstract method");
1085     return false;
1086   }
1087   if (comp_level > CompilationPolicy::highest_compile_level()) {
1088     tty->print_cr("WB error: invalid compilation level %d", comp_level);
1089     return false;
1090   }
1091   if (comp == nullptr) {
1092     tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1093     return false;
1094   }
1095 
1096   // Check if compilation is blocking
1097   methodHandle mh(THREAD, method);
1098   DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1099   bool is_blocking = !directive->BackgroundCompilationOption;
1100   DirectivesStack::release(directive);
1101 
1102   // Compile method and check result
1103   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, CHECK_false);
1104   MutexLocker mu(THREAD, Compile_lock);
1105   bool is_queued = mh->queued_for_compilation();
1106   if ((!is_blocking && is_queued) || nm != nullptr) {
1107     return true;
1108   }
1109   // Check code again because compilation may be finished before Compile_lock is acquired.
1110   if (bci == InvocationEntryBci) {
1111     nmethod* code = mh->code();
1112     if (code != nullptr) {
1113       return true;
1114     }
1115   } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1116     return true;
1117   }
1118   tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1119   mh->print_short_name(tty);
1120   tty->cr();
1121   if (is_blocking && is_queued) {
1122     tty->print_cr("WB error: blocking compilation is still in queue!");
1123   }

1083   if (method->is_abstract()) {
1084     tty->print_cr("WB error: request to compile abstract method");
1085     return false;
1086   }
1087   if (comp_level > CompilationPolicy::highest_compile_level()) {
1088     tty->print_cr("WB error: invalid compilation level %d", comp_level);
1089     return false;
1090   }
1091   if (comp == nullptr) {
1092     tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1093     return false;
1094   }
1095 
1096   // Check if compilation is blocking
1097   methodHandle mh(THREAD, method);
1098   DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1099   bool is_blocking = !directive->BackgroundCompilationOption;
1100   DirectivesStack::release(directive);
1101 
1102   // Compile method and check result
1103   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), false, CompileTask::Reason_Whitebox, CHECK_false);
1104   MutexLocker mu(THREAD, Compile_lock);
1105   bool is_queued = mh->queued_for_compilation();
1106   if ((!is_blocking && is_queued) || nm != nullptr) {
1107     return true;
1108   }
1109   // Check code again because compilation may be finished before Compile_lock is acquired.
1110   if (bci == InvocationEntryBci) {
1111     nmethod* code = mh->code();
1112     if (code != nullptr) {
1113       return true;
1114     }
1115   } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1116     return true;
1117   }
1118   tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1119   mh->print_short_name(tty);
1120   tty->cr();
1121   if (is_blocking && is_queued) {
1122     tty->print_cr("WB error: blocking compilation is still in queue!");
1123   }
< prev index next >