As for the refinements mentioned in JEP454

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jun 10 09:45:44 UTC 2024


Hi, some answers below:

(1) refers to the ability to query what primitive layouts are like, 
using Linker::canonicalLayouts.
See: 
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html#canonicalLayouts()

(2) refers to the new methods in MemoryLayout, namely 
MemoryLayout::scale/scaleHandle, together with the fact that now all var 
handles generated by this API take a start offset (so they are easier to 
combine).
see: 
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html#canonicalLayouts()

(3) refers to the fact that you can now read and write strings with more 
charsets than just UTF8. You can now use any charset in StandardCharsets 
(to which we have added UTF32, for good measure).
see: 
https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemorySegment.html#getString(long,java.nio.charset.Charset)

Maurizio


On 07/06/2024 23:30, Cheng Jin wrote:
>
> Hi there,
>
> I’ve got a question about JEP454 at https://openjdk.org/jeps/454 in 
> which some of refinements confused me as follows:
>
>  1. /Enabled clients to build C-language function descriptors
>     programmatically, avoiding platform-specific constants;/
>  2. /Improved support for variable-length arrays in native memory;/
>  3. /Added support for arbitrary charsets for native strings./
>
> I didn’t find any description in the JEP to clarify how they work and 
> what they mean to users.
>
> Could anybody explain these refinements in more details? Many thanks.
>
> Best Regards
>
> Cheng
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240610/84f76b11/attachment-0001.htm>


More information about the panama-dev mailing list