[FFM performance] Intermediate buffer allocation when returning structs

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jan 28 14:57:07 UTC 2025


Hi Matthias, (cc'ing Per)
I believe we have some ideas on how to generalize the approach you used 
for speeding up the Linker, and we will follow up with more details on 
this soon.

Cheers
Maurizio

On 28/01/2025 08:32, Matthias Ernst wrote:
> #23142 has been merged, thanks a lot for the engaging low-latency 
> reviews!
>
> One thing I found interesting here: the only really satisfying 
> approaches use JDK-private apis (Carrier-TL, pinning). These apis are 
> not available to application code that will face the same issues when 
> making foreign calls. Maybe this points out a gap in the public apis 
> --- I'm still curious about possible designs here that extend carrier- 
> local critical sections (aka pinning) just enough around a native 
> call, maybe as an MH combinator.
>
> What an app has going for it, though: this matters in really tight 
> loops, and app code has much better context knowledge to provision 
> reusable buffer space outside the loop (even in a ScopedValue), at 
> which point the cost of provisioning that space will matter much less.
>
>
> On Sun, Jan 19, 2025 at 10:07 PM Matthias Ernst <matthias at mernst.org> 
> wrote:
>
>     I iterated on this a bit more and think it might be RFR:
>     https://github.com/openjdk/jdk/pull/23142
>     <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/23142__;!!ACWV5N9M2RV99hQ!JwcUbiuxva1LqZoOu8Oh6tx1wv6zSThHGxIT8pckmdCtzoKWqExZzIErlc-VX46TLQsy1AdfWgzOySRJzhXjdE7hgQ$>.
>     I dug up an old bug number that looked appropriate:
>     https://bugs.openjdk.org/browse/JDK-8287788. Let me know if you
>     want to assign it elsewhere.
>
>
>     On Fri, Jan 17, 2025 at 5:40 PM Alan Bateman
>     <alan.bateman at oracle.com> wrote:
>
>         On 17/01/2025 16:37, Jorn Vernee wrote:
>         >
>         > I've seen several similar crashes before, e.g.:
>         > https://bugs.openjdk.org/browse/JDK-8316756
>         >
>         > So, there might be some handling in the EA code missing for the
>         > pattern of nodes that the intrinsic creates.
>         >
>         >
>         I've created JDK-8347997 [1] to track the new sighting.
>
>         -Alan
>
>         [1] https://bugs.openjdk.org/browse/JDK-8347997
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20250128/57fe3780/attachment-0001.htm>


More information about the panama-dev mailing list