Few questions about invokeDynamic

Rémi Forax forax at univ-mlv.fr
Tue Nov 9 09:08:15 PST 2010


Le 09/11/2010 17:20, Christian Thalinger a écrit :
> On Nov 9, 2010, at 4:25 PM, Rémi Forax wrote:
>    
>> Le 09/11/2010 14:57, Christian Thalinger a écrit :
>>      
>>> On Nov 9, 2010, at 11:43 AM, Rémi Forax wrote:
>>>
>>>        
>>>>   So a workaround for that bug is to declare the return type of
>>>> invokedynamic
>>>> to be not void but by example int.
>>>>
>>>>          
>>> The fix is trivial but I'd like to implemented to other missing
>>> pieces
>>> too, like int-to-float conversion and friends.
>>>
>>> Remi, could you tell me how I can produce AMHs that do such
>>> conversions (on the return type)?
>>>
>>>        
>> Here is an example.
>>    If indy has no parameter, it tests void ->  indy return type
>>    If indy has one parameter, it test parameter type ->  return type
>>    If indy name is "spread", a spread/collect is done.
>>
>> Rémi
>>
>> PS: With the new API, all identity methods but the one that take no
>> parameter
>> can be removed and replace by Methodhandles.identity() in the BSM.
>>      
>
> Thanks, that helps a lot!  But the int ->  float/double stuff does not
> work:
>
> Exception in thread "main" java.lang.ClassCastException:
> java.lang.Integer cannot be cast to java.lang.Float
>           at
> sun.dyn.util.ValueConversions.unboxFloat(ValueConversions.java:85)
>           at sun.dyn.ToGeneric$Adapter.return_F(ToGeneric.java:399)
>           at sun.dyn.ToGeneric$A1.invoke_F(ToGeneric.java:649)
>           at ConvertTest.main(ConvertTest.java:48)
>
> -- Christian
>
> PS: I hate when the mailing list server is so slow...
>    

Yes, I have seen that.
In my opinion, the bug is not in my code but in Java classes of package 
sun.dyn.

Rémi



More information about the mlvm-dev mailing list