1031 // MethodHandle invokes don't have a CompiledIC and should always |
1031 // MethodHandle invokes don't have a CompiledIC and should always |
1032 // simply redispatch to the callee_target. |
1032 // simply redispatch to the callee_target. |
1033 address sender_pc = caller_frame.pc(); |
1033 address sender_pc = caller_frame.pc(); |
1034 CodeBlob* sender_cb = caller_frame.cb(); |
1034 CodeBlob* sender_cb = caller_frame.cb(); |
1035 nmethod* sender_nm = sender_cb->as_nmethod_or_null(); |
1035 nmethod* sender_nm = sender_cb->as_nmethod_or_null(); |
1036 bool is_mh_invoke_via_adapter = false; // Direct c2c call or via adapter? |
|
1037 if (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc)) { |
|
1038 // If the callee_target is set, then we have come here via an i2c |
|
1039 // adapter. |
|
1040 methodOop callee = thread->callee_target(); |
|
1041 if (callee != NULL) { |
|
1042 assert(callee->is_method(), "sanity"); |
|
1043 is_mh_invoke_via_adapter = true; |
|
1044 } |
|
1045 } |
|
1046 |
1036 |
1047 if (caller_frame.is_interpreted_frame() || |
1037 if (caller_frame.is_interpreted_frame() || |
1048 caller_frame.is_entry_frame() || |
1038 caller_frame.is_entry_frame() || |
1049 is_mh_invoke_via_adapter) { |
1039 (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) { |
1050 methodOop callee = thread->callee_target(); |
1040 methodOop callee = thread->callee_target(); |
1051 guarantee(callee != NULL && callee->is_method(), "bad handshake"); |
1041 guarantee(callee != NULL && callee->is_method(), "bad handshake"); |
1052 thread->set_vm_result(callee); |
1042 thread->set_vm_result(callee); |
1053 thread->set_callee_target(NULL); |
1043 thread->set_callee_target(NULL); |
1054 return callee->get_c2i_entry(); |
1044 return callee->get_c2i_entry(); |
1425 CodeBlob* callee = CodeCache::find_blob(destination); |
1415 CodeBlob* callee = CodeCache::find_blob(destination); |
1426 // callee == cb seems weird. It means calling interpreter thru stub. |
1416 // callee == cb seems weird. It means calling interpreter thru stub. |
1427 if (callee == cb || callee->is_adapter_blob()) { |
1417 if (callee == cb || callee->is_adapter_blob()) { |
1428 // static call or optimized virtual |
1418 // static call or optimized virtual |
1429 if (TraceCallFixup) { |
1419 if (TraceCallFixup) { |
1430 tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1420 tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1431 moop->print_short_name(tty); |
1421 moop->print_short_name(tty); |
1432 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1422 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1433 } |
1423 } |
1434 call->set_destination_mt_safe(entry_point); |
1424 call->set_destination_mt_safe(entry_point); |
1435 } else { |
1425 } else { |
1441 // assert is too strong could also be resolve destinations. |
1431 // assert is too strong could also be resolve destinations. |
1442 // assert(InlineCacheBuffer::contains(destination) || VtableStubs::contains(destination), "must be"); |
1432 // assert(InlineCacheBuffer::contains(destination) || VtableStubs::contains(destination), "must be"); |
1443 } |
1433 } |
1444 } else { |
1434 } else { |
1445 if (TraceCallFixup) { |
1435 if (TraceCallFixup) { |
1446 tty->print("already patched callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1436 tty->print("already patched callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1447 moop->print_short_name(tty); |
1437 moop->print_short_name(tty); |
1448 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1438 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1449 } |
1439 } |
1450 } |
1440 } |
1451 } |
1441 } |