<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>We've been waiting for this day for a long time. Thank you for your great work!<br></div><div><br></div>Glavo</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 27, 2023 at 9:57 PM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@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">Hi all,<br>
As you know, the FFM API has been a Preview API since Java 19 [1]. The <br>
API was then re-previewed in 20 [2] and 21 [3]. Some of enhancements <br>
delivered in this timeframe were:<br>
<br>
* Unification of memory segments and memory addresses [4]<br>
* Treat arenas as "capabilities", so that memory segments can be safely <br>
shared [5, 6]<br>
* Allow for custom arenas [5, 6]<br>
* Add ways to customize linkage requests [7]<br>
* Add fallback linker, to facilitate porting FFM API to all platforms [8]<br>
<br>
We now believe that the FFM API is largely stable, and that, modulo <br>
disasters :-), it should exit preview in the next Java SE release:<br>
<br>
<a href="https://openjdk.org/jeps/8310626" rel="noreferrer" target="_blank">https://openjdk.org/jeps/8310626</a><br>
<br>
We have already started accumulating some changes in the panama <br>
repository which aim at polishing some minor edges in the API:<br>
<br>
* Add better support for "wide" native strings [9]<br>
* Make var handles derived from layouts more composable [10]<br>
* Add a linker method that can be used to discover platform-dependent <br>
mapping between C types and layouts [11]<br>
<br>
These changes are fairly minor, and should not have a big impact (if any <br>
at all) on existing code using the FFM API.<br>
<br>
Of course, the fact that FFM API is headed for finalization doesn't mean <br>
that development on FFM API will stop. There are several enhancements <br>
(aside from "regular" performance fixes) that we have been discussing <br>
over the years which can be delivered as follow-up JEPs:<br>
<br>
* Support for unsigned/complex types (needs Valhalla)<br>
* Mapping between structs and records [12]<br>
* Integration between Linker and JNI [13]<br>
* Structured arenas (depends on finalization of StructuredTaskScope) [14]<br>
* Pinning of heap segments<br>
<br>
(Of course, we have made sure that all the above enhancement can be <br>
delivered in an additive fashion, e.g. without the need to make <br>
incompatible changes to the FFM API)<br>
<br>
Finally, we'd like to thank all the developers who, over the years, have <br>
taken the time to take the API for a spin, try to build something with <br>
it and report feedback. This has been a long journey, and we wouldn't be <br>
where we are now without your help.<br>
<br>
Cheers<br>
Maurizio<br>
<br>
[1] - <a href="https://openjdk.org/jeps/424" rel="noreferrer" target="_blank">https://openjdk.org/jeps/424</a><br>
[2] - <a href="https://openjdk.org/jeps/434" rel="noreferrer" target="_blank">https://openjdk.org/jeps/434</a><br>
[3] - <a href="https://openjdk.org/jeps/442" rel="noreferrer" target="_blank">https://openjdk.org/jeps/442</a><br>
[4] - <a href="https://cr.openjdk.org/~mcimadamore/panama/segment_address.html" rel="noreferrer" target="_blank">https://cr.openjdk.org/~mcimadamore/panama/segment_address.html</a><br>
[5] - <a href="https://cr.openjdk.org/~mcimadamore/panama/session_arenas.html" rel="noreferrer" target="_blank">https://cr.openjdk.org/~mcimadamore/panama/session_arenas.html</a><br>
[6] - <a href="https://cr.openjdk.org/~mcimadamore/panama/scoped_arenas.html" rel="noreferrer" target="_blank">https://cr.openjdk.org/~mcimadamore/panama/scoped_arenas.html</a><br>
[7] - <a href="https://git.openjdk.org/panama-foreign/pull/734" rel="noreferrer" target="_blank">https://git.openjdk.org/panama-foreign/pull/734</a><br>
[8] - <a href="https://git.openjdk.org/panama-foreign/pull/770" rel="noreferrer" target="_blank">https://git.openjdk.org/panama-foreign/pull/770</a><br>
[9] - <a href="https://git.openjdk.org/panama-foreign/pull/836" rel="noreferrer" target="_blank">https://git.openjdk.org/panama-foreign/pull/836</a><br>
[10] - <a href="https://github.com/openjdk/panama-foreign/pull/840" rel="noreferrer" target="_blank">https://github.com/openjdk/panama-foreign/pull/840</a><br>
[11] - <a href="https://git.openjdk.org/panama-foreign/pull/839" rel="noreferrer" target="_blank">https://git.openjdk.org/panama-foreign/pull/839</a><br>
[12] - <a href="https://github.com/openjdk/panama-foreign/pull/833" rel="noreferrer" target="_blank">https://github.com/openjdk/panama-foreign/pull/833</a><br>
[13] - <a href="https://mail.openjdk.org/pipermail/panama-dev/2023-May/019079.html" rel="noreferrer" target="_blank">https://mail.openjdk.org/pipermail/panama-dev/2023-May/019079.html</a><br>
[14] - <a href="https://cr.openjdk.org/~mcimadamore/panama/session_arenas.html" rel="noreferrer" target="_blank">https://cr.openjdk.org/~mcimadamore/panama/session_arenas.html</a><br>
<br>
</blockquote></div>