pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

openjdk25: update some patches.



Module Name:	pkgsrc-wip
Committed By:	Robert Swindells <rjs%NetBSD.org@localhost>
Pushed By:	rjs
Date:		Thu Sep 3 14:49:13 2026 +0100
Changeset:	769b8984c1dfb3032b4d46ad11455d0e64a1b7a5

Modified Files:
	openjdk25/DESCR
	openjdk25/Makefile
	openjdk25/bootstrap.mk
	openjdk25/buildlink3.mk
	openjdk25/distinfo
	openjdk25/hacks.mk
	openjdk25/options.mk
	openjdk25/patches/patch-make_autoconf_flags-cflags.m4
	openjdk25/patches/patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp
Added Files:
	openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.template
Removed Files:
	openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.in
	openjdk25/patches/patch-make_lib_Awt2dLibraries.gmk
	openjdk25/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp

Log Message:
openjdk25: update some patches.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=769b8984c1dfb3032b4d46ad11455d0e64a1b7a5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 openjdk25/DESCR                                    |  2 +-
 openjdk25/Makefile                                 |  7 +--
 openjdk25/bootstrap.mk                             |  2 +-
 openjdk25/buildlink3.mk                            | 20 +++----
 openjdk25/distinfo                                 | 17 ++----
 openjdk25/hacks.mk                                 |  2 +-
 openjdk25/options.mk                               |  2 +-
 .../patch-make_autoconf_buildjdk-spec.gmk.in       | 21 --------
 .../patch-make_autoconf_buildjdk-spec.gmk.template | 16 ++++++
 .../patches/patch-make_autoconf_flags-cflags.m4    |  9 ++--
 .../patches/patch-make_lib_Awt2dLibraries.gmk      | 17 ------
 ..._cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp |  6 +--
 ...otspot_share_runtime_threadWXSetters.inline.hpp | 63 ----------------------
 13 files changed, 44 insertions(+), 140 deletions(-)

diffs:
diff --git a/openjdk25/DESCR b/openjdk25/DESCR
index 3038041255..7805ea6307 100644
--- a/openjdk25/DESCR
+++ b/openjdk25/DESCR
@@ -1,5 +1,5 @@
 Open-source implementation of the Java Platform, Standard Edition.
-This package privides OpenJDK 25 LTS.
+This package privides OpenJDK 25.
 
 This package is NOT certified to be compatible with any Java standard.
 Use at own risk.
diff --git a/openjdk25/Makefile b/openjdk25/Makefile
index 0101ab9b3b..c94b6749fe 100644
--- a/openjdk25/Makefile
+++ b/openjdk25/Makefile
@@ -9,7 +9,7 @@ GITHUB_TAG=	jdk-25.0.4+7-1
 
 MAINTAINER=	ryoon%NetBSD.org@localhost
 HOMEPAGE=	https://openjdk.java.net/
-COMMENT=	Open-source implementation of the Java Platform, 25 LTS
+COMMENT=	Open-source implementation of the Java Platform, 25
 LICENSE=	gnu-gpl-v2
 
 DISTFILES=	${DEFAULT_DISTFILES}
@@ -120,7 +120,8 @@ CWRAPPERS_APPEND.cxx+=	-mstackrealign
 CONFIGURE_ARGS+=	--with-toolchain-type=gcc
 .endif
 
-.include "bootstrap.mk"
+#.include "bootstrap.mk"
+ALT_BOOTDIR=/path/to/binary-jdk/jdk-25.0.4.1+1
 .include "options.mk"
 
 SUBST_CLASSES+=		libpath
@@ -136,7 +137,7 @@ SUBST_CLASSES+=			fontpaths
 SUBST_STAGE.fontpaths=		pre-configure
 SUBST_MESSAGE.fontpaths=	fixing font paths
 SUBST_FILES.fontpaths=		src/java.desktop/bsd/data/fontconfig/fontconfig.properties
