< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page

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

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