community/openjdk22-loongarch: new aport

https://github.com/loongson/jdk
Loongarch port of OpenJDK 22
This commit is contained in:
Celeste 2024-09-13 14:19:35 +00:00
parent ebf7e990e1
commit 7834dd79bd
8 changed files with 822 additions and 0 deletions

View file

@ -0,0 +1,320 @@
# Maintainer: Celeste <cielesti@protonmail.com>
_majorver=22
_buildver=27
_loongver=0
pkgname=openjdk$_majorver-loongarch
pkgver=0.0.$_buildver.$_loongver
pkgrel=0
_gittag="jdk-$_majorver+$_buildver-ls-$_loongver"
_prevmajorver=$((_majorver - 1))
_provide_java=false
pkgdesc="Loongarch port of OpenJDK $_majorver"
url="https://github.com/loongson/jdk"
arch="loongarch64"
license="GPL-2.0-only WITH Classpath-exception-2.0"
options="sover-namecheck"
makedepends_build="
openjdk$_prevmajorver-bootstrap
autoconf
bash
gawk
grep
make
zip
zlib-dev
"
makedepends_host="
alsa-lib-dev
cups-dev
elfutils-dev
fontconfig-dev
freetype-dev
giflib-dev
lcms2-dev
libffi-dev
libjpeg-turbo-dev
libx11-dev
libxext-dev
libxrandr-dev
libxrender-dev
libxt-dev
libxtst-dev
linux-headers
zlib-dev
"
makedepends="
$makedepends_build
$makedepends_host
java-cacerts
java-common
"
subpackages="
$pkgname-demos::noarch
$pkgname-doc
$pkgname-jmods::noarch
$pkgname-jre
$pkgname-jre-headless:jre_headless
$pkgname-jdk
"
$_provide_java && subpackages="$subpackages
$pkgname-static-libs:static_libs
"
_gtest=1.14.0
source="$pkgname-$_gittag.tar.gz::https://github.com/loongson/jdk/archive/refs/tags/$_gittag.tar.gz
gtest-$_gtest.tar.gz::https://github.com/google/googletest/archive/v$_gtest.tar.gz
JDK-8218814_Wformat-security.patch
JDK-8299245_disable-tests.patch
JDK-8324243_calloc-args.patch
JDK-8328997_template-id.patch
JDK-8331352_template-id.patch
fpu_control.patch
lfs64.patch
"
builddir="$srcdir/jdk-${_gittag/+/-}"
provides="openjdk$_majorver-bootstrap=$pkgver-r$pkgrel"
provider_priority=$_majorver
_java_home="/usr/lib/jvm/java-$_majorver-openjdk"
ldpath="$_java_home/lib:$_java_home/lib/server"
sonameprefix="$pkgname:"
# enable running the JTReg tests in check?
# see comment in that function for explanation
_run_jtreg=${_run_jtreg:-0}
if [ $_run_jtreg -ne 0 ]; then
makedepends="$makedepends java-jtreg"
checkdepends="$checkdepends font-freefont xvfb-run"
fi
_jvm_variants=server
build() {
if [ $_run_jtreg -ne 0 ]; then
_with_jtreg="--with-jtreg=/usr/share/java/jtreg"
else
_with_jtreg="--with-jtreg=no"
fi
if [ -n "$USE_CCACHE" ]; then
# workaround ccache being disallowed
export PATH="/usr/bin:/bin:/sbin:/usr/sbin"
local ccache="--enable-ccache"
fi
if [ -z "$JOBS" ]; then
export JOBS=$(printf '%s\n' "$MAKEFLAGS" | sed -n -e 's/.*-j\([0-9]\+\).*/\1/p')
fi
# we want to build hotspot with better optimisations; it's set to this
# (prepended) anyway, and it's huge
export CFLAGS="$CFLAGS -O3"
export CXXFLAGS="$CXXFLAGS -O3"
# CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
# in the output of ./configure unless used like such:
# --with-extra-cflags="$CFLAGS"
# --with-extra-cxxflags="$CXXFLAGS"
# --with-extra-ldflags="$LDFLAGS"
# See also paragraph "Configure Control Variables" from "common/doc/building.md"
# shellcheck disable=2097 disable=2098
CFLAGS='' CXXFLAGS='' LDFLAGS='' \
bash ./configure \
--build=$CBUILD \
--openjdk-target=$CHOST \
--prefix="$_java_home" \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CXXFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--with-zlib=system \
--with-libjpeg=system \
--with-giflib=system \
--with-libpng=system \
--with-lcms=system \
--with-jobs=${JOBS:-4} \
--with-test-jobs=${JOBS:-4} \
--with-native-debug-symbols=none \
--with-gtest="$srcdir/googletest-$_gtest" \
$ccache \
$_with_jtreg \
--disable-warnings-as-errors \
--disable-precompiled-headers \
--enable-dtrace=no \
--with-jvm-variants=$_jvm_variants \
--with-debug-level=release \
--with-version-pre= \
--with-version-build="$_buildver" \
--with-version-opt="ls-$_loongver-alpine-r$pkgrel" \
--with-vendor-name="Alpine" \
--with-vendor-url="https://alpinelinux.org/" \
--with-vendor-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues" \
--with-vendor-vm-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues"
MAKEFLAGS='' make jdk-image
if $_provide_java; then
MAKEFLAGS='' make static-libs-image
fi
}
check() {
# run the gtest unittest suites
# they don't take long, DO NOT DISABLE THEM!
# override make variable, disable -Werror
MAKEFLAGS='' make test-hotspot-gtest
# The jtreg tests take very, very long to finish and show some failures (9 - 12 on my machine, varying between runs)
# I think these are not critical and can be safely ignored.
# As the tests take too long, they are disabled by default.
# When updating this aport please let them run at least once on your machine to see if the failure count changes.
if [ $_run_jtreg -ne 0 ]; then
_logfile=$( mktemp -p "$builddir" )
MAKEFLAGS='' xvfb-run make \
run-test-tier1 \
run-test-tier2 \
run-test-tier3 \
| tee "$_logfile"
msg "---------------------------------------"
msg "The build log can be found at $_logfile"
# abort the build so you may take a look at the logfile
false
return 1
fi
}
package() {
depends="$pkgname-jdk=$pkgver-r$pkgrel"
install -Dvm644 ASSEMBLY_EXCEPTION LICENSE README.md \
-t "$pkgdir"/$_java_home/
cd build/linux-*-$_jvm_variants-release/images/
cp -a jdk/* "$pkgdir"/$_java_home/
rm -v "$pkgdir"/$_java_home/lib/src.zip
if $_provide_java; then
local libstaticdir="lib/static/linux-loongarch64/musl"
mkdir -p "$pkgdir"/$_java_home/$libstaticdir
cp -a static-libs/lib/* "$pkgdir"/$_java_home/$libstaticdir/
fi
# symlink to shared java cacerts store
rm -v "$pkgdir"/$_java_home/lib/security/cacerts
ln -sv /etc/ssl/certs/java/cacerts \
"$pkgdir"/$_java_home/lib/security/cacerts
# symlink for java-common to work (expects jre in $_java_home/jre)
ln -sv . "$pkgdir"/$_java_home/jre
}
jmods() {
pkgdesc="$pkgdesc (jmods)"
depends=
provides="openjdk$_majorver-jmods"
replaces="openjdk$_majorver-jmods"
amove $_java_home/jmods
}
static_libs() {
pkgdesc="$pkgdesc (libraries for static linking)"
depends="$pkgname-jdk=$pkgver-r$pkgrel"
$_provide_java && provides="java-jdk-static-libs"
provides="$provides openjdk$_majorver-static-libs"
replaces="openjdk$_majorver-static-libs"
amove $_java_home/lib/static
}
jre() {
pkgdesc="$pkgdesc (JRE)"
depends="$pkgname-jre-headless=$pkgver-r$pkgrel"
$_provide_java && provides="java-jre"
provides="$provides openjdk$_majorver-jre"
replaces="openjdk$_majorver-jre"
amove \
$_java_home/lib/libawt_xawt.so \
$_java_home/lib/libfontmanager.so \
$_java_home/lib/libjavajpeg.so \
$_java_home/lib/libjawt.so \
$_java_home/lib/libjsound.so \
$_java_home/lib/liblcms.so \
$_java_home/lib/libsplashscreen.so
}
jre_headless() {
pkgdesc="$pkgdesc (JRE headless)"
depends="java-common java-cacerts"
$_provide_java && provides="java-jre-headless"
provides="$provides openjdk$_majorver-jre-headless"
replaces="openjdk$_majorver-jre-headless"
amove \
$_java_home/bin/java \
$_java_home/bin/jfr \
$_java_home/bin/jrunscript \
$_java_home/bin/jwebserver \
$_java_home/bin/keytool \
$_java_home/bin/rmiregistry \
$_java_home/conf \
$_java_home/jre \
$_java_home/release
# Rest of the lib subdir (which were not taken by -jre subpkg).
amove $_java_home/lib
# ct.sym should stay in -jdk
mkdir -p "$pkgdir"/$_java_home/lib
mv "$subpkgdir"/$_java_home/lib/ct.sym "$pkgdir"/$_java_home/lib
}
doc() {
default_doc
amove $_java_home/man
}
demos() {
pkgdesc="$pkgdesc (demos)"
depends="$pkgname-jdk=$pkgver-r$pkgrel"
provides="openjdk$_majorver-demos"
replaces="openjdk$_majorver-demos"
amove $_java_home/demo
}
jdk() {
pkgdesc="$pkgdesc (JDK) ($_jvm_variants variant)"
depends="$pkgname-jre=$pkgver-r$pkgrel $pkgname-jmods=$pkgver-r$pkgrel"
$_provide_java && provides="java-jdk"
provides="$provides openjdk$_majorver-jdk"
replaces="openjdk$_majorver-jdk"
amove \
$_java_home/bin \
$_java_home/lib \
$_java_home/include
}
sha512sums="
e5e9ac6a11a22290688b98bc75d7ff84af0f4d146f48a0452351811a97c5d049567def2101aed1e68c521f5d7380820e04e99c50ffdb9afc98dcce960b064696 openjdk22-loongarch-jdk-22+27-ls-0.tar.gz
765c326ccc1b87a01027385e69238266e356361cd4ee3e18e3c9d137a5d11fa5d657c164d02dd1be8fe693c8e10f2b580588dbfa57d27f070e2750f50d3e662c gtest-1.14.0.tar.gz
b2af7ec861a424e4f9ee4a968897d112cae862a76edc9f1f0df3b09e887a2debd51181ca7c72b70cd5387af896a01004c40ddb7a0a952591be580d3a00ddb8af JDK-8218814_Wformat-security.patch
403862d6e6919f40d705c59463e9d6ecc5ac5b3f95e107a7e91f84d64068176e4abe7b63f15ba8fc9b4ab2f1ab58f3a489e07716e4c370356e40c2699e870b4f JDK-8299245_disable-tests.patch
861ed6ff852429d86ca769f941a8b65c0d148c871b476130da483ba56eb91220ffc820c24b8c6f6403997b519c742651cb07fbd13966b5a6afaaa499dbe16035 JDK-8324243_calloc-args.patch
d7db30739f57eaca59a664bc146f3d088f34a70807c2bfcd2a9592d13d758ddbacc1e50bf873686d0b1b9c11bc4e721fc02d1dcffe3a1abec4fda6589d7f67ff JDK-8328997_template-id.patch
820e06a8767f0fe3a319b71117c89457f6f1538a101b8db96626dfd0a601631bbb0606e72c47b4e8c66d451fdc41dd81f6be0a48e3d01bd61031ce6480f71946 JDK-8331352_template-id.patch
e1869d5a0ff74883b8289eb9feb5e919894cfcf418e0a07ce353d4ff2f678e81cbbba3bcf7b3642aefda963e9d9f2e6c33974ad4bb55da8aab1618ff98fd1fe1 fpu_control.patch
c77b6184d9eb50cbc62e188ad334bf3498eec4955868195aec5b71311e785bb350c667c66ad9771b98f3d12b798f6a4f51d1e7e0718a1c254f6dde50750c09cb lfs64.patch
"

View file

@ -0,0 +1,17 @@
Author: Simon Frankenberger <simon-alpine@fraho.eu>
Subject: Fix compilation of jtreg / gtest objects with -Werror=format-security CFLAGS
Upstream: Yes / closed unresolved (https://bugs.openjdk.org/browse/JDK-8218814)
Remove the -Wno-format CLFAG for test objects
--- old/make/common/TestFilesCompilation.gmk
+++ new/make/common/TestFilesCompilation.gmk
@@ -109,7 +109,7 @@
CFLAGS := $$($1_BASE_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
CXXFLAGS := $$($1_BASE_CXXFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
- DISABLED_WARNINGS_gcc := format undef unused-function unused-value, \
+ DISABLED_WARNINGS_gcc := undef unused-function unused-value, \
DISABLED_WARNINGS_clang := undef format-nonliteral \
missing-field-initializers sometimes-uninitialized, \
LIBS := $$($1_LIBS_$$(name)), \

View file

@ -0,0 +1,53 @@
Author: Simon Frankenberger <simon-alpine@fraho.eu>
Subject: Disable failing tests
Upstream: Yes (https://bugs.openjdk.org/browse/JDK-8299245)
"Some gtests do not work well in non-debug build"
Disable failing tests as workaround
--- old/test/hotspot/gtest/runtime/test_os_linux.cpp
+++ new/test/hotspot/gtest/runtime/test_os_linux.cpp
@@ -439,6 +439,7 @@
#if !defined(__clang_major__) || (__clang_major__ >= 5) // DWARF does not support Clang versions older than 5.0.
// Test valid address of method ReportJNIFatalError in jniCheck.hpp. We should get "jniCheck.hpp" in the buffer and a valid line number.
+#if 0
TEST_VM(os_linux, decoder_get_source_info_valid) {
char buf[128] = "";
int line = -1;
@@ -447,6 +448,7 @@
ASSERT_TRUE(strcmp(buf, "jniCheck.hpp") == 0);
ASSERT_TRUE(line > 0);
}
+#endif
// Test invalid addresses. Should not cause harm and output buffer and line must contain "" and -1, respectively.
TEST_VM(os_linux, decoder_get_source_info_invalid) {
@@ -466,6 +468,7 @@
// Test with valid address but a too small buffer to store the entire filename. Should find generic <OVERFLOW> message
// and a valid line number.
+#if 0
TEST_VM(os_linux, decoder_get_source_info_valid_overflow) {
char buf[11] = "";
int line = -1;
@@ -474,9 +477,11 @@
ASSERT_TRUE(strcmp(buf, "<OVERFLOW>") == 0);
ASSERT_TRUE(line > 0);
}
+#endif
// Test with valid address but a too small buffer that can neither store the entire filename nor the generic <OVERFLOW>
// message. We should find "L" as filename and a valid line number.
+#if 0
TEST_VM(os_linux, decoder_get_source_info_valid_overflow_minimal) {
char buf[2] = "";
int line = -1;
@@ -485,6 +490,7 @@
ASSERT_TRUE(strcmp(buf, "L") == 0); // Overflow message does not fit, so we fall back to "L:line_number"
ASSERT_TRUE(line > 0); // Line should correctly be found and returned
}
+#endif
#endif // clang
#ifdef __GLIBC__

View file

@ -0,0 +1,71 @@
Patch-Source: https://github.com/openjdk/jdk22u/commit/9486b7c2303acd07b304a8bb9169d9e7d0acbf48.patch
--
From 9486b7c2303acd07b304a8bb9169d9e7d0acbf48 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jkratochvil@openjdk.org>
Date: Mon, 13 May 2024 20:47:25 +0000
Subject: [PATCH] 8324243: Compilation failures in java.desktop module with gcc
14
Backport-of: 8e5f6ddb68572c0cc8b6e256e423706f6f7cec94
---
make/modules/java.desktop/lib/Awt2dLibraries.gmk | 4 +++-
.../linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c | 2 +-
.../native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c | 2 +-
src/java.desktop/share/native/libfontmanager/sunFont.c | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index e274005e607..6fc9ed2fb2b 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -506,8 +506,10 @@ else
# noexcept-type required for GCC 7 builds. Not required for GCC 8+.
# expansion-to-defined required for GCC 9 builds. Not required for GCC 10+.
# maybe-uninitialized required for GCC 8 builds. Not required for GCC 9+.
+ # calloc-transposed-args required for GCC 14 builds. (fixed upstream in Harfbuzz 032c931e1c0cfb20f18e5acb8ba005775242bd92)
HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := class-memaccess noexcept-type \
- expansion-to-defined dangling-reference maybe-uninitialized
+ expansion-to-defined dangling-reference maybe-uninitialized \
+ calloc-transposed-args
HARFBUZZ_DISABLED_WARNINGS_clang := missing-field-initializers range-loop-analysis
HARFBUZZ_DISABLED_WARNINGS_microsoft := 4267 4244
diff --git a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
index 6ff6fc681e2..d7a3f1115b5 100644
--- a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
+++ b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
@@ -218,7 +218,7 @@ MidiMessage* MIDI_IN_GetMessage(MidiDeviceHandle* handle) {
return NULL;
}
}
- jdk_message = (MidiMessage*) calloc(sizeof(MidiMessage), 1);
+ jdk_message = (MidiMessage*) calloc(1, sizeof(MidiMessage));
if (!jdk_message) {
ERROR0("< ERROR: MIDI_IN_GetMessage(): out of memory\n");
return NULL;
diff --git a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
index d528e4869ac..96193b5f734 100644
--- a/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
+++ b/src/java.desktop/linux/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
@@ -383,7 +383,7 @@ INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
TRACE0("> openMidiDevice()\n");
- (*handle) = (MidiDeviceHandle*) calloc(sizeof(MidiDeviceHandle), 1);
+ (*handle) = (MidiDeviceHandle*) calloc(1, sizeof(MidiDeviceHandle));
if (!(*handle)) {
ERROR0("ERROR: openDevice: out of memory\n");
return MIDI_OUT_OF_MEMORY;
diff --git a/src/java.desktop/share/native/libfontmanager/sunFont.c b/src/java.desktop/share/native/libfontmanager/sunFont.c
index 0461d61c26c..b50a67e5c40 100644
--- a/src/java.desktop/share/native/libfontmanager/sunFont.c
+++ b/src/java.desktop/share/native/libfontmanager/sunFont.c
@@ -67,7 +67,7 @@ int isNullScalerContext(void *context) {
*/
JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage
(JNIEnv *env, jobject scaler, jlong pContext, jint glyphCode) {
- void *nullscaler = calloc(sizeof(GlyphInfo), 1);
+ void *nullscaler = calloc(1, sizeof(GlyphInfo));
return ptr_to_jlong(nullscaler);
}

View file

@ -0,0 +1,138 @@
Patch-Source: https://github.com/openjdk/jdk22u/commit/ccef462e5742ec2bbe015f3a90e5628b5251d9c9.patch
--
From ccef462e5742ec2bbe015f3a90e5628b5251d9c9 Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jkratochvil@openjdk.org>
Date: Mon, 13 May 2024 20:46:42 +0000
Subject: [PATCH] 8328997: Remove unnecessary template parameter lists in
GrowableArray
Backport-of: 3d2283800acee58dbf046c8b401a5a144ab65ed1
---
src/hotspot/share/utilities/growableArray.hpp | 32 +++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp
index e9abd9fae9a..22f7410ec32 100644
--- a/src/hotspot/share/utilities/growableArray.hpp
+++ b/src/hotspot/share/utilities/growableArray.hpp
@@ -118,7 +118,7 @@ class GrowableArrayView : public GrowableArrayBase {
protected:
E* _data; // data array
- GrowableArrayView<E>(E* data, int capacity, int initial_len) :
+ GrowableArrayView(E* data, int capacity, int initial_len) :
GrowableArrayBase(capacity, initial_len), _data(data) {}
~GrowableArrayView() {}
@@ -126,7 +126,7 @@ class GrowableArrayView : public GrowableArrayBase {
public:
const static GrowableArrayView EMPTY;
- bool operator==(const GrowableArrayView<E>& rhs) const {
+ bool operator==(const GrowableArrayView& rhs) const {
if (_len != rhs._len)
return false;
for (int i = 0; i < _len; i++) {
@@ -137,7 +137,7 @@ class GrowableArrayView : public GrowableArrayBase {
return true;
}
- bool operator!=(const GrowableArrayView<E>& rhs) const {
+ bool operator!=(const GrowableArrayView& rhs) const {
return !(*this == rhs);
}
@@ -357,7 +357,7 @@ template <typename E>
class GrowableArrayFromArray : public GrowableArrayView<E> {
public:
- GrowableArrayFromArray<E>(E* data, int len) :
+ GrowableArrayFromArray(E* data, int len) :
GrowableArrayView<E>(data, len, len) {}
};
@@ -492,7 +492,7 @@ class GrowableArrayWithAllocator : public GrowableArrayView<E> {
return this->at(location);
}
- void swap(GrowableArrayWithAllocator<E, Derived>* other) {
+ void swap(GrowableArrayWithAllocator* other) {
::swap(this->_data, other->_data);
::swap(this->_len, other->_len);
::swap(this->_capacity, other->_capacity);
@@ -694,8 +694,8 @@ class GrowableArrayMetadata {
// See: init_checks.
template <typename E>
-class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
- friend class GrowableArrayWithAllocator<E, GrowableArray<E> >;
+class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E>> {
+ friend class GrowableArrayWithAllocator<E, GrowableArray>;
friend class GrowableArrayTest;
static E* allocate(int max) {
@@ -743,7 +743,7 @@ class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
GrowableArray() : GrowableArray(2 /* initial_capacity */) {}
explicit GrowableArray(int initial_capacity) :
- GrowableArrayWithAllocator<E, GrowableArray<E> >(
+ GrowableArrayWithAllocator<E, GrowableArray>(
allocate(initial_capacity),
initial_capacity),
_metadata() {
@@ -751,7 +751,7 @@ class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
}
GrowableArray(int initial_capacity, MEMFLAGS memflags) :
- GrowableArrayWithAllocator<E, GrowableArray<E> >(
+ GrowableArrayWithAllocator<E, GrowableArray>(
allocate(initial_capacity, memflags),
initial_capacity),
_metadata(memflags) {
@@ -759,7 +759,7 @@ class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
}
GrowableArray(int initial_capacity, int initial_len, const E& filler) :
- GrowableArrayWithAllocator<E, GrowableArray<E> >(
+ GrowableArrayWithAllocator<E, GrowableArray>(
allocate(initial_capacity),
initial_capacity, initial_len, filler),
_metadata() {
@@ -767,7 +767,7 @@ class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
}
GrowableArray(int initial_capacity, int initial_len, const E& filler, MEMFLAGS memflags) :
- GrowableArrayWithAllocator<E, GrowableArray<E> >(
+ GrowableArrayWithAllocator<E, GrowableArray>(
allocate(initial_capacity, memflags),
initial_capacity, initial_len, filler),
_metadata(memflags) {
@@ -775,7 +775,7 @@ class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
}
GrowableArray(Arena* arena, int initial_capacity, int initial_len, const E& filler) :
- GrowableArrayWithAllocator<E, GrowableArray<E> >(
+ GrowableArrayWithAllocator<E, GrowableArray>(
allocate(initial_capacity, arena),
initial_capacity, initial_len, filler),
_metadata(arena) {
@@ -859,15 +859,15 @@ class GrowableArrayIterator : public StackObj {
public:
GrowableArrayIterator() : _array(nullptr), _position(0) { }
- GrowableArrayIterator<E>& operator++() { ++_position; return *this; }
- E operator*() { return _array->at(_position); }
+ GrowableArrayIterator& operator++() { ++_position; return *this; }
+ E operator*() { return _array->at(_position); }
- bool operator==(const GrowableArrayIterator<E>& rhs) {
+ bool operator==(const GrowableArrayIterator& rhs) {
assert(_array == rhs._array, "iterator belongs to different array");
return _position == rhs._position;
}
- bool operator!=(const GrowableArrayIterator<E>& rhs) {
+ bool operator!=(const GrowableArrayIterator& rhs) {
assert(_array == rhs._array, "iterator belongs to different array");
return _position != rhs._position;
}

View file

@ -0,0 +1,68 @@
Patch-Source: https://github.com/openjdk/jdk22u/commit/2ec7dbf18e7d6bd746a82d61cd787d6344d3314e.patch
--
From 2ec7dbf18e7d6bd746a82d61cd787d6344d3314e Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jkratochvil@openjdk.org>
Date: Mon, 13 May 2024 20:47:07 +0000
Subject: [PATCH] 8331352: error: template-id not allowed for
constructor/destructor in C++20
Backport-of: 45792c5829fb1d5ee016c4a1fd6badb5d2b4239c
---
src/hotspot/share/gc/z/zArray.inline.hpp | 2 +-
src/hotspot/share/utilities/chunkedList.hpp | 2 +-
src/hotspot/share/utilities/events.hpp | 2 +-
src/hotspot/share/utilities/linkedlist.hpp | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/hotspot/share/gc/z/zArray.inline.hpp b/src/hotspot/share/gc/z/zArray.inline.hpp
index e4de7a37040..2ec87a76156 100644
--- a/src/hotspot/share/gc/z/zArray.inline.hpp
+++ b/src/hotspot/share/gc/z/zArray.inline.hpp
@@ -96,7 +96,7 @@ ZActivatedArray<T>::ZActivatedArray(bool locked)
_array() {}
template <typename T>
-ZActivatedArray<T>::~ZActivatedArray<T>() {
+ZActivatedArray<T>::~ZActivatedArray() {
FreeHeap(_lock);
}
diff --git a/src/hotspot/share/utilities/chunkedList.hpp b/src/hotspot/share/utilities/chunkedList.hpp
index 81898ac53b2..9a600e4ce1b 100644
--- a/src/hotspot/share/utilities/chunkedList.hpp
+++ b/src/hotspot/share/utilities/chunkedList.hpp
@@ -44,7 +44,7 @@ template <class T, MEMFLAGS F> class ChunkedList : public CHeapObj<F> {
}
public:
- ChunkedList<T, F>() : _top(_values), _next_used(nullptr), _next_free(nullptr) {}
+ ChunkedList() : _top(_values), _next_used(nullptr), _next_free(nullptr) {}
bool is_full() const {
return _top == end();
diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp
index b400fd707fa..f7d2d193a86 100644
--- a/src/hotspot/share/utilities/events.hpp
+++ b/src/hotspot/share/utilities/events.hpp
@@ -99,7 +99,7 @@ template <class T> class EventLogBase : public EventLog {
EventRecord<T>* _records;
public:
- EventLogBase<T>(const char* name, const char* handle, int length = LogEventsBufferEntries):
+ EventLogBase(const char* name, const char* handle, int length = LogEventsBufferEntries):
_mutex(Mutex::event, name),
_name(name),
_handle(handle),
diff --git a/src/hotspot/share/utilities/linkedlist.hpp b/src/hotspot/share/utilities/linkedlist.hpp
index 5b8e258d539..eec7ea1e48d 100644
--- a/src/hotspot/share/utilities/linkedlist.hpp
+++ b/src/hotspot/share/utilities/linkedlist.hpp
@@ -82,7 +82,7 @@ template <class E> class LinkedListNode : public AnyObj {
template <class E> class LinkedList : public AnyObj {
protected:
LinkedListNode<E>* _head;
- NONCOPYABLE(LinkedList<E>);
+ NONCOPYABLE(LinkedList);
public:
LinkedList() : _head(nullptr) { }

View file

@ -0,0 +1,10 @@
--- a/src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp
+++ b/src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp
@@ -72,7 +72,6 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
-# include <fpu_control.h>
#define REG_SP 3
#define REG_FP 22

View file

@ -0,0 +1,145 @@
diff --git a/src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c b/src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c
index 02d3c57f..efbd0ca5 100644
--- a/src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c
+++ b/src/java.base/linux/native/libnio/ch/FileDispatcherImpl.c
@@ -114,7 +114,7 @@ Java_sun_nio_ch_FileDispatcherImpl_transferTo0(JNIEnv *env, jobject this,
return n;
}
- n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
+ n = sendfile(dstFD, srcFD, &offset, (size_t)count);
if (n < 0) {
if (errno == EAGAIN)
return IOS_UNAVAILABLE;
diff --git a/src/java.base/linux/native/libnio/fs/LinuxNativeDispatcher.c b/src/java.base/linux/native/libnio/fs/LinuxNativeDispatcher.c
index 95f78ffa..c90e99dd 100644
--- a/src/java.base/linux/native/libnio/fs/LinuxNativeDispatcher.c
+++ b/src/java.base/linux/native/libnio/fs/LinuxNativeDispatcher.c
@@ -211,7 +211,7 @@ Java_sun_nio_fs_LinuxNativeDispatcher_directCopy0
}
do {
- RESTARTABLE(sendfile64(dst, src, NULL, count), bytes_sent);
+ RESTARTABLE(sendfile(dst, src, NULL, count), bytes_sent);
if (bytes_sent < 0) {
if (errno == EAGAIN)
return IOS_UNAVAILABLE;
diff --git a/src/hotspot/os/linux/attachListener_linux.cpp b/src/hotspot/os/linux/attachListener_linux.cpp
index 41a24c450..f9db87476 100644
--- a/src/hotspot/os/linux/attachListener_linux.cpp
+++ b/src/hotspot/os/linux/attachListener_linux.cpp
@@ -446,14 +446,14 @@ AttachOperation* AttachListener::dequeue() {
void AttachListener::vm_start() {
char fn[UNIX_PATH_MAX];
- struct stat64 st;
+ struct stat st;
int ret;
int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id());
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");
- RESTARTABLE(::stat64(fn, &st), ret);
+ RESTARTABLE(::stat(fn, &st), ret);
if (ret == 0) {
ret = ::unlink(fn);
if (ret == -1) {
@@ -473,8 +473,8 @@ int AttachListener::pd_init() {
bool AttachListener::check_socket_file() {
int ret;
- struct stat64 st;
- ret = stat64(LinuxAttachListener::path(), &st);
+ struct stat st;
+ ret = stat(LinuxAttachListener::path(), &st);
if (ret == -1) { // need to restart attach listener.
log_debug(attach)("Socket file %s does not exist - Restart Attach Listener",
LinuxAttachListener::path());
@@ -513,14 +513,14 @@ bool AttachListener::is_init_trigger() {
}
char fn[PATH_MAX + 1];
int ret;
- struct stat64 st;
+ struct stat st;
os::snprintf_checked(fn, sizeof(fn), ".attach_pid%d", os::current_process_id());
- RESTARTABLE(::stat64(fn, &st), ret);
+ RESTARTABLE(::stat(fn, &st), ret);
if (ret == -1) {
log_trace(attach)("Failed to find attach file: %s, trying alternate", fn);
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
os::get_temp_directory(), os::current_process_id());
- RESTARTABLE(::stat64(fn, &st), ret);
+ RESTARTABLE(::stat(fn, &st), ret);
if (ret == -1) {
log_debug(attach)("Failed to find attach file: %s", fn);
}
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 3e421c369..90240ed81 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -4259,7 +4259,7 @@ jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
// the number of bytes written to out_fd is returned if transfer was successful
// otherwise, returns -1 that implies an error
jlong os::Linux::sendfile(int out_fd, int in_fd, jlong* offset, jlong count) {
- return ::sendfile64(out_fd, in_fd, (off64_t*)offset, (size_t)count);
+ return ::sendfile(out_fd, in_fd, (off_t*)offset, (size_t)count);
}
// Determine if the vmid is the parent pid for a child in a PID namespace.
@@ -4975,13 +4975,13 @@ int os::open(const char *path, int oflag, int mode) {
oflag |= O_CLOEXEC;
#endif
- int fd = ::open64(path, oflag, mode);
+ int fd = ::open(path, oflag, mode);
if (fd == -1) return -1;
//If the open succeeded, the file might still be a directory
{
- struct stat64 buf64;
- int ret = ::fstat64(fd, &buf64);
+ struct stat buf64;
+ int ret = ::fstat(fd, &buf64);
int st_mode = buf64.st_mode;
if (ret != -1) {
@@ -5019,17 +5019,17 @@ int os::open(const char *path, int oflag, int mode) {
int os::create_binary_file(const char* path, bool rewrite_existing) {
int oflags = O_WRONLY | O_CREAT;
oflags |= rewrite_existing ? O_TRUNC : O_EXCL;
- return ::open64(path, oflags, S_IREAD | S_IWRITE);
+ return ::open(path, oflags, S_IREAD | S_IWRITE);
}
// return current position of file pointer
jlong os::current_file_offset(int fd) {
- return (jlong)::lseek64(fd, (off64_t)0, SEEK_CUR);
+ return (jlong)::lseek(fd, (off_t)0, SEEK_CUR);
}
// move file pointer to the specified offset
jlong os::seek_to_file_offset(int fd, jlong offset) {
- return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET);
+ return (jlong)::lseek(fd, (off_t)offset, SEEK_SET);
}
// Map a block of memory.
diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp
index 960fb4655..8eacc8d0a 100644
--- a/src/hotspot/os/posix/os_posix.cpp
+++ b/src/hotspot/os/posix/os_posix.cpp
@@ -756,11 +756,11 @@ void os::dll_unload(void *lib) {
}
jlong os::lseek(int fd, jlong offset, int whence) {
- return (jlong) BSD_ONLY(::lseek) NOT_BSD(::lseek64)(fd, offset, whence);
+ return (jlong)::lseek(fd, offset, whence);
}
int os::ftruncate(int fd, jlong length) {
- return BSD_ONLY(::ftruncate) NOT_BSD(::ftruncate64)(fd, length);
+ return ::ftruncate(fd, length);
}
const char* os::get_current_directory(char *buf, size_t buflen) {