Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/prims/methodHandleWalk.cpp
          +++ new/src/share/vm/prims/methodHandleWalk.cpp
↓ open down ↓ 623 lines elided ↑ open up ↑
 624  624    (void) _constants.append(NULL);
 625  625  
 626  626    // Set name and signature index.
 627  627    _name_index      = cpool_symbol_put(_callee->name());
 628  628    _signature_index = cpool_symbol_put(_callee->signature());
 629  629  
 630  630    // Get return type klass.
 631  631    Handle first_mtype(THREAD, chain().method_type_oop());
 632  632    // _rklass is NULL for primitives.
 633  633    _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass);
      634 +  if (_rtype == T_ARRAY)  _rtype = T_OBJECT;
 634  635  
 635  636    int params = _callee->size_of_parameters();  // Incoming arguments plus receiver.
 636  637    _num_params = for_invokedynamic() ? params - 1 : params;  // XXX Check if callee is static?
 637  638  }
 638  639  
 639  640  
 640  641  // -----------------------------------------------------------------------------
 641  642  // MethodHandleCompiler::compile
 642  643  //
 643  644  // Compile this MethodHandle into a bytecode adapter and return a
↓ open down ↓ 306 lines elided ↑ open up ↑
 950  951                                    TRAPS) {
 951  952    if (m == NULL) {
 952  953      // Get the intrinsic methodOop.
 953  954      m = vmIntrinsics::method_for(iid);
 954  955    }
 955  956  
 956  957    klassOop  klass     = m->method_holder();
 957  958    symbolOop name      = m->name();
 958  959    symbolOop signature = m->signature();
 959  960  
 960      -  // This generated adapter method should be in the same class as the
 961      -  // DMH target method (for accessability reasons).
 962  961    if (tailcall) {
 963      -    _target_klass = klass;
      962 +    // Actually, in order to make these methods more recognizable,
      963 +    // let's put them in holder classes MethodHandle and InvokeDynamic.
      964 +    // That way stack walkers and compiler heuristics can recognize them.
      965 +    _target_klass = (for_invokedynamic()
      966 +                     ? SystemDictionary::InvokeDynamic_klass()
      967 +                     : SystemDictionary::MethodHandle_klass());
 964  968    }
 965  969  
 966  970    // instanceKlass* ik = instanceKlass::cast(klass);
 967  971    // tty->print_cr("MethodHandleCompiler::make_invoke: %s %s.%s%s", Bytecodes::name(op), ik->external_name(), name->as_C_string(), signature->as_C_string());
 968  972  
 969  973    // Inline the method.
 970  974    InvocationCounter* ic = m->invocation_counter();
 971  975    ic->set_carry();
 972  976  
 973  977    for (int i = 0; i < argc; i++) {
↓ open down ↓ 36 lines elided ↑ open up ↑
1010 1014    case Bytecodes::_invokeinterface:
1011 1015      Unimplemented();
1012 1016      break;
1013 1017    default:
1014 1018      ShouldNotReachHere();
1015 1019    }
1016 1020  
1017 1021    // If tailcall, we have walked all the way to a direct method handle.
1018 1022    // Otherwise, make a recursive call to some helper routine.
1019 1023    BasicType rbt = m->result_type();
     1024 +  if (rbt == T_ARRAY)  rbt = T_OBJECT;
1020 1025    ArgToken ret;
1021 1026    if (tailcall) {
1022 1027      if (rbt != _rtype) {
1023 1028        if (rbt == T_VOID) {
1024 1029          // push a zero of the right sort
1025 1030          ArgToken zero;
1026 1031          if (_rtype == T_OBJECT) {
1027 1032            zero = make_oop_constant(NULL, CHECK_(zero));
1028 1033          } else {
1029 1034            zero = make_prim_constant(_rtype, &zero_jvalue, CHECK_(zero));
↓ open down ↓ 367 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX