src/share/vm/prims/methodHandleWalk.cpp

changeset 1587
cd37471eaecc
parent 1577
4ce7240d622c
child 1862
cd5dbf694d45
     1.1 --- a/src/share/vm/prims/methodHandleWalk.cpp	Thu Jan 07 16:26:31 2010 -0800
     1.2 +++ b/src/share/vm/prims/methodHandleWalk.cpp	Fri Jan 08 11:09:46 2010 +0100
     1.3 @@ -631,6 +631,7 @@
     1.4    Handle first_mtype(THREAD, chain().method_type_oop());
     1.5    // _rklass is NULL for primitives.
     1.6    _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass);
     1.7 +  if (_rtype == T_ARRAY)  _rtype = T_OBJECT;
     1.8  
     1.9    int params = _callee->size_of_parameters();  // Incoming arguments plus receiver.
    1.10    _num_params = for_invokedynamic() ? params - 1 : params;  // XXX Check if callee is static?
    1.11 @@ -957,10 +958,13 @@
    1.12    symbolOop name      = m->name();
    1.13    symbolOop signature = m->signature();
    1.14  
    1.15 -  // This generated adapter method should be in the same class as the
    1.16 -  // DMH target method (for accessability reasons).
    1.17    if (tailcall) {
    1.18 -    _target_klass = klass;
    1.19 +    // Actually, in order to make these methods more recognizable,
    1.20 +    // let's put them in holder classes MethodHandle and InvokeDynamic.
    1.21 +    // That way stack walkers and compiler heuristics can recognize them.
    1.22 +    _target_klass = (for_invokedynamic()
    1.23 +                     ? SystemDictionary::InvokeDynamic_klass()
    1.24 +                     : SystemDictionary::MethodHandle_klass());
    1.25    }
    1.26  
    1.27    // instanceKlass* ik = instanceKlass::cast(klass);
    1.28 @@ -1017,6 +1021,7 @@
    1.29    // If tailcall, we have walked all the way to a direct method handle.
    1.30    // Otherwise, make a recursive call to some helper routine.
    1.31    BasicType rbt = m->result_type();
    1.32 +  if (rbt == T_ARRAY)  rbt = T_OBJECT;
    1.33    ArgToken ret;
    1.34    if (tailcall) {
    1.35      if (rbt != _rtype) {

mercurial