<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">The optimization is appealing
because condy linkage is cheaper than indy linkage, and because
it would allow more sharing between identical lambdas in the
same file (they'd map to the same condy, which would only have
to be resolved once.) <br>
<br>
The main blocker was "hmm, LMF has some cornery spec issues,
before we add yet another bootstrap variant, let's look into
those". I suppose we might consider timing out on that
particular investigation and proceeding, though, if we had
evidence that the startup was improved.<br>
</font></font><br>
<div class="moz-cite-prefix">On 10/20/2023 4:29 PM, Luke Sandberg
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAEu=3GkavtwibnDHTHzQYEVdShcR4pbNftxVmW=qViQNmq83RA@mail.gmail.com">
<div dir="ltr">Classic story of development scope creep :P, thanks
for confirming.
<div><br>
</div>
<div>Experimentally, I can trigger the special case in
BootstrapMethodInvoker by just writing my own shim bootstrap
method</div>
<div><br>
</div>
<div> public static Object constantMetafactory(<br>
MethodHandles.Lookup lookup,<br>
String name,<br>
Class<?> type,<br>
MethodType samMethodType,<br>
MethodHandle implMethod,<br>
MethodType instantiatedMethodType)<br>
throws Throwable {<br>
return LambdaMetafactory.metafactory(<br>
lookup, name, methodType(type), samMethodType,
implMethod, instantiatedMethodType)<br>
.getTarget()<br>
.invoke();<br>
}</div>
<div><br>
</div>
<div>This allows me to retarget a number of invokedynamic
callsites to constant dynamic and saves a small amount of
classfile bytes.</div>
<div><br>
</div>
<div>Do you think this is a valuable optimization? I'm guessing
it would only make a difference in terms of bootstrapping..
perhaps condy is a simpler thing for the vm to manage than an
indy+constantcallsite? Or perhaps I should just assume that
since the vm engineers abandoned working on this, it wasn't
particularly valuable?</div>
<div><br>
</div>
<div>Thanks again!</div>
<div>-Luke<br>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Oct 20, 2023 at
1:14 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">brian.goetz@oracle.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> <font size="4"><font face="monospace">There was an
experiment to translate non-capturing lambdas with
condy, which was never integrated. As you observed, it
requires changes to the bootstrap method signature; when
we started adding the alternate bootstrap method, we
realized there were some cleanups in the LMF
spec/implementation we wanted to do, but these ended up
getting back-burnered. </font></font><br>
<br>
<div>On 10/20/2023 4:10 PM, Luke Sandberg wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi, as part of a custom compiler I am
working on I stumbled across <a href="https://bugs.openjdk.org/browse/JDK-8198418" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8198418</a>
which references invoking LambdaMetafactory.metafactory
from a condy instruction when there are no bound
parameters.
<div><br>
</div>
<div>I see that there is support for this in
BootstrapMethodInvoker: <a href="https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/77b2394c46bd304ffc0658cb758d971f1f2940b6/src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java*L136C28-L136C55__;Iw!!ACWV5N9M2RV99hQ!PHbe4Pn7eya4v0van9dVMyuqlhZslUbTiduzn41fBiiqs4xBqFeqHXKvIxOOmvookopXoRjoZ-JzDvY$" target="_blank" moz-do-not-send="true">https://github.com/openjdk/jdk/blob/77b2394c46bd304ffc0658cb758d971f1f2940b6/src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java#L136C28-L136C55</a></div>
<div><br>
</div>
<div>But there is no method implementing this signature
that i can find. </div>
<div><br>
</div>
<div>Is this a half implemented idea from the original
condy implementation? Or am I missing something?
Initially i thought that BootstrapMethodInvoker might
handle the signature delta, but experimentally that is
not true :D</div>
<div><br>
</div>
<div>Thanks,</div>
<div>-Luke</div>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>