Invokedynamic and recursive method call

Remi Forax forax at univ-mlv.fr
Sat Jan 31 22:54:46 UTC 2015


Thank you,
Vladimir !

Rémi

On 01/30/2015 04:07 PM, Vladimir Ivanov wrote:
> Remi, thanks for the report!
>
> Filed JDK-8072008 [1].
>
> Best regards,
> Vladimir Ivanov
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8072008
>
> On 1/30/15 4:03 AM, Remi Forax wrote:
>>
>> On 01/30/2015 01:48 AM, John Rose wrote:
>>> On Jan 7, 2015, at 8:13 AM, Remi Forax <forax at univ-mlv.fr
>>> <mailto:forax at univ-mlv.fr>> wrote:
>>>>
>>>> But if fibo is called through an invokedynamic, instead of emitting a
>>>> direct call to fibo,
>>>> the JIT generates a code that push the method handle on stack and
>>>> execute it
>>>> like if the metod handle was not constant
>>>> (the method handle is constant because the call at depth=1 is 
>>>> inlined !).
>>>
>>> Invocation of non-constant MH's had a performance regression with the
>>> LF-based implementation.
>>> As of JDK-8069591 they should be no slower and sometimes faster than
>>> the old implementation.
>>> — John
>>>
>>
>> In my case, the method handle is constant (I think it's also the case
>> when you write fibo in javascript).
>> At depth=1, the call is correctly inlined.
>> At depth=2, the call is not inlined because it's a recursive call and by
>> default hotspot only inline recursive call once,
>> this is normal behavior. The bug is that instead of doing a call (using
>> the call assembly instruction),
>> the JIT pushes the method handle on stack and do an invokebasic, which
>> is slower.
>>
>> Rémi
>>
>>
>>
>> _______________________________________________
>> 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