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