Inlining of MethodHandles chain possible/planned?

Szymon Jachim sjachim at gmail.com
Wed May 18 03:34:49 PDT 2011


I have to questions to you guys about possible (and planned) JIT
optimizations for MethodHandles.

1. Assuming that there will be a chain of MH's:
      mh1(invoker) -> mh2 -> aMethod()
   and there will be no other references to mh2. Will JIT/GC be able to
optimize unneeded mh2 and put into callsites a direct call to aMethod?

2. Assuming second situation:
  mh1(dynamicInvoker() product) -> MutableCallSite -> mh2(constant()
product) -> integer constant
After calculating the constant value and doing setTarget() there will be no
longer any other references to MCS and mh2, so MCS is effectively
immutable. Will they get optimized away and/or garbage collected?

This could be useful to implement efficient lazy initialized data
structures. The call site cannot be ConstantCallSite, becouse the value is
calculated in runtime by a non static methods...

I think this is similar problem to what Headius described here recently.

Thanks,
Szymon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20110518/5f4d14dd/attachment.html 


More information about the mlvm-dev mailing list