Boxing, still a limit of invokedynamic?
Rémi Forax
forax at univ-mlv.fr
Sun May 13 23:55:48 PDT 2012
On 05/13/2012 10:21 PM, Jochen Theodorou wrote:
> Am 13.05.2012 19:55, schrieb Rémi Forax:
> [...]
>> I think currently Groovy allows to replace + by a method
>> that will return everything you want.
>> But here, I think the spec of Groovy (if it means something)
>> should be changed to say that when your replace a method
>> by another, the return type must be a subtype of the
>> existing method.
> that helps if the argument types are known and there is an exact match
> to a method. It helps because in that case we can save the casting and
> converting plus the checks to see if we even have to do that. Yes. But
> currently that is not the case. And it won't change for Groovy2, maybe
> for a later Groovy.
>
> [...]
>> Object -> int is not equivalent to Object -> Integer -> int,
>> it can be Object -> Byte -> int by example.
>> You have to chain several calls to asType()
>>
>> see slide 20 of my jvm summit talk last year,
>> http://wiki.jvmlangsummit.com/images/9/93/2011_Forax.pdf
> so you mean to tell me that I have first to convert the Object to an
> Integer and that Integer to int, instead of directly converting the
> Object to an int? I see, I will try that out.
Yes.
You should not have to do that because you first check if the
parameter is an Integer but currently the VM doesn't propagate
this information.
(there is a patch for that, but not yet integrated)
Also, it should be faster before the JIT is kicked in.
>
> bye Jochen
cheers,
Rémi
More information about the mlvm-dev
mailing list