Mercurial > hg > truffle
diff src/share/vm/runtime/sharedRuntime.cpp @ 1135:e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
Summary: During the work for 6829187 we have fixed a number of basic bugs which are logically grouped with 6815692 and 6858164 but which must be reviewed and pushed separately.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Mon, 04 Jan 2010 18:38:08 +0100 |
parents | df6caf649ff7 |
children | dd57230ba8fe |
line wrap: on
line diff
--- a/src/share/vm/runtime/sharedRuntime.cpp Mon Jan 04 07:04:46 2010 -0800 +++ b/src/share/vm/runtime/sharedRuntime.cpp Mon Jan 04 18:38:08 2010 +0100 @@ -802,7 +802,7 @@ #ifdef ASSERT // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls - if (bc != Bytecodes::_invokestatic) { + if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { assert(receiver.not_null(), "should have thrown exception"); KlassHandle receiver_klass (THREAD, receiver->klass()); klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); @@ -1027,7 +1027,16 @@ frame stub_frame = thread->last_frame(); assert(stub_frame.is_runtime_frame(), "sanity check"); frame caller_frame = stub_frame.sender(®_map); - if (caller_frame.is_interpreted_frame() || caller_frame.is_entry_frame() ) { + + // MethodHandle invokes don't have a CompiledIC and should always + // simply redispatch to the callee_target. + address sender_pc = caller_frame.pc(); + CodeBlob* sender_cb = caller_frame.cb(); + nmethod* sender_nm = sender_cb->as_nmethod_or_null(); + + if (caller_frame.is_interpreted_frame() || + caller_frame.is_entry_frame() || + (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) { methodOop callee = thread->callee_target(); guarantee(callee != NULL && callee->is_method(), "bad handshake"); thread->set_vm_result(callee);