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