[FFM performance] Intermediate buffer allocation when returning structs

Matthias Ernst matthias at mernst.org
Tue Jan 28 08:32:20 UTC 2025


#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. 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/cbb53e68/attachment.htm>


More information about the panama-dev mailing list