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

Glavo duke at openjdk.org
Sat Apr 15 17:23:43 UTC 2023


On Wed, 12 Apr 2023 17:31:49 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:
> 
>   Fixed isPPC64().
>   Consolidated switch cases in ArchTest.
>   Moved mapping of build TARGET_OS and TARGET_CPU to the build
>   to avoid multiple mappings in more than one place.

The RISC-V 64 part look good, `ArchTest` has passed on Debian RISC-V 64.

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

> 68:             case "x86", "i386" -> X86;
> 69:             case "aarch64" -> AARCH64;
> 70:             case "riscv64" -> RISCV64;  // unverified

Suggestion:

            case "riscv64" -> RISCV64;

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

Marked as reviewed by Glavo at github.com (no known OpenJDK username).

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



More information about the client-libs-dev mailing list