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

ExE Boss duke at openjdk.org
Tue Apr 11 19:53:46 UTC 2023


On Tue, 11 Apr 2023 18:35:56 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:
> 
>   Add ppc64 as mapping to PPC64 Architecture

src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template line 58:

> 56:         return switch (archName) {
> 57:             case "x86_64" -> "x64";
> 58:             case "ppc64", "ppc64le" -> "ppc64";

There’s no `case "s390" -> "s390"`, so this is also extraneous:
Suggestion:

            case "ppc64le" -> "ppc64";


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

The `case "ppc64"` was supposed to be added to `ArchTest.java`.

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

> 72:             case "riscv64" -> RISCV64;  // unverified
> 73:             case "s390x", "s390" -> S390;  // unverified
> 74:             case "ppc64le" -> PPC64;  // unverified

Suggestion:

            case "ppc64", "ppc64le" -> PPC64;  // unverified

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13357#discussion_r1163257592
PR Review Comment: https://git.openjdk.org/jdk/pull/13357#discussion_r1163257861


More information about the serviceability-dev mailing list