-SUBST_FILES.fontpaths+=		src/java.desktop/unix/native/common/awt/fontpath.c
+#SUBST_FILES.fontpaths+=		src/java.desktop/unix/native/common/awt/fontpath.c
 SUBST_VARS.fontpaths=		PREFIX BUILDLINK_PREFIX.fontconfig
 
 
diff --git a/openjdk25/bootstrap.mk b/openjdk25/bootstrap.mk
index 412d1587f3..258a72b2e0 100644
--- a/openjdk25/bootstrap.mk
+++ b/openjdk25/bootstrap.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bootstrap.mk,v 1.4 2025/08/21 02:50:14 pho Exp $
+# $NetBSD: $
 
 .if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 090000
 PKG_FAIL_REASON+=		"Only supports NetBSD >= 9"
diff --git a/openjdk25/buildlink3.mk b/openjdk25/buildlink3.mk
index ea163b5051..017696bc40 100644
--- a/openjdk25/buildlink3.mk
+++ b/openjdk25/buildlink3.mk
@@ -1,16 +1,16 @@
-# $NetBSD: buildlink3.mk,v 1.1 2023/11/22 14:06:50 ryoon Exp $
+# $NetBSD: $
 
-BUILDLINK_TREE+=	openjdk21
+BUILDLINK_TREE+=	openjdk25
 
-.if !defined(OPENJDK21_BUILDLINK3_MK)
-OPENJDK21_BUILDLINK3_MK:=
+.if !defined(OPENJDK25_BUILDLINK3_MK)
+OPENJDK25_BUILDLINK3_MK:=
 
-BUILDLINK_LIBDIRS.openjdk21+=	java/openjdk21/lib
-BUILDLINK_LIBDIRS.openjdk21+=	java/openjdk21/lib/server
+BUILDLINK_LIBDIRS.openjdk25+=	java/openjdk25/lib
+BUILDLINK_LIBDIRS.openjdk25+=	java/openjdk25/lib/server
 
-BUILDLINK_API_DEPENDS.openjdk21+=	openjdk21>=1.21.0.1.12
-BUILDLINK_PKGSRCDIR.openjdk21?=		../../lang/openjdk21
+BUILDLINK_API_DEPENDS.openjdk25+=	openjdk25>=1.25.0.4
+BUILDLINK_PKGSRCDIR.openjdk25?=		../../wip/openjdk25
 
-.endif	# OPENJDK21_BUILDLINK3_MK
+.endif	# OPENJDK25_BUILDLINK3_MK
 
-BUILDLINK_TREE+=	-openjdk21
+BUILDLINK_TREE+=	-openjdk25
diff --git a/openjdk25/distinfo b/openjdk25/distinfo
index 67ec1ca162..54cd92480d 100644
--- a/openjdk25/distinfo
+++ b/openjdk25/distinfo
@@ -1,28 +1,17 @@
 $NetBSD: distinfo,v 1.17 2026/08/16 11:54:29 tnn Exp $
 
