Skip to content

Commit 5b2f439

Browse files
authored
Merge pull request #238 from taoliult/OpenJCEPlus
Integrate OpenJCEPlus into Semeru OpenJDK
2 parents b62222a + ca85bb0 commit 5b2f439

File tree

13 files changed

+301
-5
lines changed

13 files changed

+301
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# exclude all source directories
2222
/omr
2323
/openj9
24+
/OpenJCEPlus
2425
/openssl
2526
# exclude optional eclipse project file
2627
/.project

closed/GensrcJ9JCL.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $(eval $(call SetupCopyFiles,COPY_OVERLAY_FILES, \
4949
src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java \
5050
src/java.base/share/classes/jdk/internal/access/JavaNetInetAddressAccess.java \
5151
src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java \
52+
src/java.base/share/classes/module-info.java \
5253
src/java.base/share/classes/sun/security/jca/ProviderConfig.java \
5354
src/java.base/share/classes/sun/security/jca/ProviderList.java \
5455
src/java.base/share/classes/sun/security/provider/DigestBase.java \

closed/JPP.gmk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ ifeq (true,$(OPENJ9_ENABLE_INLINE_TYPES))
3434
JPP_TAGS += INLINE-TYPES
3535
endif # OPENJ9_ENABLE_INLINE_TYPES
3636

37+
ifeq (true,$(BUILD_OPENJCEPLUS))
38+
JPP_TAGS += OPENJCEPLUS_SUPPORT
39+
endif # BUILD_OPENJCEPLUS
40+
3741
# invoke JPP to preprocess java source files
3842
# $1 - configuration
3943
# $2 - source directory

closed/autoconf/custom-hook.m4

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
5252
OPENJ9_CONFIGURE_INLINE_TYPES
5353
OPENJ9_THIRD_PARTY_REQUIREMENTS
5454
OPENJ9_CHECK_NASM_VERSION
55+
OPENJCEPLUS_SETUP
5556
])
5657

5758
AC_DEFUN([OPENJ9_CONFIGURE_CMAKE],
@@ -818,3 +819,28 @@ AC_DEFUN([OPENJ9_GENERATE_TOOL_WRAPPERS],
818819
OPENJ9_GENERATE_TOOL_WRAPPER([nasm], [$NASM])
819820
OPENJ9_GENERATE_TOOL_WRAPPER([rc], [$RC])
820821
])
822+
823+
AC_DEFUN([OPENJCEPLUS_SETUP],
824+
[
825+
AC_ARG_ENABLE([openjceplus], [AS_HELP_STRING([--enable-openjceplus],
826+
[enable OpenJCEPlus integration @<:@disabled@:>@])])
827+
AC_MSG_CHECKING([for OpenJCEPlus])
828+
if test "x$enable_openjceplus" = xyes ; then
829+
if test -d "$TOPDIR/OpenJCEPlus" ; then
830+
AC_MSG_RESULT([yes (explicitly set)])
831+
BUILD_OPENJCEPLUS=true
832+
else
833+
AC_MSG_RESULT([no])
834+
AC_MSG_ERROR([OpenJCEPlus not found at $TOPDIR/OpenJCEPlus])
835+
fi
836+
elif test "x$enable_openjceplus" = xno ; then
837+
AC_MSG_RESULT([no])
838+
BUILD_OPENJCEPLUS=false
839+
elif test "x$enable_openjceplus" = x ; then
840+
AC_MSG_RESULT([no (default)])
841+
BUILD_OPENJCEPLUS=false
842+
else
843+
AC_MSG_ERROR([--enable-openjceplus accepts no argument])
844+
fi
845+
AC_SUBST(BUILD_OPENJCEPLUS)
846+
])

closed/autoconf/custom-spec.gmk.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ WARNING_MODULES := \
5252
openj9.dtfj \
5353
openj9.dtfjview \
5454
openj9.traceformat \
55+
openjceplus \
5556
#
5657

5758
ifneq (,$(filter $(WARNING_MODULES),$(MODULE)))
@@ -182,3 +183,7 @@ J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl.done
182183

183184
# Disable all hotspot features.
184185
JVM_FEATURES_server :=
186+
187+
# Required by OpenJCEPlus.
188+
BUILD_OPENJCEPLUS := @BUILD_OPENJCEPLUS@
189+
OPENJCEPLUS_TOPDIR := $(TOPDIR)/OpenJCEPlus

