src/share/vm/compiler/compileBroker.cpp

Print this page




1282       // In case of an exception looking up the method, we just forget
1283       // about it. The interpreter will kick-in and throw the exception.
1284       method->set_not_compilable(); // implies is_not_osr_compilable()
1285       CLEAR_PENDING_EXCEPTION;
1286       return NULL;
1287     }
1288     assert(method->has_native_function(), "must have native code by now");
1289   }
1290 
1291   // RedefineClasses() has replaced this method; just return
1292   if (method->is_old()) {
1293     return NULL;
1294   }
1295 
1296   // JVMTI -- post_compile_event requires jmethod_id() that may require
1297   // a lock the compiling thread can not acquire. Prefetch it here.
1298   if (JvmtiExport::should_post_compiled_method_load()) {
1299     method->jmethod_id();
1300   }
1301 
1302   // If the compiler is shut off due to code cache getting full
1303   // fail out now so blocking compiles dont hang the java thread
1304   if (!should_compile_new_jobs()) {
1305     CompilationPolicy::policy()->delay_compilation(method());
1306     return NULL;
1307   }
1308 
1309   // do the compilation
1310   if (method->is_native()) {
1311     if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) {
1312       // Acquire our lock.
1313       int compile_id;
1314       {
1315         MutexLocker locker(MethodCompileQueue_lock, THREAD);
1316         compile_id = assign_compile_id(method, standard_entry_bci);
1317       }
1318       (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id);
1319     } else {
1320       return NULL;
1321     }
1322   } else {







1323     compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD);
1324   }
1325 
1326   // return requested nmethod
1327   // We accept a higher level osr method
1328   return osr_bci  == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false);
1329 }
1330 
1331 
1332 // ------------------------------------------------------------------
1333 // CompileBroker::compilation_is_complete
1334 //
1335 // See if compilation of this method is already complete.
1336 bool CompileBroker::compilation_is_complete(methodHandle method,
1337                                             int          osr_bci,
1338                                             int          comp_level) {
1339   bool is_osr = (osr_bci != standard_entry_bci);
1340   if (is_osr) {
1341     if (method->is_not_osr_compilable(comp_level)) {
1342       return true;




1282       // In case of an exception looking up the method, we just forget
1283       // about it. The interpreter will kick-in and throw the exception.
1284       method->set_not_compilable(); // implies is_not_osr_compilable()
1285       CLEAR_PENDING_EXCEPTION;
1286       return NULL;
1287     }
1288     assert(method->has_native_function(), "must have native code by now");
1289   }
1290 
1291   // RedefineClasses() has replaced this method; just return
1292   if (method->is_old()) {
1293     return NULL;
1294   }
1295 
1296   // JVMTI -- post_compile_event requires jmethod_id() that may require
1297   // a lock the compiling thread can not acquire. Prefetch it here.
1298   if (JvmtiExport::should_post_compiled_method_load()) {
1299     method->jmethod_id();
1300   }
1301 







1302   // do the compilation
1303   if (method->is_native()) {
1304     if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) {
1305       // Acquire our lock.
1306       int compile_id;
1307       {
1308         MutexLocker locker(MethodCompileQueue_lock, THREAD);
1309         compile_id = assign_compile_id(method, standard_entry_bci);
1310       }
1311       (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id);
1312     } else {
1313       return NULL;
1314     }
1315   } else {
1316     // If the compiler is shut off due to code cache getting full
1317     // fail out now so blocking compiles dont hang the java thread
1318     if (!should_compile_new_jobs()) {
1319       CompilationPolicy::policy()->delay_compilation(method());
1320       return NULL;
1321     }
1322 
1323     compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD);
1324   }
1325 
1326   // return requested nmethod
1327   // We accept a higher level osr method
1328   return osr_bci  == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false);
1329 }
1330 
1331 
1332 // ------------------------------------------------------------------
1333 // CompileBroker::compilation_is_complete
1334 //
1335 // See if compilation of this method is already complete.
1336 bool CompileBroker::compilation_is_complete(methodHandle method,
1337                                             int          osr_bci,
1338                                             int          comp_level) {
1339   bool is_osr = (osr_bci != standard_entry_bci);
1340   if (is_osr) {
1341     if (method->is_not_osr_compilable(comp_level)) {
1342       return true;