1124 if (method->is_abstract()) {
1125 tty->print_cr("WB error: request to compile abstract method");
1126 return false;
1127 }
1128 if (comp_level > CompilationPolicy::highest_compile_level()) {
1129 tty->print_cr("WB error: invalid compilation level %d", comp_level);
1130 return false;
1131 }
1132 if (comp == nullptr) {
1133 tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1134 return false;
1135 }
1136
1137 // Check if compilation is blocking
1138 methodHandle mh(THREAD, method);
1139 DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1140 bool is_blocking = !directive->BackgroundCompilationOption;
1141 DirectivesStack::release(directive);
1142
1143 // Compile method and check result
1144 nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh->invocation_count(), CompileTask::Reason_Whitebox, CHECK_false);
1145 MutexLocker mu(THREAD, Compile_lock);
1146 bool is_queued = mh->queued_for_compilation();
1147 if ((!is_blocking && is_queued) || nm != nullptr) {
1148 return true;
1149 }
1150 // Check code again because compilation may be finished before Compile_lock is acquired.
1151 if (bci == InvocationEntryBci) {
1152 nmethod* code = mh->code();
1153 if (code != nullptr) {
1154 return true;
1155 }
1156 } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1157 return true;
1158 }
1159 tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1160 mh->print_short_name(tty);
1161 tty->cr();
1162 if (is_blocking && is_queued) {
1163 tty->print_cr("WB error: blocking compilation is still in queue!");
1164 }
|
1124 if (method->is_abstract()) {
1125 tty->print_cr("WB error: request to compile abstract method");
1126 return false;
1127 }
1128 if (comp_level > CompilationPolicy::highest_compile_level()) {
1129 tty->print_cr("WB error: invalid compilation level %d", comp_level);
1130 return false;
1131 }
1132 if (comp == nullptr) {
1133 tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
1134 return false;
1135 }
1136
1137 // Check if compilation is blocking
1138 methodHandle mh(THREAD, method);
1139 DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
1140 bool is_blocking = !directive->BackgroundCompilationOption;
1141 DirectivesStack::release(directive);
1142
1143 // Compile method and check result
1144 nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh->invocation_count(), false, CompileTask::Reason_Whitebox, CHECK_false);
1145 MutexLocker mu(THREAD, Compile_lock);
1146 bool is_queued = mh->queued_for_compilation();
1147 if ((!is_blocking && is_queued) || nm != nullptr) {
1148 return true;
1149 }
1150 // Check code again because compilation may be finished before Compile_lock is acquired.
1151 if (bci == InvocationEntryBci) {
1152 nmethod* code = mh->code();
1153 if (code != nullptr) {
1154 return true;
1155 }
1156 } else if (mh->lookup_osr_nmethod_for(bci, comp_level, false) != nullptr) {
1157 return true;
1158 }
1159 tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
1160 mh->print_short_name(tty);
1161 tty->cr();
1162 if (is_blocking && is_queued) {
1163 tty->print_cr("WB error: blocking compilation is still in queue!");
1164 }
|