On Thu, 6 Apr 2023 08:05:14 GMT, ExE Boss <d...@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

Reply via email to