< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page




1353 
1354 // Resolves a call.  The compilers generate code for calls that go here
1355 // and are patched with the real destination of the call.
1356 methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
1357                                                bool is_virtual,
1358                                                bool is_optimized, TRAPS) {
1359 
1360   ResourceMark rm(thread);
1361   RegisterMap cbl_map(thread, false);
1362   frame caller_frame = thread->last_frame().sender(&cbl_map);
1363 
1364   CodeBlob* caller_cb = caller_frame.cb();
1365   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
1366   CompiledMethod* caller_nm = caller_cb->as_compiled_method_or_null();
1367 
1368   // make sure caller is not getting deoptimized
1369   // and removed before we are done with it.
1370   // CLEANUP - with lazy deopt shouldn't need this lock
1371   nmethodLocker caller_lock(caller_nm);
1372 










1373   // determine call info & receiver
1374   // note: a) receiver is NULL for static calls
1375   //       b) an exception is thrown if receiver is NULL for non-static calls
1376   CallInfo call_info;
1377   Bytecodes::Code invoke_code = Bytecodes::_illegal;
1378   Handle receiver = find_callee_info(thread, invoke_code,
1379                                      call_info, CHECK_(methodHandle()));
1380   methodHandle callee_method = call_info.selected_method();
1381 
1382   assert((!is_virtual && invoke_code == Bytecodes::_invokestatic ) ||
1383          (!is_virtual && invoke_code == Bytecodes::_invokespecial) ||
1384          (!is_virtual && invoke_code == Bytecodes::_invokehandle ) ||
1385          (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
1386          ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
1387 
1388   assert(caller_nm->is_alive() && !caller_nm->is_unloading(), "It should be alive");
1389 
1390 #ifndef PRODUCT
1391   // tracing/debugging/statistics
1392   int *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :




1353 
1354 // Resolves a call.  The compilers generate code for calls that go here
1355 // and are patched with the real destination of the call.
1356 methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
1357                                                bool is_virtual,
1358                                                bool is_optimized, TRAPS) {
1359 
1360   ResourceMark rm(thread);
1361   RegisterMap cbl_map(thread, false);
1362   frame caller_frame = thread->last_frame().sender(&cbl_map);
1363 
1364   CodeBlob* caller_cb = caller_frame.cb();
1365   guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method");
1366   CompiledMethod* caller_nm = caller_cb->as_compiled_method_or_null();
1367 
1368   // make sure caller is not getting deoptimized
1369   // and removed before we are done with it.
1370   // CLEANUP - with lazy deopt shouldn't need this lock
1371   nmethodLocker caller_lock(caller_nm);
1372 
1373   if (!is_virtual && !is_optimized) {
1374     SimpleScopeDesc ssd(caller_nm, caller_frame.pc());
1375     Bytecode bc(ssd.method(), ssd.method()->bcp_from(ssd.bci()));
1376     // Substituability test implementation piggy backs on static call resolution
1377     if (bc.code() == Bytecodes::_if_acmpeq || bc.code() == Bytecodes::_if_acmpne) {
1378       SystemDictionary::ValueBootstrapMethods_klass()->initialize(CHECK_NULL);
1379       return SystemDictionary::ValueBootstrapMethods_klass()->find_method(vmSymbols::isSubstitutable_name(), vmSymbols::object_object_boolean_signature());
1380     }
1381   }
1382 
1383   // determine call info & receiver
1384   // note: a) receiver is NULL for static calls
1385   //       b) an exception is thrown if receiver is NULL for non-static calls
1386   CallInfo call_info;
1387   Bytecodes::Code invoke_code = Bytecodes::_illegal;
1388   Handle receiver = find_callee_info(thread, invoke_code,
1389                                      call_info, CHECK_(methodHandle()));
1390   methodHandle callee_method = call_info.selected_method();
1391 
1392   assert((!is_virtual && invoke_code == Bytecodes::_invokestatic ) ||
1393          (!is_virtual && invoke_code == Bytecodes::_invokespecial) ||
1394          (!is_virtual && invoke_code == Bytecodes::_invokehandle ) ||
1395          (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
1396          ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
1397 
1398   assert(caller_nm->is_alive() && !caller_nm->is_unloading(), "It should be alive");
1399 
1400 #ifndef PRODUCT
1401   // tracing/debugging/statistics
1402   int *addr = (is_optimized) ? (&_resolve_opt_virtual_ctr) :


< prev index next >