8310019: MIPS builds are broken after JDK-8304913

Reviewed-by: phh, shade, aoqi
This commit is contained in:
Roger Riggs 2023-06-19 18:29:14 +00:00
parent e08e94f1b9
commit 33c6ec9d4e
3 changed files with 26 additions and 0 deletions

View File

@ -41,6 +41,8 @@ public enum Architecture {
RISCV64,
S390,
PPC64,
MIPSEL,
MIPS64EL
;
private static Architecture CURRENT_ARCH = initArch(PlatformProps.CURRENT_ARCH_STRING);
@ -102,6 +104,22 @@ public enum Architecture {
return PlatformProps.TARGET_ARCH_IS_AARCH64;
}
/**
* {@return {@code true} if the current architecture is MIPSEL}
*/
@ForceInline
public static boolean isMIPSEL() {
return PlatformProps.TARGET_ARCH_IS_MIPSEL;
}
/**
* {@return {@code true} if the current architecture is MIPS64EL}
*/
@ForceInline
public static boolean isMIPS64EL() {
return PlatformProps.TARGET_ARCH_IS_MIPS64EL;
}
/**
* {@return the current architecture}
*/

View File

@ -57,4 +57,6 @@ class PlatformProps {
static final boolean TARGET_ARCH_IS_RISCV64 = "@@OPENJDK_TARGET_CPU@@" == "riscv64";
static final boolean TARGET_ARCH_IS_S390 = "@@OPENJDK_TARGET_CPU@@" == "s390";
static final boolean TARGET_ARCH_IS_PPC64 = "@@OPENJDK_TARGET_CPU@@" == "ppc64";
static final boolean TARGET_ARCH_IS_MIPSEL = "@@OPENJDK_TARGET_CPU@@" == "mipsel";
static final boolean TARGET_ARCH_IS_MIPS64EL= "@@OPENJDK_TARGET_CPU@@" == "mips64el";
}

View File

@ -34,6 +34,8 @@ import static jdk.internal.util.Architecture.RISCV64;
import static jdk.internal.util.Architecture.S390;
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 org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@ -72,6 +74,8 @@ public class ArchTest {
case "riscv64" -> RISCV64;
case "s390x", "s390" -> S390;
case "ppc64", "ppc64le" -> PPC64;
case "mipsel" -> MIPSEL;
case "mips64el" -> MIPS64EL;
default -> OTHER;
};
assertEquals(Architecture.current(), arch, "mismatch in Architecture.current vs " + osArch);
@ -89,6 +93,8 @@ public class ArchTest {
Arguments.of(ARM, Architecture.isARM()),
Arguments.of(RISCV64, Architecture.isRISCV64()),
Arguments.of(S390, Architecture.isS390()),
Arguments.of(MIPSEL, Architecture.isMIPSEL()),
Arguments.of(MIPS64EL, Architecture.isMIPS64EL()),
Arguments.of(PPC64, Architecture.isPPC64())
);
}