review for 7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters

Tom Rodriguez tom.rodriguez at
Tue Jun 14 10:54:31 PDT 2011

On Jun 14, 2011, at 10:28 AM, Rémi Forax wrote:

> On 06/14/2011 07:11 PM, Tom Rodriguez wrote:
>> I also included a minor fix to skip unneeded interface checkcasts.
> Not sure you have the right to do that with the current state of the JSR292 spec.
> But I think the spec should be changed on that peculiar point.

I'm making it consistent with another place in MethodHandleWalk where this is done:

          klassOop rklass = java_lang_Class::as_klassOop( java_lang_invoke_MethodType::rtype(recursive_mtype()) );
          if (rklass != SystemDictionary::Object_klass() &&
              !Klass::cast(rklass)->is_interface()) {
            // preserve type safety                                                                                                                  
            ret = make_conversion(T_OBJECT, rklass, Bytecodes::_checkcast, ret, CHECK_(empty));

Note that this is code that is used to build bytecode equivalents of MethodHandle chains for compilation.  As far as I can tell the MethodHandles proper don't have any of these casts in place as part of the fold/collect logic so I'm a little unclear why they are being emitted in the first place.  checkcast MethodHandles are handled completely separately and not affected by this change.  Anyway, John suggested the change in the first place so he can probably better speak to their correctness.


> Rémi

More information about the hotspot-compiler-dev mailing list