src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893081 Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.cpp

Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch


 785 
 786     methodHandle callee = bytecode->static_target(CHECK_(nullHandle));
 787     if (callee.is_null()) {
 788       THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle);
 789     }
 790     // Retrieve from a compiled argument list
 791     receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2));
 792 
 793     if (receiver.is_null()) {
 794       THROW_(vmSymbols::java_lang_NullPointerException(), nullHandle);
 795     }
 796   }
 797 
 798   // Resolve method. This is parameterized by bytecode.
 799   constantPoolHandle constants (THREAD, caller->constants());
 800   assert (receiver.is_null() || receiver->is_oop(), "wrong receiver");
 801   LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
 802 
 803 #ifdef ASSERT
 804   // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
 805   if (bc != Bytecodes::_invokestatic) {
 806     assert(receiver.not_null(), "should have thrown exception");
 807     KlassHandle receiver_klass (THREAD, receiver->klass());
 808     klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
 809                             // klass is already loaded
 810     KlassHandle static_receiver_klass (THREAD, rk);
 811     assert(receiver_klass->is_subtype_of(static_receiver_klass()), "actual receiver must be subclass of static receiver klass");
 812     if (receiver_klass->oop_is_instance()) {
 813       if (instanceKlass::cast(receiver_klass())->is_not_initialized()) {
 814         tty->print_cr("ERROR: Klass not yet initialized!!");
 815         receiver_klass.print();
 816       }
 817       assert (!instanceKlass::cast(receiver_klass())->is_not_initialized(), "receiver_klass must be initialized");
 818     }
 819   }
 820 #endif
 821 
 822   return receiver;
 823 }
 824 
 825 methodHandle SharedRuntime::find_callee_method(JavaThread* thread, TRAPS) {


1010   assert(callee_method->verified_code_entry() != NULL, " Jump to zero!");
1011   return callee_method->verified_code_entry();
1012 JRT_END
1013 
1014 
1015 // Handle call site that has been made non-entrant
1016 JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method(JavaThread* thread))
1017   // 6243940 We might end up in here if the callee is deoptimized
1018   // as we race to call it.  We don't want to take a safepoint if
1019   // the caller was interpreted because the caller frame will look
1020   // interpreted to the stack walkers and arguments are now
1021   // "compiled" so it is much better to make this transition
1022   // invisible to the stack walking code. The i2c path will
1023   // place the callee method in the callee_target. It is stashed
1024   // there because if we try and find the callee by normal means a
1025   // safepoint is possible and have trouble gc'ing the compiled args.
1026   RegisterMap reg_map(thread, false);
1027   frame stub_frame = thread->last_frame();
1028   assert(stub_frame.is_runtime_frame(), "sanity check");
1029   frame caller_frame = stub_frame.sender(&reg_map);
1030   if (caller_frame.is_interpreted_frame() || caller_frame.is_entry_frame() ) {









1031     methodOop callee = thread->callee_target();
1032     guarantee(callee != NULL && callee->is_method(), "bad handshake");
1033     thread->set_vm_result(callee);
1034     thread->set_callee_target(NULL);
1035     return callee->get_c2i_entry();
1036   }
1037 
1038   // Must be compiled to compiled path which is safe to stackwalk
1039   methodHandle callee_method;
1040   JRT_BLOCK
1041     // Force resolving of caller (if we called from compiled frame)
1042     callee_method = SharedRuntime::reresolve_call_site(thread, CHECK_NULL);
1043     thread->set_vm_result(callee_method());
1044   JRT_BLOCK_END
1045   // return compiled code entry point after potential safepoints
1046   assert(callee_method->verified_code_entry() != NULL, " Jump to zero!");
1047   return callee_method->verified_code_entry();
1048 JRT_END
1049 
1050 




 785 
 786     methodHandle callee = bytecode->static_target(CHECK_(nullHandle));
 787     if (callee.is_null()) {
 788       THROW_(vmSymbols::java_lang_NoSuchMethodException(), nullHandle);
 789     }
 790     // Retrieve from a compiled argument list
 791     receiver = Handle(THREAD, callerFrame.retrieve_receiver(&reg_map2));
 792 
 793     if (receiver.is_null()) {
 794       THROW_(vmSymbols::java_lang_NullPointerException(), nullHandle);
 795     }
 796   }
 797 
 798   // Resolve method. This is parameterized by bytecode.
 799   constantPoolHandle constants (THREAD, caller->constants());
 800   assert (receiver.is_null() || receiver->is_oop(), "wrong receiver");
 801   LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
 802 
 803 #ifdef ASSERT
 804   // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
 805   if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) {
 806     assert(receiver.not_null(), "should have thrown exception");
 807     KlassHandle receiver_klass (THREAD, receiver->klass());
 808     klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
 809                             // klass is already loaded
 810     KlassHandle static_receiver_klass (THREAD, rk);
 811     assert(receiver_klass->is_subtype_of(static_receiver_klass()), "actual receiver must be subclass of static receiver klass");
 812     if (receiver_klass->oop_is_instance()) {
 813       if (instanceKlass::cast(receiver_klass())->is_not_initialized()) {
 814         tty->print_cr("ERROR: Klass not yet initialized!!");
 815         receiver_klass.print();
 816       }
 817       assert (!instanceKlass::cast(receiver_klass())->is_not_initialized(), "receiver_klass must be initialized");
 818     }
 819   }
 820 #endif
 821 
 822   return receiver;
 823 }
 824 
 825 methodHandle SharedRuntime::find_callee_method(JavaThread* thread, TRAPS) {


1010   assert(callee_method->verified_code_entry() != NULL, " Jump to zero!");
1011   return callee_method->verified_code_entry();
1012 JRT_END
1013 
1014 
1015 // Handle call site that has been made non-entrant
1016 JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method(JavaThread* thread))
1017   // 6243940 We might end up in here if the callee is deoptimized
1018   // as we race to call it.  We don't want to take a safepoint if
1019   // the caller was interpreted because the caller frame will look
1020   // interpreted to the stack walkers and arguments are now
1021   // "compiled" so it is much better to make this transition
1022   // invisible to the stack walking code. The i2c path will
1023   // place the callee method in the callee_target. It is stashed
1024   // there because if we try and find the callee by normal means a
1025   // safepoint is possible and have trouble gc'ing the compiled args.
1026   RegisterMap reg_map(thread, false);
1027   frame stub_frame = thread->last_frame();
1028   assert(stub_frame.is_runtime_frame(), "sanity check");
1029   frame caller_frame = stub_frame.sender(&reg_map);
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))) {
1040     methodOop callee = thread->callee_target();
1041     guarantee(callee != NULL && callee->is_method(), "bad handshake");
1042     thread->set_vm_result(callee);
1043     thread->set_callee_target(NULL);
1044     return callee->get_c2i_entry();
1045   }
1046 
1047   // Must be compiled to compiled path which is safe to stackwalk
1048   methodHandle callee_method;
1049   JRT_BLOCK
1050     // Force resolving of caller (if we called from compiled frame)
1051     callee_method = SharedRuntime::reresolve_call_site(thread, CHECK_NULL);
1052     thread->set_vm_result(callee_method());
1053   JRT_BLOCK_END
1054   // return compiled code entry point after potential safepoints
1055   assert(callee_method->verified_code_entry() != NULL, " Jump to zero!");
1056   return callee_method->verified_code_entry();
1057 JRT_END
1058 
1059 


src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File