closed/custom/Images-pre.gmk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ===========================================================================
2-
# (c) Copyright IBM Corp. 2020, 2021 All Rights Reserved
2+
# (c) Copyright IBM Corp. 2020, 2023 All Rights Reserved
33
# ===========================================================================
44
# This code is free software; you can redistribute it and/or modify it
55
# under the terms of the GNU General Public License version 2 only, as
@@ -24,4 +24,5 @@ JRE_MODULES += \
2424
openj9.dataaccess \
2525
openj9.dtfj \
2626
openj9.gpu \
27+
$(if $(call equals, $(BUILD_OPENJCEPLUS), true), openjceplus) \
2728
#

closed/custom/Main.gmk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,23 @@ ifneq (,$(HEALTHCENTER_JAR))
119119
# The content must be extracted before module-info can be compiled.
120120
ibm.healthcenter-java : ibm.healthcenter-copy
121121
endif # HEALTHCENTER_JAR
122+
123+
ifeq (true,$(BUILD_OPENJCEPLUS))
124+
125+
ifeq ($(call And, $(call isTargetOs, windows) $(call isTargetCpu, x86_64)), true)
126+
OPENJCEPLUS_JGSKIT_MAKE := jgskit.win64.mak
127+
else
128+
OPENJCEPLUS_JGSKIT_MAKE := jgskit.mak
129+
endif
130+
131+
openjceplus-copy : openjceplus-libs
132+
133+
.PHONY : openjceplus-clean
134+
135+
openjceplus-clean :
136+
@$(ECHO) Cleaning OpenJCEPlus native code
137+
$(MAKE) -C $(OPENJCEPLUS_TOPDIR)/src/main/native -f $(OPENJCEPLUS_JGSKIT_MAKE) cleanAll
138+
139+
clean-openjceplus : openjceplus-clean
140+
141+
endif # BUILD_OPENJCEPLUS

closed/custom/common/Modules.gmk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ===========================================================================
2-
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
2+
# (c) Copyright IBM Corp. 2017, 2023 All Rights Reserved
33
# ===========================================================================
44
# This code is free software; you can redistribute it and/or modify it
55
# under the terms of the GNU General Public License version 2 only, as
@@ -56,6 +56,10 @@ TOP_SRC_DIRS += \
5656
$(J9JCL_SOURCES_DIR) \
5757
#
5858

59+
ifeq (true,$(BUILD_OPENJCEPLUS))
60+
TOP_SRC_DIRS += $(OPENJCEPLUS_TOPDIR)/src/main
61+
endif
62+
5963
.PHONY : generate-j9jcl-sources
6064

6165
generate-j9jcl-sources $(J9JCL_SOURCES_DONEFILE) :

closed/get_j9_source.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ usage() {
3939
echo " -omr-branch the OpenJ9/omr git branch: openj9"
4040
echo " -omr-sha a commit SHA for the omr repository"
4141
echo " -omr-reference a local repo to use as a clone reference"
42+
echo " -openjceplus-repo the OpenJCEPlus repository url"
43+
echo " -openjceplus-branch the OpenJCEPlus git branch"
44+
echo " -openjceplus-sha a commit SHA for the OpenJCEPlus repository"
45+
echo " -openjceplus-reference a local repo to use as a clone reference"
46+
echo " -gskit-bin the GSKit binary url"
47+
echo " -gskit-sdk-bin the GSKIT SDK binary url"
48+
echo " -gskit-credential the credential for downloading the GSKit binaries"
4249
echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false"
4350
echo ""
4451
exit 1
@@ -108,6 +115,34 @@ for i in "$@" ; do
108115
references[omr]="${i#*=}"
109116
;;
110117

118+
-openjceplus-repo=* )
119+
git_urls[OpenJCEPlus]="${i#*=}"
120+
;;
121+
122+
-openjceplus-branch=* )
123+
branches[OpenJCEPlus]="${i#*=}"
124+
;;
125+
126+
-openjceplus-sha=* )
127+
shas[OpenJCEPlus]="${i#*=}"
128+
;;
129+
130+
-openjceplus-reference=* )
131+
references[OpenJCEPlus]="${i#*=}"
132+
;;
133+
134+
-gskit-bin=* )
135+
gskit_bin="${i#*=}"
136+
;;
137+
138+
-gskit-sdk-bin=* )
139+
gskit_sdk_bin="${i#*=}"
140+
;;
141+
142+
-gskit-credential=* )
143+
gskit_credential="${i#*=}"
144+
;;
145+
111146
-parallel=* )
112147
pflag="${i#*=}"
113148
;;
@@ -173,6 +208,37 @@ if [ ${pflag} = true ] ; then
173208
wait
174209
fi
175210

