-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b24
-
Verified
The FFM API exposes layout constants for Java primitives. Among those there are constants for JAVA_LONG and JAVA_DOUBLE.
Currently, the alignment of these layouts is set the same as their size (e.g. 8 bytes).
This is obviously correct on 64-bit platforms, but on 32-bit platform it is not, as such platforms cannot guarantee that doubles and longs will be always 64-bit aligned. This will also result in problems when trying to use e.g. JAVA_DOUBLE to model a C double for the linker API on 32-bit platforms.
For these reasons, it would be preferable to define the alignment of JAVA_LONG and JAVA_DOUBLE constants as ADDRESS.byteSize().
Currently, the alignment of these layouts is set the same as their size (e.g. 8 bytes).
This is obviously correct on 64-bit platforms, but on 32-bit platform it is not, as such platforms cannot guarantee that doubles and longs will be always 64-bit aligned. This will also result in problems when trying to use e.g. JAVA_DOUBLE to model a C double for the linker API on 32-bit platforms.
For these reasons, it would be preferable to define the alignment of JAVA_LONG and JAVA_DOUBLE constants as ADDRESS.byteSize().
- csr for
-
JDK-8308273 Revisit alignment of layout constants on 32-bit platforms
-
- Closed
-
- duplicates
-
JDK-8255350 MemoryLayout and 32-bit VMs: should long[]/double[] be 4-byte aligned?
-
- Closed
-