Implementing Lambda with Capture support makes Metaspace fills LambdaForms$BMH class

John Rose john.r.rose at oracle.com
Thu May 4 06:16:35 UTC 2017


On May 3, 2017, at 9:37 PM, Wenlei Xie <wenlei.xie at gmail.com> wrote:
> 
> Thank you Vladimir for the help ! I see the point why MH.bindTo() is not a good fit for implementing lambda capturing. 

A simple rule for using MHs is that they are designed to be another form of code.
Creating many of them at a high rate is likely to stress JVM in ways similar
to loading many small classes at a high rate.

So bindTo is really code customization, which is not the same thing as data capture.
The MH before bindTo is an algorithm with a variable "hole" in it, where the MH after
bindTo is a customized version of the algorithm, with the hole filed by a constant.
It's a little like a C++ template instance.

I'd like high-count bindTo to be cheaper, of course, but it's not the design center,
and it's not where we are investing optimization effort.  Maybe in the future.

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20170503/70dcb88b/attachment-0001.html>


More information about the mlvm-dev mailing list