Skip to content

Commit 92510f7

Browse files
committed
Propagate DDR enablement from Java 9
Signed-off-by: Keith W. Campbell <[email protected]>
1 parent b8c9eb4 commit 92510f7

File tree

8 files changed

+261
-15
lines changed

8 files changed

+261
-15
lines changed

closed/OpenJ9.gmk

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,14 @@ endif
267267
# Adjust .spec files replacing references to gcc-4.6. Openjdk requires 4.8.2 or newer.
268268
SPEC_SED_SCRIPT := -e 's/gcc-4.6/gcc/g'
269269

270-
# As DDR is not enabled we use sed to filter .spec files.
271-
SPEC_SED_SCRIPT += $(call SedDisable,module_ddr)
270+
# Adjust DDR enablement flags.
271+
ifeq (true,$(OPENJ9_ENABLE_DDR))
272+
FEATURE_SED_SCRIPT += $(call SedEnable,opt_useOmrDdr)
273+
SPEC_SED_SCRIPT += $(call SedEnable,module_ddr)
274+
else
275+
FEATURE_SED_SCRIPT += $(call SedDisable,opt_useOmrDdr)
276+
SPEC_SED_SCRIPT += $(call SedDisable,module_ddr)
277+
endif
272278

273279
# Disable windows rebase.
274280
SPEC_SED_SCRIPT += $(call SedDisable,uma_windowsRebase)
@@ -398,6 +404,12 @@ build-j9 : run-preprocessors-j9
398404
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base/server
399405
@$(CP) -p $(OUTPUTDIR)/vm/redirector/$(LIBRARY_PREFIX)jvm_b156$(SHARED_LIBRARY_SUFFIX) $(MODULES_LIBS_DIR)/java.base/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX)
400406

407+
ifeq (true,$(OPENJ9_ENABLE_DDR))
408+
@$(ECHO) Copying j9ddr.dat
409+
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)
410+
@$(CP) -p $(OUTPUTDIR)/vm/j9ddr.dat $(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)/
411+
endif
412+
401413
J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl_sources.done
402414

