RFR: 8304915: Create jdk.internal.util.Architecture enum and apply [v9]

Martin Doerr mdoerr at openjdk.org
Tue Apr 11 10:18:44 UTC 2023


On Sat, 8 Apr 2023 18:00:53 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Define an internal jdk.internal.util.Architecture enumeration and static methods to replace uses of the system property `os.arch`.
>> The enumeration values are defined to match those used in the build.
>> The initial values are: `X64, X86, AARCH64, RISCV64, S390, PPC64`
>> Note that `amd64` and `x86_64` in the build are represented by `X64`.
>> The value of the system property `os.arch` is unchanged.
>> 
>> The API is similar to the jdk.internal.util.OperatingSystem enum created by #[12931](https://git.openjdk.org/jdk/pull/12931).
>> Uses in `java.base` and a few others are included but other modules will be done in separate PRs.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove unused static and import of Stabile

Would be great if you could support "os.arch = ppc64" for AIX and legacy linux, too.

test/jdk/jdk/internal/util/ArchTest.java line 128:

> 126:             case RISCV64 -> true;
> 127:             case S390 -> false;
> 128:             case PPC64 -> true;

This is not always true. The PPC64 architecture supports both endianness versions. AIX and legacy linux is Big Endian while recent linux is little Endian (determined by platform name "os.arch = ppc64le" instead of "os.arch = ppc64"). Querying the endianness is also possible, of course.

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

Changes requested by mdoerr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13357#pullrequestreview-1378905956
PR Review Comment: https://git.openjdk.org/jdk/pull/13357#discussion_r1162600674


More information about the serviceability-dev mailing list