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
_______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev