bug in MacroAssembler::check_method_handle_type for x86

John Rose john.r.rose at oracle.com
Mon Apr 9 17:40:29 PDT 2012


The internal invokers like invokeBasic are intended to link only for erased types (that is, Object is the only ref type).

Only invoke[Generic] and invokeExact can have the full range of signatures.

This should be error-checked in SystemDictionary::find_method_handle_invoke or a similar place.  I.e., if there is a bytecode generation bug, the JVM should throw a link error earlier.

— John

On Apr 2, 2012, at 7:45 AM, Christian Thalinger wrote:

> 
> On Mar 29, 2012, at 7:25 PM, Christian Thalinger wrote:
> 
>> 
>> On Mar 28, 2012, at 7:31 PM, John Rose wrote:
>> 
>>> On Mar 21, 2012, at 8:17 AM, Christian Thalinger wrote:
>>> 
>>>> John, I think there is a bug in MacroAssembler::check_method_handle_type for x86 (with meth-lazy):
>>> 
>>> That's correct.  Thanks for noticing it; I'll push a fix.  — John
>> 
>> The weird thing is that when I implement it correctly on SPARC I get:
>> 
>> MH _invokeBasic mh=0x00000007ab4a4fc0 saved_sp=0xffffffff7dcfb681 args=0xffffffff7dcfbf40
>> MethodHandle:(Ltest/java/lang/invoke/MethodHandlesTest$HasFields;)Z : #( *** unrecognized MH type }
>> =============== DEBUG MESSAGE: _invokeBasic ================
>> 
>> But it worked with the broken version.
> 
> Today I tried this again and it also fails on x86 (seems I didn't update the VM the last time).  I think the reason for this is that we also have to load the basicType of mtype and compare these two:
> 
>    // fetch mtype.form.basicType                                                                                                           
>    load_heap_oop(Address(mtype_reg, delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes,          temp3_reg)), temp2_reg);     
>    load_heap_oop(Address(temp2_reg, delayed_value(java_lang_invoke_MethodTypeForm::basicType_offset_in_bytes, temp3_reg)), temp2_reg);     
>    // fetch mh.type.form.basicType                                                                                                         
>    load_heap_oop(Address(temp_reg,  delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes,          temp3_reg)), temp_reg);      
>    load_heap_oop(Address(temp_reg,  delayed_value(java_lang_invoke_MethodTypeForm::basicType_offset_in_bytes, temp3_reg)), temp_reg);      
>    cmp_and_brx_short(temp_reg, temp2_reg, Assembler::notEqual, Assembler::pn, wrong_method_type);                                         
> 
> Correct?
> 
> -- Chris
> 
>> 
>> -- Chris
>> 
>>> _______________________________________________
>>> mlvm-dev mailing list
>>> mlvm-dev at openjdk.java.net
>>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>> 
>> _______________________________________________
>> mlvm-dev mailing list
>> mlvm-dev at openjdk.java.net
>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
> 
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev



More information about the mlvm-dev mailing list