< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page

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

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