Bug#1057390: openjdk-21: Please add patch to support SPARCV9

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.linux.debian.ports.sparc
Message-ID <170168971695.3279921.6027164746833117010.reportbug__18879.7662661941$1701689990$gmane$org@nofan.physik.fu-berlin.de>
Source: openjdk-21
Version: 21.0.1+12-2
Severity: normal
Tags: patch
User: [email protected]
Usertags: sparc64
X-Debbugs-Cc: [email protected]

Hello!

The attached patch adds SPARCV9 support to OpenJDK. It has been successfully
tested against OpenJDK 21 on stadler.debian.net. I will use this patch now
to build openjdk-21 and upload to unreleased.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
add-sparcv9-support.diff (text/plain, 3.3 KB)
Index: openjdk-21-21.0.1+12/src/java.base/share/classes/jdk/internal/util/Architecture.java
===================================================================
--- openjdk-21-21.0.1+12.orig/src/java.base/share/classes/jdk/internal/util/Architecture.java
+++ openjdk-21-21.0.1+12/src/java.base/share/classes/jdk/internal/util/Architecture.java
@@ -50,6 +50,7 @@ public enum Architecture {
     IA64,
     M68K,
     SH,
+    SPARCV9,
     X32,
     PPC,
     MIPSEL,
@@ -171,6 +172,15 @@ public enum Architecture {
     }
 
     /**
+     * {@return {@code true} if the current architecture is SPARCV9}
+     * Use {@link #isLittleEndian()} to determine big or little endian.
+     */
+    @ForceInline
+    public static boolean isSPARCV9() {
+        return PlatformProps.TARGET_ARCH_IS_SPARCV9;
+    }
+
+    /**
      * {@return {@code true} if the current architecture is M68K}
      * Use {@link #isLittleEndian()} to determine big or little endian.
      */
Index: openjdk-21-21.0.1+12/test/jdk/jdk/internal/util/ArchTest.java
===================================================================
--- openjdk-21-21.0.1+12.orig/test/jdk/jdk/internal/util/ArchTest.java
+++ openjdk-21-21.0.1+12/test/jdk/jdk/internal/util/ArchTest.java
@@ -41,6 +41,7 @@ import static jdk.internal.util.Architec
 import static jdk.internal.util.Architecture.IA64;
 import static jdk.internal.util.Architecture.PPC;
 import static jdk.internal.util.Architecture.SH;
+import static jdk.internal.util.Architecture.SPARCV9;
 import static jdk.internal.util.Architecture.X32;
 import static jdk.internal.util.Architecture.M68K;
 import static jdk.internal.util.Architecture.MIPSEL;
@@ -93,6 +94,7 @@ public class ArchTest {
             case "m68k" -> M68K;
             case "ppc" -> PPC;
             case "sh" -> SH;
+            case "sparcv9" -> SPARCV9;
             case "x32" -> X32;
             default -> OTHER;
         };
@@ -121,6 +123,7 @@ public class ArchTest {
                 Arguments.of(HPPA, Architecture.isHPPA()),
                 Arguments.of(IA64, Architecture.isIA64()),
                 Arguments.of(SH, Architecture.isSH()),
+                Arguments.of(SPARCV9, Architecture.isSPARCV9()),
                 Arguments.of(X32, Architecture.isX32()),
                 Arguments.of(PPC64, Architecture.isPPC64())
         );
Index: openjdk-21-21.0.1+12/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template
===================================================================
--- openjdk-21-21.0.1+12.orig/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template
+++ openjdk-21-21.0.1+12/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template
@@ -64,6 +64,7 @@ class PlatformProps {
     static final boolean TARGET_ARCH_IS_MIPS64EL= "@@OPENJDK_TARGET_CPU@@" == "mips64el";
     static final boolean TARGET_ARCH_IS_X32     = "@@OPENJDK_TARGET_CPU@@" == "x32";
     static final boolean TARGET_ARCH_IS_SH      = "@@OPENJDK_TARGET_CPU@@" == "sh";
+    static final boolean TARGET_ARCH_IS_SPARCV9 = "@@OPENJDK_TARGET_CPU@@" == "sparcv9";
     static final boolean TARGET_ARCH_IS_M68K    = "@@OPENJDK_TARGET_CPU@@" == "m68k";
     static final boolean TARGET_ARCH_IS_PPC     = "@@OPENJDK_TARGET_CPU@@" == "ppc";
     static final boolean TARGET_ARCH_IS_ALPHA   = "@@OPENJDK_TARGET_CPU@@" == "alpha";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.