-BLAKE2s (bootstrap-jdk-1.21.0.1.12-netbsd-9-amd64-20231207.tar.xz) = 017a9d787a34faa997d72ac69bcafd9c8ab72354e3a1b751d1cb5d376b364f72
-SHA512 (bootstrap-jdk-1.21.0.1.12-netbsd-9-amd64-20231207.tar.xz) = 7ec4208363f44a378674a2b87687ab7facb60bf73118ebd4bec35f7912f073365b36efc4c4b3c034bc448139cb81106e18d6d3b1db45f4ab086ce1ed72bc21bf
-Size (bootstrap-jdk-1.21.0.1.12-netbsd-9-amd64-20231207.tar.xz) = 113417260 bytes
-BLAKE2s (bootstrap-jdk-1.21.0.1.12-netbsd-9-i386-20231207.tar.xz) = 6df557871e6795552305b28d778bcf8724b06e981ec72b35d2e5406cf1f25591
-SHA512 (bootstrap-jdk-1.21.0.1.12-netbsd-9-i386-20231207.tar.xz) = 15d1e8c3b9e440eb446857c42528d5d409baa6b173742930ec5dfe55ba1501e49af789ea75c8cc78eba6b977d7be2b2b4854d9657d75095c55d3941370ff7b94
-Size (bootstrap-jdk-1.21.0.1.12-netbsd-9-i386-20231207.tar.xz) = 111820092 bytes
-BLAKE2s (bootstrap-jdk-1.21.0.7.6-netbsd-9-aarch64-20250811.tar.xz) = 0ee9c4b9d6e62a67af62d62121769121d475e9c3a8d7c25a32cd70f62d01b873
-SHA512 (bootstrap-jdk-1.21.0.7.6-netbsd-9-aarch64-20250811.tar.xz) = 7b8b17b9a077ea45d92ad9c855df6f831d0f1233166cf9e1af0e16ed0a747575be0a361c398b981d59aee2c09f1ea3e1dcceef68c9876a6efce3c6a94b7c7e50
-Size (bootstrap-jdk-1.21.0.7.6-netbsd-9-aarch64-20250811.tar.xz) = 112607360 bytes
 BLAKE2s (jdk25u-jdk-25.0.4-7-1.tar.gz) = db81e919589070cbef63d5f4df43a690cb5119a72f75b12eb1a289621b4e2b97
 SHA512 (jdk25u-jdk-25.0.4-7-1.tar.gz) = ac564673ce14b192f3136d3d92e6125d412f1f449b3fcbe1f47dd0af7a6ccf6ec4a8f4c5074dcab17faf09fc2df54e0430c1e28ea7b8e171169ad97f2213b3fe
 Size (jdk25u-jdk-25.0.4-7-1.tar.gz) = 119810522 bytes
-SHA1 (patch-make_autoconf_buildjdk-spec.gmk.in) = 01b6ac6dae1a886949020b9d472aab1e357084b0
-SHA1 (patch-make_autoconf_flags-cflags.m4) = 2777471821988895f5ae1be33b1c92b7386b068a
+SHA1 (patch-make_autoconf_buildjdk-spec.gmk.template) = 6edee4455dff6f967b6a209c18824b780b5fae8b
+SHA1 (patch-make_autoconf_flags-cflags.m4) = 7b77e6688805e4c290b5a5948c054463225ccd2d
 SHA1 (patch-make_autoconf_hotspot.m4) = b3d70d7def7b4b0c4ae2632be75bfbe97f931879
 SHA1 (patch-make_autoconf_lib-alsa.m4) = 999fbf951363f6b49b22aad81537728f22d7c381
 SHA1 (patch-make_autoconf_lib-bundled.m4) = 5f5b638a08abf2f2066a122a825cfa3db9e95139
 SHA1 (patch-make_autoconf_lib-freetype.m4) = bd791b99e4fd87f24432831fba1e814dd199445f
 SHA1 (patch-make_autoconf_lib-x11.m4) = 38038e6d7cfc2d15fb3537a52f11d2961cc2ec99
-SHA1 (patch-make_lib_Awt2dLibraries.gmk) = d69fa8c5cab173be2f41cfbd6479dad60a6337db
-SHA1 (patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp) = 3e0597bf836b23ae1a808834a0c1a9874ae47915
+SHA1 (patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp) = 989bd899a7a65ad0e498dc9a4b377cd3f511d4d8
 SHA1 (patch-src_hotspot_os_bsd_os__bsd.cpp) = 5561ed502aa925cd3d0514c7ec298e0491d14ffc
