diff --git a/src/java.base/share/classes/jdk/internal/util/Architecture.java b/src/java.base/share/classes/jdk/internal/util/Architecture.java index e0c16b655f9..1c5cb36d7e2 100644 --- a/src/java.base/share/classes/jdk/internal/util/Architecture.java +++ b/src/java.base/share/classes/jdk/internal/util/Architecture.java @@ -52,7 +52,8 @@ public enum Architecture { PPC64(64, ByteOrder.BIG_ENDIAN), PPC64LE(64, ByteOrder.LITTLE_ENDIAN), MIPSEL(32, ByteOrder.LITTLE_ENDIAN), - MIPS64EL(64, ByteOrder.LITTLE_ENDIAN) + MIPS64EL(64, ByteOrder.LITTLE_ENDIAN), + SPARCV9(64, ByteOrder.BIG_ENDIAN), ; private final int addrSize; @@ -202,6 +203,14 @@ public enum Architecture { return PlatformProps.TARGET_ARCH_IS_MIPS64EL; } + /** + * {@return {@code true} if the current architecture is SPARCV9} + */ + @ForceInline + public static boolean isSPARCV9() { + return PlatformProps.TARGET_ARCH_IS_SPARCV9; + } + /** * {@return the current architecture} */ diff --git a/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template b/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template index d5f0b601bc8..d4d300322a4 100644 --- a/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template +++ b/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template @@ -63,4 +63,5 @@ class PlatformProps { static final boolean TARGET_ARCH_IS_PPC64LE = "@@OPENJDK_TARGET_CPU@@" == "ppc64le"; static final boolean TARGET_ARCH_IS_MIPSEL = "@@OPENJDK_TARGET_CPU@@" == "mipsel"; static final boolean TARGET_ARCH_IS_MIPS64EL= "@@OPENJDK_TARGET_CPU@@" == "mips64el"; + static final boolean TARGET_ARCH_IS_SPARCV9 = "@@OPENJDK_TARGET_CPU@@" == "sparcv9"; } diff --git a/test/jdk/jdk/internal/util/ArchTest.java b/test/jdk/jdk/internal/util/ArchTest.java index 281721a7bbf..f75b2bb8801 100644 --- a/test/jdk/jdk/internal/util/ArchTest.java +++ b/test/jdk/jdk/internal/util/ArchTest.java @@ -39,6 +39,7 @@ import static jdk.internal.util.Architecture.X64; import static jdk.internal.util.Architecture.X86; import static jdk.internal.util.Architecture.MIPSEL; import static jdk.internal.util.Architecture.MIPS64EL; +import static jdk.internal.util.Architecture.SPARCV9; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -85,6 +86,7 @@ public class ArchTest { Arguments.of("riscv64", RISCV64, 64, ByteOrder.LITTLE_ENDIAN, Architecture.isRISCV64()), Arguments.of("s390", S390, 64, ByteOrder.BIG_ENDIAN, Architecture.isS390()), Arguments.of("s390x", S390, 64, ByteOrder.BIG_ENDIAN, Architecture.isS390()), + Arguments.of("sparcv9", SPARCV9, 64, ByteOrder.BIG_ENDIAN, Architecture.isSPARCV9()), Arguments.of("x64", X64, 64, ByteOrder.LITTLE_ENDIAN, Architecture.isX64()), Arguments.of("x86", X86, 32, ByteOrder.LITTLE_ENDIAN, Architecture.isX86()), Arguments.of("x86_64", X64, 64, ByteOrder.LITTLE_ENDIAN, Architecture.isX64())