Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.
/ jdk21 Public archive

Commit e0cc401

Browse files
author
Roger Riggs
committed
8310019: MIPS builds are broken after JDK-8304913
Reviewed-by: shade Backport-of: 33c6ec9d4eb36649a94125aa005dc6b961dcd2c1
1 parent 7e78893 commit e0cc401

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/java.base/share/classes/jdk/internal/util/Architecture.java

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public enum Architecture {
4242
LOONGARCH64,
4343
S390,
4444
PPC64,
45+
MIPSEL,
46+
MIPS64EL
4547
;
4648

4749
private static Architecture CURRENT_ARCH = initArch(PlatformProps.CURRENT_ARCH_STRING);
@@ -111,6 +113,22 @@ public static boolean isAARCH64() {
111113
return PlatformProps.TARGET_ARCH_IS_AARCH64;
112114
}
113115

116+
/**
117+
* {@return {@code true} if the current architecture is MIPSEL}
118+
*/
119+
@ForceInline
120+
public static boolean isMIPSEL() {
121+
return PlatformProps.TARGET_ARCH_IS_MIPSEL;
122+
}
123+
124+
/**
125+
* {@return {@code true} if the current architecture is MIPS64EL}
126+
*/
127+
@ForceInline
128+
public static boolean isMIPS64EL() {
129+
return PlatformProps.TARGET_ARCH_IS_MIPS64EL;
130+
}
131+
114132
/**
115133
* {@return the current architecture}
116134
*/

src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template

+2
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,6 @@ class PlatformProps {
5858
static final boolean TARGET_ARCH_IS_LOONGARCH64 = "@@OPENJDK_TARGET_CPU@@" == "loongarch64";
5959
static final boolean TARGET_ARCH_IS_S390 = "@@OPENJDK_TARGET_CPU@@" == "s390";
6060
static final boolean TARGET_ARCH_IS_PPC64 = "@@OPENJDK_TARGET_CPU@@" == "ppc64";
61+
static final boolean TARGET_ARCH_IS_MIPSEL = "@@OPENJDK_TARGET_CPU@@" == "mipsel";
62+
static final boolean TARGET_ARCH_IS_MIPS64EL= "@@OPENJDK_TARGET_CPU@@" == "mips64el";
6163
}

test/jdk/jdk/internal/util/ArchTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import static jdk.internal.util.Architecture.S390;
3636
import static jdk.internal.util.Architecture.X64;
3737
import static jdk.internal.util.Architecture.X86;
38+
import static jdk.internal.util.Architecture.MIPSEL;
39+
import static jdk.internal.util.Architecture.MIPS64EL;
3840

3941
import org.junit.jupiter.api.Test;
4042
import org.junit.jupiter.params.ParameterizedTest;
@@ -74,6 +76,8 @@ public void nameVsCurrent() {
7476
case "loongarch64" -> LOONGARCH64;
7577
case "s390x", "s390" -> S390;
7678
case "ppc64", "ppc64le" -> PPC64;
79+
case "mipsel" -> MIPSEL;
80+
case "mips64el" -> MIPS64EL;
7781
default -> OTHER;
7882
};
7983
assertEquals(Architecture.current(), arch, "mismatch in Architecture.current vs " + osArch);
@@ -92,6 +96,8 @@ private static Stream<Arguments> archParams() {
9296
Arguments.of(RISCV64, Architecture.isRISCV64()),
9397
Arguments.of(LOONGARCH64, Architecture.isLOONGARCH64()),
9498
Arguments.of(S390, Architecture.isS390()),
99+
Arguments.of(MIPSEL, Architecture.isMIPSEL()),
100+
Arguments.of(MIPS64EL, Architecture.isMIPS64EL()),
95101
Arguments.of(PPC64, Architecture.isPPC64())
96102
);
97103
}

0 commit comments

Comments
 (0)