Skip to content

Commit 33c6ec9

Browse files
author
Roger Riggs
committedJun 19, 2023
8310019: MIPS builds are broken after JDK-8304913
Reviewed-by: phh, shade, aoqi
1 parent e08e94f commit 33c6ec9

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
@@ -41,6 +41,8 @@ public enum Architecture {
4141
RISCV64,
4242
S390,
4343
PPC64,
44+
MIPSEL,
45+
MIPS64EL
4446
;
4547

4648
private static Architecture CURRENT_ARCH = initArch(PlatformProps.CURRENT_ARCH_STRING);
@@ -102,6 +104,22 @@ public static boolean isAARCH64() {
102104
return PlatformProps.TARGET_ARCH_IS_AARCH64;
103105
}
104106

107+
/**
108+
* {@return {@code true} if the current architecture is MIPSEL}
109+
*/
110+
@ForceInline
111+
public static boolean isMIPSEL() {
112+
return PlatformProps.TARGET_ARCH_IS_MIPSEL;
113+
}
114+
115+
/**
116+
* {@return {@code true} if the current architecture is MIPS64EL}
117+
*/
118+
@ForceInline
119+
public static boolean isMIPS64EL() {
120+
return PlatformProps.TARGET_ARCH_IS_MIPS64EL;
121+
}
122+
105123
/**
106124
* {@return the current architecture}
107125
*/

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

+2
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ class PlatformProps {
5757
static final boolean TARGET_ARCH_IS_RISCV64 = "@@OPENJDK_TARGET_CPU@@" == "riscv64";
5858
static final boolean TARGET_ARCH_IS_S390 = "@@OPENJDK_TARGET_CPU@@" == "s390";
5959
static final boolean TARGET_ARCH_IS_PPC64 = "@@OPENJDK_TARGET_CPU@@" == "ppc64";
60+
static final boolean TARGET_ARCH_IS_MIPSEL = "@@OPENJDK_TARGET_CPU@@" == "mipsel";
61+
static final boolean TARGET_ARCH_IS_MIPS64EL= "@@OPENJDK_TARGET_CPU@@" == "mips64el";
6062
}

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

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import static jdk.internal.util.Architecture.S390;
3535
import static jdk.internal.util.Architecture.X64;
3636
import static jdk.internal.util.Architecture.X86;
37+
import static jdk.internal.util.Architecture.MIPSEL;
38+
import static jdk.internal.util.Architecture.MIPS64EL;
3739

3840
import org.junit.jupiter.api.Test;
3941
import org.junit.jupiter.params.ParameterizedTest;
@@ -72,6 +74,8 @@ public void nameVsCurrent() {
7274
case "riscv64" -> RISCV64;
7375
case "s390x", "s390" -> S390;
7476
case "ppc64", "ppc64le" -> PPC64;
77+
case "mipsel" -> MIPSEL;
78+
case "mips64el" -> MIPS64EL;
7579
default -> OTHER;
7680
};
7781
assertEquals(Architecture.current(), arch, "mismatch in Architecture.current vs " + osArch);
@@ -89,6 +93,8 @@ private static Stream<Arguments> archParams() {
8993
Arguments.of(ARM, Architecture.isARM()),
9094
Arguments.of(RISCV64, Architecture.isRISCV64()),
9195
Arguments.of(S390, Architecture.isS390()),
96+
Arguments.of(MIPSEL, Architecture.isMIPSEL()),
97+
Arguments.of(MIPS64EL, Architecture.isMIPS64EL()),
9298
Arguments.of(PPC64, Architecture.isPPC64())
9399
);
94100
}

0 commit comments

Comments
 (0)
Please sign in to comment.