ping ?

Rémi

On 12/30/2014 08:48 PM, Remi Forax wrote:
Hi guys,
I've found a bug in the interaction between the lambda form and inlining algorithm, basically if the inlining heuristic bailout because the method is recursive and already inlined once, instead to emit a code to do a direct call, it revert to do call to linkStatic with the method
as MemberName.

I think it's a regression because before the introduction of lambda forms,
I'm pretty sure that the JIT was emitting a direct call.

Step to reproduce with nashorn, run this JavaScript code
function fibo(n) {
  return (n < 2)? 1: fibo(n - 1) + fibo(n - 2)
}

print(fibo(45))

like this:
/usr/jdk/jdk1.9.0/bin/jjs -J-XX:+UnlockDiagnosticVMOptions -J-XX:+PrintAssembly fibo.js > log.txt

look for a method 'fibo' from the tail of the log, you will find something like this:

0x00007f97e4b4743f: mov $0x76d08f770,%r8 ; {oop(a 'java/lang/invoke/MemberName' = {method} {0x00007f97dcff8e40} 'fibo' '(Ljdk/nashorn/internal/runtime/ScriptFunction;Ljava/lang/Object;I)I' in 'jdk/nashorn/internal/scripts/Script$Recompilation$2$fibo')}
  0x00007f97e4b47449: xchg   %ax,%ax
  0x00007f97e4b4744b: callq  0x00007f97dd0446e0

I hope this can be fixed. My demonstration that I can have fibo written with a dynamic language
that run as fast as written in Java doesn't work anymore :(

cheers,
Rémi

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to