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

Roger Riggs rriggs at openjdk.org
Thu Apr 6 13:41:26 UTC 2023


On Thu, 6 Apr 2023 08:05:14 GMT, ExE Boss <duke at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/util/Architecture.java line 85:
>> 
>>> 83:      */
>>> 84:     @ForceInline
>>> 85:     public static boolean isRISCV64() {
>> 
>> Are all the "isers" necessary to provide constant code folding or is the samt thing achievable via expressions like `(Architecture.current() == Architecture.X)` ?
>
> `Architecture.current()` requires the `Architecture.archValues` array to be annotated with `@jdk.internal.vm.annotation.Stable` for it to be constant foldable by the JIT.

The `isXXX` is lighterweight and easier to read.  
With current compiler technology, it can result in dead code elimination.
The HotSpot compiler reduces `(Architecture.current() == Architecture.X)` at runtime.  
Project Leyden may enable dead code based on evaluating more complex expressions as above.

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

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



More information about the client-libs-dev mailing list