Invokedynamic and recursive method call

Remi Forax forax at univ-mlv.fr
Fri Jan 30 01:03:03 UTC 2015


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20150130/5353400a/attachment.html>


More information about the mlvm-dev mailing list