Skip to content

Commit

Permalink
8315579: SPARC64 builds are broken after JDK-8304913
Browse files Browse the repository at this point in the history
Reviewed-by: rriggs, phh
  • Loading branch information
shipilev committed Sep 6, 2023
1 parent f6c203e commit cfc1489
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/java.base/share/classes/jdk/internal/util/Architecture.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -202,6 +203,14 @@ public static boolean isMIPS64EL() {
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}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
2 changes: 2 additions & 0 deletions test/jdk/jdk/internal/util/ArchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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;
Expand Down Expand Up @@ -85,6 +86,7 @@ private static Stream<Arguments> archParams() {
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())
Expand Down

1 comment on commit cfc1489

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.