-SHA1 (patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp) = f704bb060803e500415b5d300e26857cf7288ca5
 SHA1 (patch-src_java.desktop_bsd_data_fontconfig_fontconfig.properties) = 32eda43f536dc3a9afb4f1f5f7acae8cb020d546
 SHA1 (patch-src_java.desktop_unix_native_common_awt_fontpath.c) = 4a65df0bf84af967f230636f1da1ec75fbb3f691
 SHA1 (patch-src_java.desktop_unix_native_libpipewire_include_spa_utils_string.h) = f677c9b907b285d6b84de65396f50e2a5e52caba
diff --git a/openjdk25/hacks.mk b/openjdk25/hacks.mk
index 338bd617be..e6b1a47f24 100644
--- a/openjdk25/hacks.mk
+++ b/openjdk25/hacks.mk
@@ -1,4 +1,4 @@
-# $NetBSD: hacks.mk,v 1.3 2025/12/24 16:11:56 ryoon Exp $
+# $NetBSD: $
 
 .if !defined(OPENJDK25_HACKS_MK)
 OPENJDK25_HACKS_MK=	# empty
diff --git a/openjdk25/options.mk b/openjdk25/options.mk
index 3e503d2410..d89f08c1ec 100644
--- a/openjdk25/options.mk
+++ b/openjdk25/options.mk
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.4 2025/08/11 18:06:32 pho Exp $
+# $NetBSD: $
 
 PKG_OPTIONS_VAR=		PKG_OPTIONS.openjdk25
 PKG_OPTIONS_OPTIONAL_GROUPS=	variant
diff --git a/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.in b/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.in
deleted file mode 100644
index 49c11b2cbc..0000000000
--- a/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.in
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-make_autoconf_buildjdk-spec.gmk.in,v 1.1 2023/11/22 14:06:50 ryoon Exp $
-
-Use the same variant for the buildjdk as the target jdk.
-This is needed for native builds on platforms where hotspot is broken or not
-supported. In that case the buildjdk can't be hardcoded to "server" but must
-use "zero". This is fine for pkgsrc since we only ever build one variant.
-
---- make/autoconf/buildjdk-spec.gmk.in.orig	2022-04-23 02:25:56.000000000 +0000
-+++ make/autoconf/buildjdk-spec.gmk.in
-@@ -94,8 +94,9 @@ DISABLE_WARNING_PREFIX := @BUILD_CC_DISA
- # Save speed and disk space by not enabling debug symbols for the buildjdk
- ENABLE_DEBUG_SYMBOLS := false
- 
--JVM_VARIANTS := server
--JVM_VARIANT_MAIN := server
-+JVM_VARIANTS :=  @JVM_VARIANTS@
-+JVM_VARIANT_MAIN := @JVM_VARIANT_MAIN@
-+JVM_FEATURES_zero := g1gc serialgc zero
- JVM_FEATURES_server := cds compiler1 compiler2 g1gc serialgc
- 
- # Some users still set EXTRA_*FLAGS on the make command line. Must
diff --git a/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.template b/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.template
new file mode 100644
index 0000000000..24b161db09
--- /dev/null
+++ b/openjdk25/patches/patch-make_autoconf_buildjdk-spec.gmk.template
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- make/autoconf/buildjdk-spec.gmk.template.orig	2026-07-24 17:22:09.000000000 +0000
++++ make/autoconf/buildjdk-spec.gmk.template
+@@ -95,8 +95,9 @@ ENABLE_DEBUG_SYMBOLS := false
+ # Save speed and disk space by not enabling debug symbols for the buildjdk
+ ENABLE_DEBUG_SYMBOLS := false
+ 
+-JVM_VARIANTS := server
+-JVM_VARIANT_MAIN := server
++JVM_VARIANTS :=  @JVM_VARIANTS@
++JVM_VARIANT_MAIN := @JVM_VARIANT_MAIN@
++JVM_FEATURES_zero := g1gc serialgc zero
+ JVM_FEATURES_server := cds compiler1 compiler2 g1gc serialgc
+ 
+ # Some users still set EXTRA_*FLAGS on the make command line. Must
diff --git a/openjdk25/patches/patch-make_autoconf_flags-cflags.m4 b/openjdk25/patches/patch-make_autoconf_flags-cflags.m4
index ce2d52be30..c298130099 100644
--- a/openjdk25/patches/patch-make_autoconf_flags-cflags.m4
+++ b/openjdk25/patches/patch-make_autoconf_flags-cflags.m4
@@ -2,7 +2,7 @@ $NetBSD: patch-make_autoconf_flags-cflags.m4,v 1.2 2024/10/01 14:49:40 ryoon Exp
 
 We prefer to use explicit run paths.
 
