Skip to content

Commit

Permalink
Propagate DDR enablement from Java 9
Browse files Browse the repository at this point in the history
Signed-off-by: Keith W. Campbell <[email protected]>
  • Loading branch information
keithc-ca committed Mar 29, 2018
1 parent b8c9eb4 commit 92510f7
Show file tree
Hide file tree
Showing 8 changed files with 261 additions and 15 deletions.
16 changes: 14 additions & 2 deletions closed/OpenJ9.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,14 @@ endif
# Adjust .spec files replacing references to gcc-4.6. Openjdk requires 4.8.2 or newer.
SPEC_SED_SCRIPT := -e 's/gcc-4.6/gcc/g'

# As DDR is not enabled we use sed to filter .spec files.
SPEC_SED_SCRIPT += $(call SedDisable,module_ddr)
# Adjust DDR enablement flags.
ifeq (true,$(OPENJ9_ENABLE_DDR))
FEATURE_SED_SCRIPT += $(call SedEnable,opt_useOmrDdr)
SPEC_SED_SCRIPT += $(call SedEnable,module_ddr)
else
FEATURE_SED_SCRIPT += $(call SedDisable,opt_useOmrDdr)
SPEC_SED_SCRIPT += $(call SedDisable,module_ddr)
endif

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

ifeq (true,$(OPENJ9_ENABLE_DDR))
@$(ECHO) Copying j9ddr.dat
@$(MKDIR) -p $(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)
@$(CP) -p $(OUTPUTDIR)/vm/j9ddr.dat $(MODULES_LIBS_DIR)/java.base/$(OPENJ9_LIBS_SUBDIR)/
endif

J9JCL_SOURCES_DONEFILE := $(MAKESUPPORT_OUTPUTDIR)/j9jcl_sources.done

