comparison 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
comparison
equal deleted inserted replaced
1134:0910903272e5 1135:e66fd840cb6b
800 assert (receiver.is_null() || receiver->is_oop(), "wrong receiver"); 800 assert (receiver.is_null() || receiver->is_oop(), "wrong receiver");
801 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); 801 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
802 802
803 #ifdef ASSERT 803 #ifdef ASSERT
804 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls 804 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
805 if (bc != Bytecodes::_invokestatic) { 805 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) {
806 assert(receiver.not_null(), "should have thrown exception"); 806 assert(receiver.not_null(), "should have thrown exception");
807 KlassHandle receiver_klass (THREAD, receiver->klass()); 807 KlassHandle receiver_klass (THREAD, receiver->klass());
808 klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); 808 klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
809 // klass is already loaded 809 // klass is already loaded
810 KlassHandle static_receiver_klass (THREAD, rk); 810 KlassHandle static_receiver_klass (THREAD, rk);
1025 // safepoint is possible and have trouble gc'ing the compiled args. 1025 // safepoint is possible and have trouble gc'ing the compiled args.
1026 RegisterMap reg_map(thread, false); 1026 RegisterMap reg_map(thread, false);
1027 frame stub_frame = thread->last_frame(); 1027 frame stub_frame = thread->last_frame();
1028 assert(stub_frame.is_runtime_frame(), "sanity check"); 1028 assert(stub_frame.is_runtime_frame(), "sanity check");
1029 frame caller_frame = stub_frame.sender(&reg_map); 1029 frame caller_frame = stub_frame.sender(&reg_map);
1030 if (caller_frame.is_interpreted_frame() || caller_frame.is_entry_frame() ) { 1030
1031 // MethodHandle invokes don't have a CompiledIC and should always
1032 // simply redispatch to the callee_target.
1033 address sender_pc = caller_frame.pc();
1034 CodeBlob* sender_cb = caller_frame.cb();
1035 nmethod* sender_nm = sender_cb->as_nmethod_or_null();
1036
1037 if (caller_frame.is_interpreted_frame() ||
1038 caller_frame.is_entry_frame() ||
1039 (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) {
1031 methodOop callee = thread->callee_target(); 1040 methodOop callee = thread->callee_target();
1032 guarantee(callee != NULL && callee->is_method(), "bad handshake"); 1041 guarantee(callee != NULL && callee->is_method(), "bad handshake");
1033 thread->set_vm_result(callee); 1042 thread->set_vm_result(callee);
1034 thread->set_callee_target(NULL); 1043 thread->set_callee_target(NULL);
1035 return callee->get_c2i_entry(); 1044 return callee->get_c2i_entry();