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