recur_wildcard = $(foreach dir,$(wildcard $1/*),$(call recur_wildcard,$(dir),$2) $(filter $(subst *,%,$2),$(dir)))
Expand Down
31 changes: 29 additions & 2 deletions closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2018 All Rights Reserved
# ===========================================================================
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
Expand All @@ -14,7 +13,6 @@
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
#
# ===========================================================================

AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
Expand All @@ -41,6 +39,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
OPENJ9_PLATFORM_SETUP
OPENJDK_VERSION_DETAILS
OPENJ9_CONFIGURE_CUDA
OPENJ9_CONFIGURE_DDR
OPENJ9_CONFIGURE_NUMA
OPENJ9_THIRD_PARTY_REQUIREMENTS
])
Expand Down Expand Up @@ -108,6 +107,34 @@ AC_DEFUN([OPENJ9_CONFIGURE_CUDA],
AC_SUBST(OPENJ9_GDK_HOME)
])

AC_DEFUN([OPENJ9_CONFIGURE_DDR],
[
AC_MSG_CHECKING([for ddr])
AC_ARG_ENABLE([ddr], [AS_HELP_STRING([--enable-ddr], [enable DDR support @<:@disabled@:>@])])
if test "x$enable_ddr" = xyes ; then
AC_MSG_RESULT([yes (explicitly enabled)])
OPENJ9_ENABLE_DDR=true
elif test "x$enable_ddr" = xno ; then
AC_MSG_RESULT([no (explicitly disabled)])
OPENJ9_ENABLE_DDR=false
elif test "x$enable_ddr" = x ; then
case "$OPENJ9_PLATFORM_CODE" in
xa64|xl64|xz64)
AC_MSG_RESULT([yes (default for $OPENJ9_PLATFORM_CODE)])
OPENJ9_ENABLE_DDR=true
;;
*)
AC_MSG_RESULT([no (default for $OPENJ9_PLATFORM_CODE)])
OPENJ9_ENABLE_DDR=false
;;
esac
else
AC_MSG_ERROR([--enable-ddr accepts no argument])
fi
AC_SUBST(OPENJ9_ENABLE_DDR)
])

AC_DEFUN([OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU],
[
# Convert openjdk cpu names to openj9 names
Expand Down
3 changes: 3 additions & 0 deletions closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ ifneq (,@OPENJ9_GDK_HOME@)
export GDK_HOME := @OPENJ9_GDK_HOME@
endif

# DDR
OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@

# for constructing version output
COMPILER_VERSION_STRING := @COMPILER_VERSION_STRING@
USERNAME := @USERNAME@
Expand Down
44 changes: 41 additions & 3 deletions closed/autoconf/generated-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ SDKROOT
XCODEBUILD
DEVKIT_LIB_DIR
FREEMARKER_JAR
OPENJ9_ENABLE_DDR
OPENJ9_GDK_HOME
OPENJ9_CUDA_HOME
OPENJ9_ENABLE_CUDA
Expand Down Expand Up @@ -1141,6 +1142,7 @@ with_cpu_port
with_cuda
with_gdk
enable_cuda
enable_ddr
with_freemarker_jar
with_devkit
with_sys_root
Expand Down Expand Up @@ -1990,6 +1992,7 @@ Optional Features:
--enable-debug set the debug level to fastdebug (shorthand for
--with-debug-level=fastdebug) [disabled]
--enable-cuda enable CUDA support [disabled]
--enable-ddr enable DDR support [disabled]
--enable-headless-only only build headless (no GUI) support [disabled]
--enable-full-docs build complete documentation [enabled if all tools
found]
Expand Down Expand Up @@ -5211,7 +5214,6 @@ VS_SDK_PLATFORM_NAME_2013=
# ===========================================================================
# (c) Copyright IBM Corp. 2017, 2018 All Rights Reserved
# ===========================================================================
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
Expand All @@ -5224,7 +5226,6 @@ VS_SDK_PLATFORM_NAME_2013=
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
#
# ===========================================================================


Expand All @@ -5244,10 +5245,12 @@ VS_SDK_PLATFORM_NAME_2013=







# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1522310070
DATE_WHEN_GENERATED=1522342326

###############################################################################
#
Expand Down Expand Up @@ -17590,6 +17593,41 @@ $as_echo "no (default)" >&6; }



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ddr" >&5
$as_echo_n "checking for ddr... " >&6; }
# Check whether --enable-ddr was given.
if test "${enable_ddr+set}" = set; then :
enableval=$enable_ddr;
fi

if test "x$enable_ddr" = xyes ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (explicitly enabled)" >&5
$as_echo "yes (explicitly enabled)" >&6; }
OPENJ9_ENABLE_DDR=true
elif test "x$enable_ddr" = xno ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (explicitly disabled)" >&5
$as_echo "no (explicitly disabled)" >&6; }
OPENJ9_ENABLE_DDR=false
elif test "x$enable_ddr" = x ; then
case "$OPENJ9_PLATFORM_CODE" in
xa64|xl64|xz64)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default for $OPENJ9_PLATFORM_CODE)" >&5
$as_echo "yes (default for $OPENJ9_PLATFORM_CODE)" >&6; }
OPENJ9_ENABLE_DDR=true
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default for $OPENJ9_PLATFORM_CODE)" >&5
$as_echo "no (default for $OPENJ9_PLATFORM_CODE)" >&6; }
OPENJ9_ENABLE_DDR=false
;;
esac
else
as_fn_error $? "--enable-ddr accepts no argument" "$LINENO" 5
fi







Expand Down
90 changes: 90 additions & 0 deletions closed/make/DDR-gensrc.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
# ===========================================================================

# The main target.
all :

ifeq (,$(wildcard $(SPEC)))
$(error BuildDDR.gmk needs SPEC set to a proper spec.gmk)
endif

include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
include $(TOPDIR)/make/common/JavaCompilation.gmk
include $(TOPDIR)/make/common/SetupJavaCompilers.gmk

# Supporting definitions.
DDR_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/ddr
DDR_VM_SRC_ROOT := $(OPENJ9_TOPDIR)/debugtools/DDR_VM/src

#############################################################################

# Build a jar containing the code generators.
$(eval $(call SetupJavaCompilation,BUILD_DDR_TOOLS, \
SETUP := GENERATE_OLDBYTECODE, \
BIN := $(DDR_SUPPORT_DIR)/tools, \
CLASSPATH := $(addprefix $(JDK_OUTPUTDIR)/modules/, java.base openj9.dtfj), \
SRC := $(DDR_VM_SRC_ROOT), \
INCLUDE_FILES := $(addsuffix .java,$(subst .,/, \
com.ibm.j9ddr.BytecodeGenerator \
com.ibm.j9ddr.CTypeParser \
com.ibm.j9ddr.StructureHeader \
com.ibm.j9ddr.StructureReader \
com.ibm.j9ddr.StructureTypeManager \
com.ibm.j9ddr.logging.LoggerNames \
com.ibm.j9ddr.tools.FlagStructureList \
com.ibm.j9ddr.tools.PointerGenerator \
com.ibm.j9ddr.tools.StructureStubGenerator \
com.ibm.j9ddr.tools.store.J9DDRStructureStore \
com.ibm.j9ddr.tools.store.StructureKey \
com.ibm.j9ddr.tools.store.StructureMismatchError \
)), \
))

#############################################################################

# The superset file is built with the VM.
DDR_SUPERSET_FILE := $(OUTPUTDIR)/vm/superset.dat

# Generate Java pointer classes.
DDR_POINTERS_MARKER := $(DDR_SUPPORT_DIR)/pointers.done

$(DDR_POINTERS_MARKER) : $(DDR_SUPERSET_FILE) $(BUILD_DDR_TOOLS)
@$(ECHO) Generating DDR pointer classes
@$(RM) -rf $(DDR_VM_SRC_ROOT)/com/ibm/j9ddr/vm29/pointer/generated/
@$(JAVA) -cp $(BUILD_DDR_TOOLS_BIN) com.ibm.j9ddr.tools.PointerGenerator \
-f $(dir $(DDR_SUPERSET_FILE)) \
-s $(notdir $(DDR_SUPERSET_FILE)) \
-p com.ibm.j9ddr.vm29.pointer.generated \
-v 29 \
-o $(DDR_VM_SRC_ROOT)
@$(TOUCH) $@

# Generate Java structure stub classes.
DDR_STRUCTURES_MARKER := $(DDR_SUPPORT_DIR)/structures.done

$(DDR_STRUCTURES_MARKER) : $(DDR_SUPERSET_FILE) $(BUILD_DDR_TOOLS)
@$(ECHO) Generating DDR structure stubs
@$(RM) -rf $(DDR_VM_SRC_ROOT)/com/ibm/j9ddr/vm29/structure/
@$(JAVA) -cp $(BUILD_DDR_TOOLS_BIN) com.ibm.j9ddr.tools.StructureStubGenerator \
-f $(dir $(DDR_SUPERSET_FILE)) \
-s $(notdir $(DDR_SUPERSET_FILE)) \
-p com.ibm.j9ddr.vm29.structure \
-o $(DDR_VM_SRC_ROOT)
@$(TOUCH) $@

all : $(DDR_POINTERS_MARKER) $(DDR_STRUCTURES_MARKER)
64 changes: 64 additions & 0 deletions closed/make/DDR-jar.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ===========================================================================
# (c) Copyright IBM Corp. 2018, 2018 All Rights Reserved
# ===========================================================================
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, see <http://www.gnu.org/licenses/>.
# ===========================================================================

# The main target.
all :

ifeq (,$(wildcard $(SPEC)))
$(error BuildDDR.gmk needs SPEC set to a proper spec.gmk)
endif

include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
include $(TOPDIR)/make/common/JavaCompilation.gmk
include $(TOPDIR)/make/common/SetupJavaCompilers.gmk

# Supporting definitions.
DDR_CLASSES_BIN := $(SUPPORT_OUTPUTDIR)/ddr/classes

# We depend upon class files from these modules.
DDR_CLASSPATH := $(addprefix $(JDK_OUTPUTDIR)/modules/, \
java.base \
java.desktop \
openj9.dtfj \
openj9.traceformat \
)

DDR_SRC_EXCLUDES := com/ibm/j9ddr/tools/ant

ifeq (,$(filter mz31 mz64,$(OPENJ9_PLATFORM_CODE)))
DDR_SRC_EXCLUDES += com/ibm/j9ddr/corereaders/tdump
endif

$(eval $(call SetupJavaCompilation,BUILD_DDR_CLASSES, \
SETUP := GENERATE_USINGJDKBYTECODE, \
BIN := $(DDR_CLASSES_BIN), \
CLASSPATH := $(DDR_CLASSPATH), \
SRC := $(OPENJ9_TOPDIR)/debugtools/DDR_VM/src, \
EXCLUDES := $(DDR_SRC_EXCLUDES), \
COPY := com/ibm/j9ddr/StructureAliases29.dat, \
))

$(eval $(call SetupJarArchive,BUILD_DDR_JAR, \
DEPENDENCIES := $(BUILD_DDR_CLASSES), \
SRCS := $(DDR_CLASSES_BIN), \
SUFFIXES := .class .dat .properties, \
EXCLUDES := com/ibm/j9ddr/vm29/structure, \
JAR := $(call FindLibDirForModule, openj9.dtfj)/ddr/j9ddr.jar, \
))

all : $(BUILD_DDR_JAR)
Loading

0 comments on commit 92510f7

Please sign in to comment.