Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/runtime/sharedRuntime.cpp
          +++ new/src/share/vm/runtime/sharedRuntime.cpp
↓ open down ↓ 794 lines elided ↑ open up ↑
 795  795      }
 796  796    }
 797  797  
 798  798    // Resolve method. This is parameterized by bytecode.
 799  799    constantPoolHandle constants (THREAD, caller->constants());
 800  800    assert (receiver.is_null() || receiver->is_oop(), "wrong receiver");
 801  801    LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
 802  802  
 803  803  #ifdef ASSERT
 804  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  806      assert(receiver.not_null(), "should have thrown exception");
 807  807      KlassHandle receiver_klass (THREAD, receiver->klass());
 808  808      klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
 809  809                              // klass is already loaded
 810  810      KlassHandle static_receiver_klass (THREAD, rk);
 811  811      assert(receiver_klass->is_subtype_of(static_receiver_klass()), "actual receiver must be subclass of static receiver klass");
 812  812      if (receiver_klass->oop_is_instance()) {
 813  813        if (instanceKlass::cast(receiver_klass())->is_not_initialized()) {
 814  814          tty->print_cr("ERROR: Klass not yet initialized!!");
 815  815          receiver_klass.print();
↓ open down ↓ 204 lines elided ↑ open up ↑
1020 1020    // interpreted to the stack walkers and arguments are now
1021 1021    // "compiled" so it is much better to make this transition
1022 1022    // invisible to the stack walking code. The i2c path will
1023 1023    // place the callee method in the callee_target. It is stashed
1024 1024    // there because if we try and find the callee by normal means a
1025 1025    // safepoint is possible and have trouble gc'ing the compiled args.
1026 1026    RegisterMap reg_map(thread, false);
1027 1027    frame stub_frame = thread->last_frame();
1028 1028    assert(stub_frame.is_runtime_frame(), "sanity check");
1029 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 1040      methodOop callee = thread->callee_target();
1032 1041      guarantee(callee != NULL && callee->is_method(), "bad handshake");
1033 1042      thread->set_vm_result(callee);
1034 1043      thread->set_callee_target(NULL);
1035      -    return callee->get_c2i_entry();
     1044 +    return callee->from_compiled_entry();
1036 1045    }
1037 1046  
1038 1047    // Must be compiled to compiled path which is safe to stackwalk
1039 1048    methodHandle callee_method;
1040 1049    JRT_BLOCK
1041 1050      // Force resolving of caller (if we called from compiled frame)
1042 1051      callee_method = SharedRuntime::reresolve_call_site(thread, CHECK_NULL);
1043 1052      thread->set_vm_result(callee_method());
1044 1053    JRT_BLOCK_END
1045 1054    // return compiled code entry point after potential safepoints
↓ open down ↓ 1283 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX