JDK-8308276 : Change layout API to work with bytes, not bits
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.foreign
  • Affected Version: 21
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-05-17
  • Updated: 2023-08-04
  • Resolved: 2023-05-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b24Fixed
Related Reports
CSR :  
Relates :  
Description
The MemoryLayout API uses bits to model the size of a region of memory. This design was inspired by the Minimal LDL calculus:

https://cr.openjdk.org/~jrose/panama/minimal-ldl.html

This calculus had the objective of unifying memory layouts with register layouts - for this reason bit sizes were chosen. In the FFM API, however, memory layouts are used primarily to describe regions of memory. Also, the FFM API has another API, namely MemorySegment, whose sizes are expressed in bytes (not bits), and that is something that would be hard to change, because we want to provide an easy upgrade path for clients currently using the ByteBuffer API (which uses byte-based absolute offsets).

For these reasons, I think it is time to bring memory layout in sync with memory segment, so that their sizes are expressed in bytes.
Comments
Changeset: 5fc9b578 Author: Maurizio Cimadamore <mcimadamore@openjdk.org> Date: 2023-05-22 14:57:00 +0000 URL: https://git.openjdk.org/jdk/commit/5fc9b5787dc4d7f00d2c59288bc8d840fdf5b495
22-05-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14013 Date: 2023-05-16 13:53:32 +0000
17-05-2023