Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191998

C2: inlining through MH linkers drops speculative part of argument types

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 13
    • 9, 10, 11, 12, 13
    • hotspot
    • b06

    Description

      CallGenerator::for_method_handle_inline() casts MH linker (MH::linkTo*) arguments before attempting inlining. If any argument has a speculative type attached, it is lost.

      CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
      ...
        case vmIntrinsics::_linkToVirtual:
        case vmIntrinsics::_linkToStatic:
        case vmIntrinsics::_linkToSpecial:
        case vmIntrinsics::_linkToInterface:
      ...
              // Cast reference arguments to its type.
              for (int i = 0, j = 0; i < signature->count(); i++) {
                ciType* t = signature->type_at(i);
                if (t->is_klass()) {
                  Node* arg = kit.argument(receiver_skip + j);
                  const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
                  const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
                  if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
                    Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
                    kit.set_argument(receiver_skip + j, cast_obj);
                  }
                }
                j += t->size(); // long and double take two slots
              }

      Attachments

        Issue Links

          Activity

            People

              vlivanov Vladimir Ivanov
              vlivanov Vladimir Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: