Skip to content

Commit 9d971d7

Browse files
committed
Merge
2 parents a385354 + 705ad7d commit 9d971d7

File tree

713 files changed

+25629
-14452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

713 files changed

+25629
-14452
lines changed

make/autoconf/basic_tools.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
4949
UTIL_REQUIRE_PROGS(WC, wc)
5050
5151
# Required tools with some special treatment
52+
UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
5253
UTIL_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP])
5354
UTIL_REQUIRE_SPECIAL(SED, [AC_PROG_SED])
5455
@@ -94,7 +95,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_TOOLS],
9495
UTIL_REQUIRE_PROGS(XARGS, xargs)
9596
9697
# Required tools with some special treatment
97-
UTIL_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
9898
UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])
9999
100100
# Optional tools, we can do without them

make/autoconf/buildjdk-spec.gmk.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@ JVM_FEATURES_server := cds compiler1 compiler2 g1gc serialgc
103103
override EXTRA_CFLAGS :=
104104
override EXTRA_CXXFLAGS :=
105105
override EXTRA_LDFLAGS :=
106+
107+
# hsdis is not needed
108+
HSDIS_BACKEND := none
109+
ENABLE_HSDIS_BUNDLING := false

make/autoconf/configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
223223
# LeakSanitizer
224224
JDKOPT_SETUP_LEAK_SANITIZER
225225

226+
# Fallback linker
227+
# This needs to go before 'LIB_DETERMINE_DEPENDENCIES'
228+
JDKOPT_SETUP_FALLBACK_LINKER
229+
226230
###############################################################################
227231
#
228232
# Check dependencies for external and internal libraries.

make/autoconf/jdk-options.m4

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,3 +903,22 @@ AC_DEFUN([JDKOPT_SETUP_MACOSX_SIGNING],
903903
AC_SUBST(MACOSX_CODESIGN_MODE)
904904
fi
905905
])
906+
907+
################################################################################
908+
#
909+
# fallback linker
910+
#
911+
AC_DEFUN_ONCE([JDKOPT_SETUP_FALLBACK_LINKER],
912+
[
913+
FALLBACK_LINKER_DEFAULT=false
914+
915+
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
916+
FALLBACK_LINKER_DEFAULT=true
917+
fi
918+
919+
UTIL_ARG_ENABLE(NAME: fallback-linker, DEFAULT: $FALLBACK_LINKER_DEFAULT,
920+
RESULT: ENABLE_FALLBACK_LINKER,
921+
DESC: [enable libffi-based fallback implementation of java.lang.foreign.Linker],
922+
CHECKING_MSG: [if fallback linker enabled])
923+
AC_SUBST(ENABLE_FALLBACK_LINKER)
924+
])

make/autoconf/libraries.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
8282
fi
8383
8484
# Check if ffi is needed
85-
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
85+
if HOTSPOT_CHECK_JVM_VARIANT(zero) || test "x$ENABLE_FALLBACK_LINKER" = "xtrue"; then
8686
NEEDS_LIB_FFI=true
8787
else
8888
NEEDS_LIB_FFI=false

make/autoconf/spec.gmk.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ TEST_JOBS?=@TEST_JOBS@
409409
DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@
410410
DEFAULT_LOG:=@DEFAULT_LOG@
411411

412+
# Fallback linker
413+
ENABLE_FALLBACK_LINKER:=@ENABLE_FALLBACK_LINKER@
414+
412415
FREETYPE_TO_USE:=@FREETYPE_TO_USE@
413416
FREETYPE_LIBS:=@FREETYPE_LIBS@
414417
FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@

make/conf/jib-profiles.js

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,21 +587,23 @@ var getJibProfilesProfiles = function (input, common, data) {
587587
"linux-x64-zero": {
588588
target_os: "linux",
589589
target_cpu: "x64",
590-
dependencies: ["devkit", "gtest"],
590+
dependencies: ["devkit", "gtest", "libffi"],
591591
configure_args: concat(common.configure_args_64bit, [
592592
"--with-zlib=system",
593593
"--with-jvm-variants=zero",
594-
"--enable-libffi-bundling"
594+
"--with-libffi=" + input.get("libffi", "home_path"),
595+
"--enable-libffi-bundling",
595596
])
596597
},
597598

598599
"linux-aarch64-zero": {
599600
target_os: "linux",
600601
target_cpu: "aarch64",
601-
dependencies: ["devkit", "gtest"],
602+
dependencies: ["devkit", "gtest", "libffi"],
602603
configure_args: concat(common.configure_args_64bit, [
603604
"--with-zlib=system",
604605
"--with-jvm-variants=zero",
606+
"--with-libffi=" + input.get("libffi", "home_path"),
605607
"--enable-libffi-bundling"
606608
])
607609
},
@@ -610,10 +612,11 @@ var getJibProfilesProfiles = function (input, common, data) {
610612
target_os: "linux",
611613
target_cpu: "x86",
612614
build_cpu: "x64",
613-
dependencies: ["devkit", "gtest"],
615+
dependencies: ["devkit", "gtest", "libffi"],
614616
configure_args: concat(common.configure_args_32bit, [
615617
"--with-zlib=system",
616618
"--with-jvm-variants=zero",
619+
"--with-libffi=" + input.get("libffi", "home_path"),
617620
"--enable-libffi-bundling"
618621
])
619622
}
@@ -744,6 +747,40 @@ var getJibProfilesProfiles = function (input, common, data) {
744747
common.debug_profile_artifacts(artifactData[name]));
745748
});
746749

750+
// Define artifact just for linux-x64-zero, which is the only one we test on
751+
["linux-x64"].forEach(function (name) {
752+
var o = artifactData[name]
753+
var pf = o.platform
754+
var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
755+
var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
756+
var zeroName = name + "-zero";
757+
profiles[zeroName].artifacts = {
758+
jdk: {
759+
local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
760+
remote: [
761+
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-zero." + jdk_suffix,
762+
],
763+
subdir: jdk_subdir,
764+
exploded: "images/jdk",
765+
},
766+
test: {
767+
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
768+
remote: [
769+
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-zero-tests.tar.gz",
770+
],
771+
exploded: "images/test"
772+
},
773+
jdk_symbols: {
774+
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
775+
remote: [
776+
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-zero-symbols.tar.gz",
777+
],
778+
subdir: jdk_subdir,
779+
exploded: "images/jdk"
780+
},
781+
};
782+
});
783+
747784
buildJdkDep = input.build_os + "-" + input.build_cpu + ".jdk";
748785
docsProfiles = {
749786
"docs": {
@@ -1234,6 +1271,13 @@ var getJibProfilesDependencies = function (input, common) {
12341271
ext: "tar.gz",
12351272
revision: "1.13.0+1.0"
12361273
},
1274+
1275+
libffi: {
1276+
organization: common.organization,
1277+
module: "libffi-" + input.target_platform,
1278+
ext: "tar.gz",
1279+
revision: "3.4.2+1.0"
1280+
},
12371281
};
12381282

12391283
return dependencies;

make/data/hotspot-symbols/symbols-shared

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -30,5 +30,6 @@ jio_vsnprintf
3030
JNI_CreateJavaVM
3131
JNI_GetCreatedJavaVMs
3232
JNI_GetDefaultJavaVMInitArgs
33+
JVM_IsForeignLinkerSupported
3334
JVM_FindClassFromBootLoader
3435
JVM_InitAgentProperties

make/data/hotspot-symbols/symbols-unix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -217,6 +217,8 @@ JVM_DefineModule
217217
JVM_SetBootLoaderUnnamedModule
218218

219219
# Virtual thread notifications for JVMTI
220+
JVM_VirtualThreadStart
221+
JVM_VirtualThreadEnd
220222
JVM_VirtualThreadMount
221223
JVM_VirtualThreadUnmount
222224
JVM_VirtualThreadHideFrames

make/devkit/createLibffiBundle.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
4+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5+
#
6+
# This code is free software; you can redistribute it and/or modify it
7+
# under the terms of the GNU General Public License version 2 only, as
8+
# published by the Free Software Foundation. Oracle designates this
9+
# particular file as subject to the "Classpath" exception as provided
10+
# by Oracle in the LICENSE file that accompanied this code.
11+
#
12+
# This code is distributed in the hope that it will be useful, but WITHOUT
13+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
# version 2 for more details (a copy is included in the LICENSE file that
16+
# accompanied this code).
17+
#
18+
# You should have received a copy of the GNU General Public License version
19+
# 2 along with this work; if not, write to the Free Software Foundation,
20+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21+
#
22+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23+
# or visit www.oracle.com if you need additional information or have any
24+
# questions.
25+
#
26+
27+
# This script generates a libffi bundle. On linux by building it from source
28+
# using a devkit, which should match the devkit used to build the JDK.
29+
#
30+
# Set MAKE_ARGS to add parameters to make. Ex:
31+
#
32+
# $ MAKE_ARGS=-j32 bash createLibffiBundle.sh
33+
#
34+
# The script tries to behave well on multiple invocations, only performing steps
35+
# not already done. To redo a step, manually delete the target files from that
36+
# step.
37+
#
38+
# Note that the libtool and texinfo packages are needed to build libffi
39+
# $ sudo apt install libtool texinfo
40+
41+
LIBFFI_VERSION=3.4.2
42+
43+
BUNDLE_NAME=libffi-$LIBFFI_VERSION.tar.gz
44+
45+
SCRIPT_FILE="$(basename $0)"
46+
SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
47+
OUTPUT_DIR="${SCRIPT_DIR}/../../build/libffi"
48+
SRC_DIR="$OUTPUT_DIR/src"
49+
DOWNLOAD_DIR="$OUTPUT_DIR/download"
50+
INSTALL_DIR="$OUTPUT_DIR/install"
51+
IMAGE_DIR="$OUTPUT_DIR/image"
52+
53+
USAGE="$0 <devkit dir>"
54+
55+
if [ "$1" = "" ]; then
56+
echo $USAGE
57+
exit 1
58+
fi
59+
DEVKIT_DIR="$1"
60+
61+
# Download source distros
62+
mkdir -p $DOWNLOAD_DIR
63+
cd $DOWNLOAD_DIR
64+
SOURCE_TAR=v$LIBFFI_VERSION.tar.gz
65+
if [ ! -f $SOURCE_TAR ]; then
66+
wget https://github.com/libffi/libffi/archive/refs/tags/v$LIBFFI_VERSION.tar.gz
67+
fi
68+
69+
# Unpack src
70+
mkdir -p $SRC_DIR
71+
cd $SRC_DIR
72+
LIBFFI_DIRNAME=libffi-$LIBFFI_VERSION
73+
LIBFFI_DIR=$SRC_DIR/$LIBFFI_DIRNAME
74+
if [ ! -d $LIBFFI_DIRNAME ]; then
75+
echo "Unpacking $SOURCE_TAR"
76+
tar xf $DOWNLOAD_DIR/$SOURCE_TAR
77+
fi
78+
79+
# Build
80+
cd $LIBFFI_DIR
81+
if [ ! -e $LIBFFI_DIR/configure ]; then
82+
bash ./autogen.sh
83+
fi
84+
# For Linux/x86, add --build=i686-pc-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32
85+
bash ./configure --prefix=$INSTALL_DIR CC=$DEVKIT_DIR/bin/gcc CXX=$DEVKIT_DIR/bin/g++
86+
87+
# Run with nice to keep system usable during build.
88+
nice make $MAKE_ARGS install
89+
90+
mkdir -p $IMAGE_DIR
91+
# Extract what we need into an image
92+
if [ ! -e $IMAGE_DIR/lib/libffi.so ]; then
93+
echo "Copying libffi.so* to image"
94+
mkdir -p $IMAGE_DIR/lib
95+
# For Linux/x86 it's under /lib/ instead of /lib64/
96+
cp -a $INSTALL_DIR/lib64/libffi.so* $IMAGE_DIR/lib/
97+
fi
98+
if [ ! -e $IMAGE_DIR/include/ ]; then
99+
echo "Copying include to image"
100+
mkdir -p $IMAGE_DIR/include
101+
cp -a $INSTALL_DIR/include/. $IMAGE_DIR/include/
102+
fi
103+
if [ ! -e $IMAGE_DIR/$SCRIPT_FILE ]; then
104+
echo "Copying this script to image"
105+
cp -a $SCRIPT_DIR/$SCRIPT_FILE $IMAGE_DIR/
106+
fi
107+
108+
# Create bundle
109+
if [ ! -e $OUTPUT_DIR/$BUNDLE_NAME ]; then
110+
echo "Creating $OUTPUT_DIR/$BUNDLE_NAME"
111+
cd $IMAGE_DIR
112+
tar zcf $OUTPUT_DIR/$BUNDLE_NAME *
113+
fi

0 commit comments

Comments
 (0)