211+
# Download OCK binaries and create Java module folder.
212+
openjceplus_source=OpenJCEPlus
213+
if [ -n "${git_urls[$openjceplus_source]}" ] ; then
214+
215+
echo
216+
echo "$openjceplus_source exists, download OCK binaries"
217+
echo
218+
219+
cd $openjceplus_source
220+
mkdir -p ock/jgsk_sdk/lib64
221+
222+
if [ -n "$gskit_credential" ] ; then
223+
curl -u "$gskit_credential" $gskit_bin > ock/jgsk_crypto.tar
224+
curl -u "$gskit_credential" $gskit_sdk_bin > ock/jgsk_crypto_sdk.tar
225+
else
226+
echo
227+
echo "GSKit binaries are needed for compiling $openjceplus_source"
228+
echo "Please set -gskit-bin, -gskit-sdk-bin, and -gskit-credential"
229+
exit 1
230+
fi
231+
232+
tar -xf ock/jgsk_crypto_sdk.tar -C ock
233+
tar -xf ock/jgsk_crypto.tar -C ock/jgsk_sdk/lib64
234+
235+
# Create OpenJCEPlus Java module folder.
236+
mkdir -p src/main/openjceplus/share/classes
237+
cp -r src/main/java/* src/main/openjceplus/share/classes/
238+
239+
cd ..
240+
fi
241+
176242
END_TIME=$(date +%s)
177243
date "+[%F %T] OpenJ9 clone repositories finished in $(($END_TIME - $START_TIME)) seconds"
178244

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ===========================================================================
2+
# (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
3+
# ===========================================================================
4+
# This code is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License version 2 only, as
6+
# published by the Free Software Foundation.
7+
#
8+
# IBM designates this particular file as subject to the "Classpath" exception
9+
# as provided by IBM in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
19+
# ===========================================================================
20+
21+
include $(TOPDIR)/closed/CopySupport.gmk
22+
23+
ifeq (true,$(BUILD_OPENJCEPLUS))
24+
# Copy OpenJCEPlus native libraries.
25+
$(eval $(call SetupCopyFiles, OPENJCEPLUS_JGSKIT_LIBS_COPY, \
26+
SRC := $(OPENJCEPLUS_TOPDIR)/target, \
27+
FILES := $(filter %.dll %.so %.x, $(call FindFiles, $(OPENJCEPLUS_TOPDIR)/target)), \
28+
FLATTEN := true, \
29+
DEST := $(LIB_DST_DIR), \
30+
))
31+
32+
TARGETS += $(OPENJCEPLUS_JGSKIT_LIBS_COPY)
33+
34+
# Bundle GSKIT library.
35+
OPENJCEPLUS_OCK_DIR := $(OPENJCEPLUS_TOPDIR)/ock/jgsk_sdk/lib64
36+
ifeq ($(call isTargetOs, windows), true)
37+
OPENJCEPLUS_OCK_SUB_DIR := modules_cmds
38+
else
39+
OPENJCEPLUS_OCK_SUB_DIR := modules_libs
40+
endif
41+
42+
$(eval $(call SetupCopyFiles, OPENJCEPLUS_OCK_COPY, \
43+
SRC := $(OPENJCEPLUS_OCK_DIR), \
44+
DEST := $(SUPPORT_OUTPUTDIR)/$(OPENJCEPLUS_OCK_SUB_DIR)/$(MODULE), \
45+
FILES := $(call FindFiles, $(OPENJCEPLUS_OCK_DIR)), \
46+
))
47+
48+
TARGETS += $(OPENJCEPLUS_OCK_COPY)
49+
endif # BUILD_OPENJCEPLUS
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ===========================================================================
2+
# (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
3+
# ===========================================================================
4+
# This code is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License version 2 only, as
6+
# published by the Free Software Foundation.
7+
#
8+
# IBM designates this particular file as subject to the "Classpath" exception
9+
# as provided by IBM in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
19+
# ===========================================================================
20+
21+
include LibCommon.gmk
22+
23+
ifeq (true,$(BUILD_OPENJCEPLUS))
24+
25+
# Identify the desired JGSKIT target platform.
26+
OPENJCEPLUS_BOOT_JDK := $(BOOT_JDK)
27+
OPENJCEPLUS_GSKIT_HOME := $(OPENJCEPLUS_TOPDIR)/ock/jgsk_sdk
28+
OPENJCEPLUS_JCE_CLASSPATH := $(JDK_OUTPUTDIR)/modules/openjceplus:$(JDK_OUTPUTDIR)/modules/java.base
29+
OPENJCEPLUS_JGSKIT_MAKE := jgskit.mak
30+
OPENJCEPLUS_JGSKIT_MAKE_PATH := $(OPENJCEPLUS_TOPDIR)/src/main/native
31+
OPENJCEPLUS_JGSKIT_PLATFORM :=
32+
33+
ifeq ($(call isTargetOs, aix), true)
34+
OPENJCEPLUS_JGSKIT_PLATFORM := ppc-aix64
35+
else ifeq ($(call isTargetOs, linux), true)
36+
ifeq ($(call isTargetCpu, ppc64le), true)
37+
OPENJCEPLUS_JGSKIT_PLATFORM := ppcle-linux64
38+
else ifeq ($(call isTargetCpu, x86_64), true)
39+
OPENJCEPLUS_JGSKIT_PLATFORM := x86-linux64
40+
endif
41+
else ifeq ($(call isTargetOs, windows), true)
42+
ifeq ($(call isTargetCpu, x86_64), true)
43+
OPENJCEPLUS_BOOT_JDK := $(call MixedPath,$(OPENJCEPLUS_BOOT_JDK))
44+
OPENJCEPLUS_GSKIT_HOME := $(call MixedPath,$(OPENJCEPLUS_GSKIT_HOME))
45+
OPENJCEPLUS_JCE_CLASSPATH := "$(call MixedPath,$(JDK_OUTPUTDIR)/modules/openjceplus)\;$(call MixedPath,$(JDK_OUTPUTDIR)/modules/java.base)"
46+
OPENJCEPLUS_JGSKIT_MAKE := jgskit.win64.mak
47+
OPENJCEPLUS_JGSKIT_PLATFORM := win64
48+
endif
49+
endif
50+
51+
ifeq (,$(OPENJCEPLUS_JGSKIT_PLATFORM))
52+
$(error Unsupported platform $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU))
53+
endif # OPENJCEPLUS_JGSKIT_PLATFORM
54+
55+
.PHONY : compile-libs
56+
57+
compile-libs :
58+
@$(ECHO) Compiling OpenJCEPlus native code
59+
export \
60+
GSKIT_HOME=$(OPENJCEPLUS_GSKIT_HOME) \
61+
JAVA_HOME=$(OPENJCEPLUS_BOOT_JDK) \
62+
JCE_CLASSPATH=$(OPENJCEPLUS_JCE_CLASSPATH) \
63+
PLATFORM=$(OPENJCEPLUS_JGSKIT_PLATFORM) \
64+
&& $(MAKE) -j1 -C $(OPENJCEPLUS_JGSKIT_MAKE_PATH) -f $(OPENJCEPLUS_JGSKIT_MAKE) all
65+
@$(ECHO) OpenJCEplus compile complete
66+
67+
TARGETS += compile-libs
68+
69+
endif # BUILD_OPENJCEPLUS

get_source.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# ===========================================================================
3-
# (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
3+
# (c) Copyright IBM Corp. 2017, 2023 All Rights Reserved
44
# ===========================================================================
55
#
66
# This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,13 @@ usage() {
4040
echo " -omr-branch the OpenJ9/omr git branch: openj9"
4141
echo " -omr-sha a commit SHA for the omr repository"
4242
echo " -omr-reference a local repo to use as a clone reference"
43+
echo " -openjceplus-repo the OpenJCEPlus repository url"
44+
echo " -openjceplus-branch the OpenJCEPlus git branch"
45+
echo " -openjceplus-sha a commit SHA for the OpenJCEPlus repository"
46+
echo " -openjceplus-reference a local repo to use as a clone reference"
47+
echo " -gskit-bin the GSKit binary url"
48+
echo " -gskit-sdk-bin the GSKIT SDK binary url"
49+
echo " -gskit-credential the credential for downloading the GSKit and GSKit SDK"
4350
echo " -parallel (boolean) if 'true' then the clone j9 repository commands run in parallel, default is false"
4451
echo " --openssl-repo Specify the OpenSSL repository to download from"
4552
echo " --openssl-version Specify the version of OpenSSL source to download"
@@ -57,7 +64,23 @@ for i in "$@" ; do
5764
usage
5865
;;
5966

60-
-openj9-repo=* | -openj9-branch=* | -openj9-sha=* | -openj9-reference=* | -omr-repo=* | -omr-branch=* | -omr-sha=* | -omr-reference=* | -parallel=* )
67+
-gskit-bin=* \
68+
| -gskit-credential=* \
69+
| -gskit-sdk-bin=* \
70+
| -omr-branch=* \
71+
| -omr-reference=* \
72+
| -omr-repo=* \
73+
| -omr-sha=* \
74+
| -openj9-branch=* \
75+
| -openj9-reference=* \
76+
| -openj9-repo=* \
77+
| -openj9-sha=* \
78+
| -openjceplus-branch=* \
79+
| -openjceplus-reference=* \
80+
| -openjceplus-repo=* \
81+
| -openjceplus-sha=* \
82+
| -parallel=* \
83+
)
6184
j9options="${j9options} ${i}"
6285
;;
6386

0 commit comments

Comments
 (0)