RFR: 8308452: Extend internal Architecture enum with byte order and address size
Alan Bateman
alanb at openjdk.org
Wed May 24 16:31:03 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.
Mapping the arch to endianness seems okay for the current ports but I could imagine needing to re-visit that at some point.
src/java.base/share/classes/jdk/internal/util/Architecture.java line 38:
> 36: */
> 37: public enum Architecture {
> 38: OTHER(0, null), // An unknown architecture not specifically named
ByteOrder.nativeOrder() might be a better default for unknown archs.
src/java.base/share/classes/jdk/internal/util/OperatingSystem.java line 140:
> 138: */
> 139: /* package-private */
> 140: static String toUpperCase(String str) {
A bit icky to have OperatingSystem to expose a static method to convert Strings as it's nothing to do with OperatingSystem, is there anywhere else?
-------------
PR Review: https://git.openjdk.org/jdk/pull/14063#pullrequestreview-1442315684
PR Review Comment: https://git.openjdk.org/jdk/pull/14063#discussion_r1204472688
PR Review Comment: https://git.openjdk.org/jdk/pull/14063#discussion_r1204477269
More information about the core-libs-dev
mailing list