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