403415
recur_wildcard = $(foreach dir,$(wildcard $1/*),$(call recur_wildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))

closed/autoconf/custom-hook.m4

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# ===========================================================================
22
# (c) Copyright IBM Corp. 2017, 2018 All Rights Reserved
33
# ===========================================================================
4-
#
54
# This code is free software; you can redistribute it and/or modify it
65
# under the terms of the GNU General Public License version 2 only, as
76
# published by the Free Software Foundation.
@@ -14,7 +13,6 @@
1413
#
1514
# You should have received a copy of the GNU General Public License version
1615
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
17-
#
1816
# ===========================================================================
1917

2018
AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
@@ -41,6 +39,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
4139
OPENJ9_PLATFORM_SETUP
4240
OPENJDK_VERSION_DETAILS
4341
OPENJ9_CONFIGURE_CUDA
42+
OPENJ9_CONFIGURE_DDR
4443
OPENJ9_CONFIGURE_NUMA
4544
OPENJ9_THIRD_PARTY_REQUIREMENTS
4645
])
@@ -108,6 +107,34 @@ AC_DEFUN([OPENJ9_CONFIGURE_CUDA],
108107
AC_SUBST(OPENJ9_GDK_HOME)
109108
])
110109

110+
AC_DEFUN([OPENJ9_CONFIGURE_DDR],
111+
[
112+
AC_MSG_CHECKING([for ddr])
113+
AC_ARG_ENABLE([ddr], [AS_HELP_STRING([--enable-ddr], [enable DDR support @<:@disabled@:>@])])
114+
if test "x$enable_ddr" = xyes ; then
115+
AC_MSG_RESULT([yes (explicitly enabled)])
116+
OPENJ9_ENABLE_DDR=true
117+
elif test "x$enable_ddr" = xno ; then
118+
AC_MSG_RESULT([no (explicitly disabled)])
119+
OPENJ9_ENABLE_DDR=false
120+
elif test "x$enable_ddr" = x ; then
121+
case "$OPENJ9_PLATFORM_CODE" in
122+
xa64|xl64|xz64)
123+
AC_MSG_RESULT([yes (default for $OPENJ9_PLATFORM_CODE)])
124+
OPENJ9_ENABLE_DDR=true
125+
;;
126+
*)
127+
AC_MSG_RESULT([no (default for $OPENJ9_PLATFORM_CODE)])
128+
OPENJ9_ENABLE_DDR=false
129+
;;
130+
esac
131+
else
132+
AC_MSG_ERROR([--enable-ddr accepts no argument])
133+
fi
134+
135+
AC_SUBST(OPENJ9_ENABLE_DDR)
136+
])
137+
111138
AC_DEFUN([OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU],
112139
[
113140
# Convert openjdk cpu names to openj9 names

closed/autoconf/custom-spec.gmk.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ ifneq (,@OPENJ9_GDK_HOME@)
4242
export GDK_HOME := @OPENJ9_GDK_HOME@
4343
endif
4444

45+
# DDR
46+
OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@
47+
4548
# for constructing version output
4649
COMPILER_VERSION_STRING := @COMPILER_VERSION_STRING@
4750
USERNAME := @USERNAME@

closed/autoconf/generated-configure.sh

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ SDKROOT
962962
XCODEBUILD
963963
DEVKIT_LIB_DIR
964964
FREEMARKER_JAR
965+
OPENJ9_ENABLE_DDR
965966
OPENJ9_GDK_HOME
966967
OPENJ9_CUDA_HOME
967968
OPENJ9_ENABLE_CUDA
@@ -1141,6 +1142,7 @@ with_cpu_port
11411142
with_cuda
11421143
with_gdk
11431144
enable_cuda
1145+
enable_ddr
11441146
with_freemarker_jar
11451147
with_devkit
11461148
with_sys_root
@@ -1990,6 +1992,7 @@ Optional Features:
19901992
--enable-debug set the debug level to fastdebug (shorthand for
19911993
--with-debug-level=fastdebug) [disabled]
19921994
--enable-cuda enable CUDA support [disabled]
1995+
--enable-ddr enable DDR support [disabled]
19931996
--enable-headless-only only build headless (no GUI) support [disabled]
19941997
--enable-full-docs build complete documentation [enabled if all tools
19951998
found]
@@ -5211,7 +5214,6 @@ VS_SDK_PLATFORM_NAME_2013=
52115214
# ===========================================================================
52125215
# (c) Copyright IBM Corp. 2017, 2018 All Rights Reserved
52135216
# ===========================================================================
5214-
#
52155217
# This code is free software; you can redistribute it and/or modify it
52165218
# under the terms of the GNU General Public License version 2 only, as
52175219
# published by the Free Software Foundation.
@@ -5224,7 +5226,6 @@ VS_SDK_PLATFORM_NAME_2013=
52245226
#
52255227
# You should have received a copy of the GNU General Public License version
52265228
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
5227-
#
52285229
# ===========================================================================
52295230

52305231

@@ -5244,10 +5245,12 @@ VS_SDK_PLATFORM_NAME_2013=
52445245

52455246

52465247

5248+
5249+
52475250

52485251

52495252
# Do not change or remove the following line, it is needed for consistency checks:
5250-
DATE_WHEN_GENERATED=1522310070
5253+
DATE_WHEN_GENERATED=1522342326
52515254

52525255
###############################################################################
52535256
#
@@ -17590,6 +17593,41 @@ $as_echo "no (default)" >&6; }
1759017593

1759117594

1759217595

17596+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ddr" >&5
17597+
$as_echo_n "checking for ddr... " >&6; }
17598+
# Check whether --enable-ddr was given.
17599+
if test "${enable_ddr+set}" = set; then :
17600+
enableval=$enable_ddr;
17601+
fi
17602+
17603+
if test "x$enable_ddr" = xyes ; then
17604+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (explicitly enabled)" >&5
17605+
$as_echo "yes (explicitly enabled)" >&6; }
17606+
OPENJ9_ENABLE_DDR=true
17607+
elif test "x$enable_ddr" = xno ; then
17608+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (explicitly disabled)" >&5
17609+
$as_echo "no (explicitly disabled)" >&6; }
17610+
OPENJ9_ENABLE_DDR=false
17611+
elif test "x$enable_ddr" = x ; then
17612+
case "$OPENJ9_PLATFORM_CODE" in
17613+
xa64|xl64|xz64)
17614+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default for $OPENJ9_PLATFORM_CODE)" >&5
17615+
$as_echo "yes (default for $OPENJ9_PLATFORM_CODE)" >&6; }
17616+
OPENJ9_ENABLE_DDR=true
17617+
;;
17618+
*)
17619+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default for $OPENJ9_PLATFORM_CODE)" >&5
17620+
$as_echo "no (default for $OPENJ9_PLATFORM_CODE)" >&6; }
17621+
OPENJ9_ENABLE_DDR=false
17622+
;;
17623+
esac
17624+
else
17625+
as_fn_error $? "--enable-ddr accepts no argument" "$LINENO" 5
17626+
fi
17627+
17628+
17629+
17630+
1759317631

1759417632

1759517633

closed/make/DDR-gensrc.gmk

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# ===========================================================================
2+
# (c) Copyright IBM Corp. 2018, 2018 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+
# This code is distributed in the hope that it will be useful, but WITHOUT
9+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11+
# version 2 for more details (a copy is included in the LICENSE file that
12+
# accompanied this code).
13+
#
14+
# You should have received a copy of the GNU General Public License version
15+
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
16+
# ===========================================================================
17+
18+
# The main target.
19+
all :
20+
21+
ifeq (,$(wildcard $(SPEC)))
22+
$(error BuildDDR.gmk needs SPEC set to a proper spec.gmk)
23+
endif
24+
25+
include $(SPEC)
26+
include $(TOPDIR)/make/common/MakeBase.gmk
27+
include $(TOPDIR)/make/common/JavaCompilation.gmk
28+
include $(TOPDIR)/make/common/SetupJavaCompilers.gmk
29+
30+
# Supporting definitions.
31+
DDR_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/ddr
32+
DDR_VM_SRC_ROOT := $(OPENJ9_TOPDIR)/debugtools/DDR_VM/src
33+
34+
#############################################################################
35+
36+
# Build a jar containing the code generators.
37+
$(eval $(call SetupJavaCompilation,BUILD_DDR_TOOLS, \
38+
SETUP := GENERATE_OLDBYTECODE, \
39+
BIN := $(DDR_SUPPORT_DIR)/tools, \
40+
CLASSPATH := $(addprefix $(JDK_OUTPUTDIR)/modules/, java.base openj9.dtfj), \
41+
SRC := $(DDR_VM_SRC_ROOT), \
42+
INCLUDE_FILES := $(addsuffix .java,$(subst .,/, \
43+
com.ibm.j9ddr.BytecodeGenerator \
44+
com.ibm.j9ddr.CTypeParser \
45+
com.ibm.j9ddr.StructureHeader \
46+
com.ibm.j9ddr.StructureReader \
47+
com.ibm.j9ddr.StructureTypeManager \
48+
com.ibm.j9ddr.logging.LoggerNames \
49+
com.ibm.j9ddr.tools.FlagStructureList \
50+
com.ibm.j9ddr.tools.PointerGenerator \
51+
com.ibm.j9ddr.tools.StructureStubGenerator \
52+
com.ibm.j9ddr.tools.store.J9DDRStructureStore \
53+
com.ibm.j9ddr.tools.store.StructureKey \
54+
com.ibm.j9ddr.tools.store.StructureMismatchError \
55+
)), \
56+
))
57+
58+
#############################################################################
59+
60+
# The superset file is built with the VM.
61+
DDR_SUPERSET_FILE := $(OUTPUTDIR)/vm/superset.dat
62+
63+
# Generate Java pointer classes.
64+
DDR_POINTERS_MARKER := $(DDR_SUPPORT_DIR)/pointers.done
65+
66+
$(DDR_POINTERS_MARKER) : $(DDR_SUPERSET_FILE) $(BUILD_DDR_TOOLS)
67+
@$(ECHO) Generating DDR pointer classes
68+
@$(RM) -rf $(DDR_VM_SRC_ROOT)/com/ibm/j9ddr/vm29/pointer/generated/
69+
@$(JAVA) -cp $(BUILD_DDR_TOOLS_BIN) com.ibm.j9ddr.tools.PointerGenerator \
70+
-f $(dir $(DDR_SUPERSET_FILE)) \
71+
-s $(notdir $(DDR_SUPERSET_FILE)) \
72+
-p com.ibm.j9ddr.vm29.pointer.generated \
73+
-v 29 \
74+
-o $(DDR_VM_SRC_ROOT)
75+
@$(TOUCH) $@
76+
77+
# Generate Java structure stub classes.
78+
DDR_STRUCTURES_MARKER := $(DDR_SUPPORT_DIR)/structures.done
79+
80+
$(DDR_STRUCTURES_MARKER) : $(DDR_SUPERSET_FILE) $(BUILD_DDR_TOOLS)
81+
@$(ECHO) Generating DDR structure stubs
82+
@$(RM) -rf $(DDR_VM_SRC_ROOT)/com/ibm/j9ddr/vm29/structure/
83+
@$(JAVA) -cp $(BUILD_DDR_TOOLS_BIN) com.ibm.j9ddr.tools.StructureStubGenerator \
84+
-f $(dir $(DDR_SUPERSET_FILE)) \
85+
-s $(notdir $(DDR_SUPERSET_FILE)) \
86+
-p com.ibm.j9ddr.vm29.structure \
87+
-o $(DDR_VM_SRC_ROOT)
88+
@$(TOUCH) $@
89+
90+
all : $(DDR_POINTERS_MARKER) $(DDR_STRUCTURES_MARKER)

closed/make/DDR-jar.gmk

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ===========================================================================
2+
# (c) Copyright IBM Corp. 2018, 2018 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+
# This code is distributed in the hope that it will be useful, but WITHOUT
9+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11+
# version 2 for more details (a copy is included in the LICENSE file that
12+
# accompanied this code).
13+
#
14+
# You should have received a copy of the GNU General Public License version
15+
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
16+
# ===========================================================================
17+
18+
# The main target.
19+
all :
20+
21+
ifeq (,$(wildcard $(SPEC)))
22+
$(error BuildDDR.gmk needs SPEC set to a proper spec.gmk)
23+
endif
24+
25+
include $(SPEC)
26+
include $(TOPDIR)/make/common/MakeBase.gmk
27+
include $(TOPDIR)/make/common/JavaCompilation.gmk
28+
include $(TOPDIR)/make/common/SetupJavaCompilers.gmk
29+
30+
# Supporting definitions.
31+
DDR_CLASSES_BIN := $(SUPPORT_OUTPUTDIR)/ddr/classes
32+
33+
# We depend upon class files from these modules.
34+
DDR_CLASSPATH := $(addprefix $(JDK_OUTPUTDIR)/modules/, \
35+
java.base \
36+
java.desktop \
37+
openj9.dtfj \
38+
openj9.traceformat \
39+
)
40+
41+
DDR_SRC_EXCLUDES := com/ibm/j9ddr/tools/ant
42+
43+
ifeq (,$(filter mz31 mz64,$(OPENJ9_PLATFORM_CODE)))
44+
DDR_SRC_EXCLUDES += com/ibm/j9ddr/corereaders/tdump
45+
endif
46+
47+
$(eval $(call SetupJavaCompilation,BUILD_DDR_CLASSES, \
48+
SETUP := GENERATE_USINGJDKBYTECODE, \
49+
BIN := $(DDR_CLASSES_BIN), \
50+
CLASSPATH := $(DDR_CLASSPATH), \
51+
SRC := $(OPENJ9_TOPDIR)/debugtools/DDR_VM/src, \
52+
EXCLUDES := $(DDR_SRC_EXCLUDES), \
53+
COPY := com/ibm/j9ddr/StructureAliases29.dat, \
54+
))
55+
56+
$(eval $(call SetupJarArchive,BUILD_DDR_JAR, \
57+
DEPENDENCIES := $(BUILD_DDR_CLASSES), \
58+
SRCS := $(DDR_CLASSES_BIN), \
59+
SUFFIXES := .class .dat .properties, \
60+
EXCLUDES := com/ibm/j9ddr/vm29/structure, \
61+
JAR := $(call FindLibDirForModule, openj9.dtfj)/ddr/j9ddr.jar, \
62+
))
63+
64+
all : $(BUILD_DDR_JAR)

0 commit comments

Comments
 (0)