---- make/autoconf/flags-cflags.m4.orig	2024-07-27 15:26:53.000000000 +0000
+--- make/autoconf/flags-cflags.m4.orig	2026-07-24 17:22:09.000000000 +0000
 +++ make/autoconf/flags-cflags.m4
 @@ -40,8 +40,8 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
      # --disable-new-dtags forces use of RPATH instead of RUNPATH for rpaths.
@@ -13,9 +13,9 @@ We prefer to use explicit run paths.
 +    SET_EXECUTABLE_ORIGIN='@COMPILER_RPATH_FLAG@@PREFIX@/java/@JAVA_NAME@/lib @COMPILER_RPATH_FLAG@@PREFIX@/java/@JAVA_NAME@/lib/server'
 +    SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
-     SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
  
-@@ -65,20 +65,13 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
+   elif test "x$TOOLCHAIN_TYPE" = xclang; then
+@@ -62,19 +62,12 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
      else
        # Default works for linux, might work on other platforms as well.
        SHARED_LIBRARY_FLAGS='-shared'
@@ -25,7 +25,6 @@ We prefer to use explicit run paths.
          SET_EXECUTABLE_ORIGIN="$SET_EXECUTABLE_ORIGIN -Wl,--disable-new-dtags"
        fi
        SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
-       SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
 -
 -      # arm specific settings
 -      if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
@@ -37,4 +36,4 @@ We prefer to use explicit run paths.
 +      SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
      fi
  
-   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
+   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
diff --git a/openjdk25/patches/patch-make_lib_Awt2dLibraries.gmk b/openjdk25/patches/patch-make_lib_Awt2dLibraries.gmk
deleted file mode 100644
index e6ae4795c3..0000000000
--- a/openjdk25/patches/patch-make_lib_Awt2dLibraries.gmk
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-make_lib_Awt2dLibraries.gmk,v 1.1 2023/11/22 14:06:50 ryoon Exp $
-
-bundled harfbuzz code needs to use -std=c++11 for static_assert().
-But we can't add it to USE_LANGUAGES because the rest of the JDK
-contains legacy code that requires -std=gnu++98.
-
---- make/modules/java.desktop/lib/Awt2dLibraries.gmk.orig	2019-09-19 12:22:38.000000000 +0000
-+++ make/modules/java.desktop/lib/Awt2dLibraries.gmk
-@@ -612,7 +612,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIB
-         AccelGlyphCache.c, \
-     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
-     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
--    CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
-+    CXXFLAGS := $(CXXFLAGS_JDKLIB) -std=c++11 $(LIBFONTMANAGER_CFLAGS), \
-     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
-     CFLAGS_windows = -DCC_NOEX, \
-     EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
diff --git a/openjdk25/patches/patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp b/openjdk25/patches/patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp
index 9c2a2e1096..b260fa3a78 100644
--- a/openjdk25/patches/patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp
+++ b/openjdk25/patches/patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp
@@ -2,10 +2,10 @@ $NetBSD: patch-src_hotspot_os__cpu_bsd__aarch64_vm__version__bsd__aarch64.cpp,v
 
 Add runtime CPU detection support for NetBSD.
 
---- src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp.orig	2026-08-16 10:56:39.893223726 +0000
+--- src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp.orig	2026-07-24 17:22:09.000000000 +0000
 +++ src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp
 @@ -27,6 +27,13 @@
