RFR: 8308452: Extend internal Architecture enum with byte order and address size

Martin Doerr mdoerr at openjdk.org
Wed May 24 15:08:11 UTC 2023


On Fri, 19 May 2023 19:19:40 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> The internal enum jdk.internal.util.Architecture does not provide information about the big or little endianness or the address size (64 or 32 bits).  The endian-ness and address size are intrinsic to the architecture.
> 
> The values of the enum are extended to separately identify the big endian and little-endian uses of the ISA.
> For example, `PPC64` and `PPC64LE` for the big and little-endian versions.  
> The enum values directly reflect the build-time artifacts and resulting executables.
> 
> This information about an architecture will make the enum more useful especially to identify a target platform in a cross-platform use case. A method is added to map well known aliases for the platforms to the Architecture enum.

I think this makes sense. Thanks for working on it! Most architectures have a fixed endianness.
For PPC64, I think using PPC64LE is fine to distinguish as it is a common name.
Another architecture which supports both endianness flavors is IA64. HPUX is big endian and linux little endian. I don't know how this should be handled. Fortunately, I don't think we need to support IA64. :-)

src/java.base/share/classes/jdk/internal/util/Architecture.java line 42:

> 40:     X86(32, ByteOrder.LITTLE_ENDIAN),
> 41:     AARCH64(64, ByteOrder.LITTLE_ENDIAN),
> 42:     ARM(64, ByteOrder.LITTLE_ENDIAN),

ARM should be 32 bit.

-------------

PR Review: https://git.openjdk.org/jdk/pull/14063#pullrequestreview-1435010016
PR Review Comment: https://git.openjdk.org/jdk/pull/14063#discussion_r1199316006


More information about the core-libs-dev mailing list