Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 1200:ba263cfb7611
6917766: JSR 292 needs its own deopt handler
Summary: We need to introduce a new MH deopt handler so we can easily determine if the deopt happened at a MH call site or not.
Reviewed-by: never, jrose
author | twisti |
---|---|
date | Fri, 29 Jan 2010 12:13:05 +0100 |
parents | cf0685d550f1 |
children | 24128c2ffa87 |
comparison
equal
deleted
inserted
replaced
1199:0e14bd797dad | 1200:ba263cfb7611 |
---|---|
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 } | |
1036 | 1046 |
1037 if (caller_frame.is_interpreted_frame() || | 1047 if (caller_frame.is_interpreted_frame() || |
1038 caller_frame.is_entry_frame() || | 1048 caller_frame.is_entry_frame() || |
1039 (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) { | 1049 is_mh_invoke_via_adapter) { |
1040 methodOop callee = thread->callee_target(); | 1050 methodOop callee = thread->callee_target(); |
1041 guarantee(callee != NULL && callee->is_method(), "bad handshake"); | 1051 guarantee(callee != NULL && callee->is_method(), "bad handshake"); |
1042 thread->set_vm_result(callee); | 1052 thread->set_vm_result(callee); |
1043 thread->set_callee_target(NULL); | 1053 thread->set_callee_target(NULL); |
1044 return callee->get_c2i_entry(); | 1054 return callee->get_c2i_entry(); |
1415 CodeBlob* callee = CodeCache::find_blob(destination); | 1425 CodeBlob* callee = CodeCache::find_blob(destination); |
1416 // callee == cb seems weird. It means calling interpreter thru stub. | 1426 // callee == cb seems weird. It means calling interpreter thru stub. |
1417 if (callee == cb || callee->is_adapter_blob()) { | 1427 if (callee == cb || callee->is_adapter_blob()) { |
1418 // static call or optimized virtual | 1428 // static call or optimized virtual |
1419 if (TraceCallFixup) { | 1429 if (TraceCallFixup) { |
1420 tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); | 1430 tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1421 moop->print_short_name(tty); | 1431 moop->print_short_name(tty); |
1422 tty->print_cr(" to " INTPTR_FORMAT, entry_point); | 1432 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1423 } | 1433 } |
1424 call->set_destination_mt_safe(entry_point); | 1434 call->set_destination_mt_safe(entry_point); |
1425 } else { | 1435 } else { |
1431 // assert is too strong could also be resolve destinations. | 1441 // assert is too strong could also be resolve destinations. |
1432 // assert(InlineCacheBuffer::contains(destination) || VtableStubs::contains(destination), "must be"); | 1442 // assert(InlineCacheBuffer::contains(destination) || VtableStubs::contains(destination), "must be"); |
1433 } | 1443 } |
1434 } else { | 1444 } else { |
1435 if (TraceCallFixup) { | 1445 if (TraceCallFixup) { |
1436 tty->print("already patched callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); | 1446 tty->print("already patched callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); |
1437 moop->print_short_name(tty); | 1447 moop->print_short_name(tty); |
1438 tty->print_cr(" to " INTPTR_FORMAT, entry_point); | 1448 tty->print_cr(" to " INTPTR_FORMAT, entry_point); |
1439 } | 1449 } |
1440 } | 1450 } |
1441 } | 1451 } |