< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page

1106   if (method->is_abstract()) {
1107     tty->print_cr("WB error: request to compile abstract method");
1108     return false;
1109   }
1110   if (comp_level > CompilationPolicy::highest_compile_level()) {
1111     tty->print_cr("WB error: invalid compilation level %d", comp_level);
1112     return false;
1113   }
1114   if (comp == nullptr) {
1115     tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1116     return false;
1117   }
1118 
1119   // Check if compilation is blocking
1120   methodHandle mh(THREAD, method);
1121   DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1122   bool is_blocking = !directive->BackgroundCompilationOption;
1123   DirectivesStack::release(directive);
1124 
1125   // Compile method and check result
1126   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh->invocation_count(), CompileTask::Reason_Whitebox, CHECK_false);
1127   MutexLocker mu(THREAD, Compile_lock);
1128   bool is_queued = mh->queued_for_compilation();
1129   if ((!is_blocking && is_queued) || nm != nullptr) {
1130     return true;
1131   }
1132   // Check code again because compilation may be finished before Compile_lock is acquired.
1133   if (bci == InvocationEntryBci) {
1134     nmethod* code = mh->code();
1135     if (code != nullptr) {
1136       return true;
1137     }
1138   } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1139     return true;
1140   }
1141   tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1142   mh->print_short_name(tty);
1143   tty->cr();
1144   if (is_blocking && is_queued) {
1145     tty->print_cr("WB error: blocking compilation is still in queue!");
1146   }

1106   if (method->is_abstract()) {
1107     tty->print_cr("WB error: request to compile abstract method");
1108     return false;
1109   }
1110   if (comp_level > CompilationPolicy::highest_compile_level()) {
1111     tty->print_cr("WB error: invalid compilation level %d", comp_level);
1112     return false;
1113   }
1114   if (comp == nullptr) {
1115     tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1116     return false;
1117   }
1118 
1119   // Check if compilation is blocking
1120   methodHandle mh(THREAD, method);
1121   DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1122   bool is_blocking = !directive->BackgroundCompilationOption;
1123   DirectivesStack::release(directive);
1124 
1125   // Compile method and check result
1126   nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh->invocation_count(), false, CompileTask::Reason_Whitebox, CHECK_false);
1127   MutexLocker mu(THREAD, Compile_lock);
1128   bool is_queued = mh->queued_for_compilation();
1129   if ((!is_blocking && is_queued) || nm != nullptr) {
1130     return true;
1131   }
1132   // Check code again because compilation may be finished before Compile_lock is acquired.
1133   if (bci == InvocationEntryBci) {
1134     nmethod* code = mh->code();
1135     if (code != nullptr) {
1136       return true;
1137     }
1138   } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1139     return true;
1140   }
1141   tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1142   mh->print_short_name(tty);
1143   tty->cr();
1144   if (is_blocking && is_queued) {
1145     tty->print_cr("WB error: blocking compilation is still in queue!");
1146   }
< prev index next >