- #include "precompiled.hpp"
+ #include "runtime/java.hpp"
  #include "runtime/os.hpp"
  #include "vm_version_aarch64.hpp"
 +#if defined(__NetBSD__)
@@ -18,7 +18,7 @@ Add runtime CPU detection support for NetBSD.
  
  void VM_Version::get_compatible_board(char *buf, int buflen) {
    assert(buf != nullptr, "invalid argument");
-@@ -541,6 +548,98 @@ void VM_Version::get_os_cpu_info() {
+@@ -545,6 +552,98 @@ void VM_Version::get_os_cpu_info() {
    }
  #endif // __FreeBSD__
  #endif // __FreeBSD__ || __OpenBSD__
diff --git a/openjdk25/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp b/openjdk25/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp
deleted file mode 100644
index 13b55178ef..0000000000
--- a/openjdk25/patches/patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-$NetBSD: patch-src_hotspot_share_runtime_threadWXSetters.inline.hpp,v 1.1 2025/08/11 18:06:32 pho Exp $
-
-Workaround for the Hotspot VM dying on Apple Silicon chips:
-https://mail-index.netbsd.org/tech-pkg/2025/07/12/msg031385.html
-
-The problem is basically that Hotspot outrightly violates the architecture
-spec, and then it does all kinds of weird workarounds to compensate,
-assuming their workarounds happen to work on some implementations of actual
-chips. It essentially relies on implementation details of chips:
-https://cr.openjdk.org/~jrose/jvm/hotspot-cmc.html
-
-However, their workaround does not work on Apple Silicon. It's not Apple's
-fault, because Hotspot knowingly violates the spec. The problem does not
-come to the surface on Darwin/aarch64 but it's only by an accident:
-Darwin/aarch64 strictly forbids executing code in writable pages, and
-provides a non-portable function pthread_jit_write_protect_np(), which
-Hotspot uses every time it needs to modify code in memory.
-
-The function temporarily write-protects every executable page in the entire
-process space but only for the calling thread, so that the thread can
-execute code in pages that are otherwise writable. The important fact is
-that the function happens to issue data and instruction memory barriers
-(i.e. DSB and ISB) in its implementation. It turned out these barriers were
-what made Hotspot work on Apple Silicon.
-
-So, in order to make it work on non-Darwin OSes on Apple Silicon, and
-possibly on other non-Cortex aarch64 chips, we must issue memory barriers
-every time it would call pthread_jit_write_protect_np() on
-Darwin/aarch64. FreeBSD suffers from the same problem:
-https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265284
-
---- src/hotspot/share/runtime/threadWXSetters.inline.hpp.orig	2025-08-01 07:55:07.225394550 +0000
-+++ src/hotspot/share/runtime/threadWXSetters.inline.hpp
-@@ -43,6 +43,29 @@ public:
-     }
-   }
- };
-+#elif defined(AARCH64)
-+class ThreadWXEnable  {
-+  WXMode _new_mode;
-+public:
-+  ThreadWXEnable(WXMode new_mode, Thread*) :
-+    _new_mode(new_mode)
-+  {
-+    if (_new_mode == WXExec) {
-+      // We are going to execute some code that has been potentially
-+      // modified.
-+      __asm__ __volatile__ ("dsb\tsy\n"
-+                            "isb\tsy" : : : "memory");
-+    }
-+  }
-+  ~ThreadWXEnable() {
-+    if (_new_mode == WXWrite) {
-+      // We may have modified some code that is going to be executed
-+      // outside of this block.
-+      __asm__ __volatile__ ("dsb\tsy\n"
-+                            "isb\tsy" : : : "memory");
-+    }
-+  }
-+};
- #endif // __APPLE__ && AARCH64
- 
- #endif // SHARE_RUNTIME_THREADWXSETTERS_INLINE_HPP


Home | Main Index | Thread Index | Old Index