< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page

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

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