From a8263c3b91ae01825ebb00b1ec6dc435d582643c Mon Sep 17 00:00:00 2001 From: Sharon Wang Date: Mon, 19 Oct 2020 13:12:28 -0400 Subject: [PATCH] Add new configure option --with-mixedrefs for mixed pointer mode If --with-mixedrefs is specified in the configure command, the 'default' OPENJ9_LIBS_SUBDIR is used for the build. The mxdptrs CMake file corresponding to the build OS is used as the OPENJ9_BUILDSPEC. --with-mixedrefs=[static/dynamic] sets the reference determination mode. --with-mixedrefs without any value provided defaults to static mode. OMR_MIXED_REFERENCES_MODE is communicated to OpenJ9 and OMR through CMake args. Fail configure if --with-mixedrefs is used without CMake enabled. The new mxdptr build specs are defined in OpenJ9. The compressed and full GC libraries generated with the mixed build work are copied to the OPENJ9_LIBS_SUBDIR alongside the other existing libraries. j9gc29, j9gcchk29 are always copied j9gc_full29, j9gcchk_full29 are copied when running in mixedrefs static mode If an OpenJ9-equivalent OS has been specified in OPENJ9_BUILD_OS, use the specified OS string to override the provided OPENJDK_BUILD_OS. Use OPENJ9_BUILD_MODE_ARCH to capture the other half of the OPENJ9_BUILDSPEC, where the architecture and the pointer mode (or other additional modes/settings) are specified. Signed-off-by: Sharon Wang --- closed/CopyToBuildJdk.gmk | 2 + closed/OpenJ9.gmk | 1 + common/autoconf/generated-configure.sh | 2 +- jdk/make/closed/autoconf/custom-hook.m4 | 73 ++++++++++------ jdk/make/closed/autoconf/custom-spec.gmk.in | 3 + .../closed/autoconf/generated-configure.sh | 83 +++++++++++++------ 6 files changed, 110 insertions(+), 54 deletions(-) diff --git a/closed/CopyToBuildJdk.gmk b/closed/CopyToBuildJdk.gmk index 4f5d9ea59eb..a6be8d14994 100644 --- a/closed/CopyToBuildJdk.gmk +++ b/closed/CopyToBuildJdk.gmk @@ -166,7 +166,9 @@ $(call openj9_copy_shlibs, \ j9dmp29 \ j9jextract \ j9gc29 \ + $(if $(filter static,$(OMR_MIXED_REFERENCES_MODE)),j9gc_full29) \ j9gcchk29 \ + $(if $(filter static,$(OMR_MIXED_REFERENCES_MODE)),j9gcchk_full29) \ j9hookable29 \ j9jit29 \ j9jnichk29 \ diff --git a/closed/OpenJ9.gmk b/closed/OpenJ9.gmk index 0a8037d1c17..5e01f4f03c4 100644 --- a/closed/OpenJ9.gmk +++ b/closed/OpenJ9.gmk @@ -255,6 +255,7 @@ CMAKE_ARGS := \ -DJ9VM_OMR_DIR=$(OPENJ9OMR_TOPDIR) \ -DBUILD_ID=$(BUILD_ID) \ -DJAVA_SPEC_VERSION=8 \ + -DOMR_MIXED_REFERENCES_MODE=$(OMR_MIXED_REFERENCES_MODE) \ -DOPENJ9_BUILD=true ifeq (windows,$(OPENJDK_TARGET_OS)) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 430fe2e7bc6..cd235528040 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4410,7 +4410,7 @@ VS_SDK_PLATFORM_NAME_2017= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1604507962 +DATE_WHEN_GENERATED=1605236068 ############################################################################### # diff --git a/jdk/make/closed/autoconf/custom-hook.m4 b/jdk/make/closed/autoconf/custom-hook.m4 index 5bdc06f41d0..ace4704c876 100644 --- a/jdk/make/closed/autoconf/custom-hook.m4 +++ b/jdk/make/closed/autoconf/custom-hook.m4 @@ -61,7 +61,7 @@ AC_DEFUN([OPENJ9_CONFIGURE_CMAKE], [ AC_ARG_WITH(cmake, [AS_HELP_STRING([--with-cmake], [enable building openJ9 with CMake])], [ - if test "x$with_cmake" == xyes -o "x$with_cmake" == x ; then + if test "x$with_cmake" = xyes -o "x$with_cmake" = x ; then with_cmake=cmake fi if test "x$with_cmake" != xno ; then @@ -74,10 +74,15 @@ AC_DEFUN([OPENJ9_CONFIGURE_CMAKE], fi ], [with_cmake=no]) - if test "$with_cmake" == yes ; then + if test "$with_cmake" = yes ; then OPENJ9_ENABLE_CMAKE=true else OPENJ9_ENABLE_CMAKE=false + + # Currently, mixedrefs mode is only available with CMake enabled + if test "x$OMR_MIXED_REFERENCES_MODE" != xoff ; then + AC_MSG_ERROR([[--with-mixedrefs=[static|dynamic] requires --with-cmake]]) + fi fi AC_SUBST(OPENJ9_ENABLE_CMAKE) ]) @@ -270,44 +275,57 @@ AC_DEFUN([OPENJ9_PLATFORM_SETUP], AC_ARG_WITH(noncompressedrefs, [AS_HELP_STRING([--with-noncompressedrefs], [build non-compressedrefs vm (large heap)])]) + AC_ARG_WITH(mixedrefs, [AS_HELP_STRING([--with-mixedrefs], + [build mixedrefs vm (--with-mixedrefs=static or --with-mixedrefs=dynamic)])]) + OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) - if test "x$with_noncompressedrefs" != x -o "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_${OPENJ9_CPU}" + + # Default OPENJ9_BUILD_OS=OPENJDK_BUILD_OS, but override with OpenJ9 equivalent as appropriate + OPENJ9_BUILD_OS="${OPENJDK_BUILD_OS}" + + OMR_MIXED_REFERENCES_MODE=off + if test "x$with_mixedrefs" != x -a "x$with_mixedrefs" != xno; then + if test "x$with_mixedrefs" = xyes -o "x$with_mixedrefs" = xstatic; then + OMR_MIXED_REFERENCES_MODE=static + elif test "x$with_mixedrefs" = xdynamic; then + OMR_MIXED_REFERENCES_MODE=dynamic + else + AC_MSG_ERROR([OpenJ9 supports --with-mixedrefs=static and --with-mixedrefs=dynamic]) + fi + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}_mxdptrs" + OPENJ9_LIBS_SUBDIR=default + elif test "x$with_noncompressedrefs" = xyes ; then + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}" OPENJ9_LIBS_SUBDIR=default else - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_${OPENJ9_CPU}_cmprssptrs" + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}_cmprssptrs" OPENJ9_LIBS_SUBDIR=compressedrefs fi if test "x$OPENJ9_CPU" = xx86-64 ; then - if test "x$OPENJDK_BUILD_OS" = xlinux ; then + if test "x$OPENJ9_BUILD_OS" = xlinux ; then OPENJ9_PLATFORM_CODE=xa64 - elif test "x$OPENJDK_BUILD_OS" = xwindows ; then + elif test "x$OPENJ9_BUILD_OS" = xwindows ; then OPENJ9_PLATFORM_CODE=wa64 - if test "x$OPENJ9_LIBS_SUBDIR" = xdefault ; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then - OPENJ9_PLATFORM_CODE=wi32 - OPENJ9_BUILDSPEC="win_x86" - else - OPENJ9_BUILDSPEC="win_x86-64" - fi - else - OPENJ9_BUILDSPEC="win_x86-64_cmprssptrs" + OPENJ9_BUILD_OS=win + if test "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then + OPENJ9_PLATFORM_CODE=wi32 + OPENJ9_BUILD_MODE_ARCH="x86" fi - elif test "x$OPENJDK_BUILD_OS" = xmacosx ; then + elif test "x$OPENJ9_BUILD_OS" = xmacosx ; then OPENJ9_PLATFORM_CODE=oa64 - if test "x$OPENJ9_LIBS_SUBDIR" = xdefault ; then - OPENJ9_BUILDSPEC="osx_x86-64" - else - OPENJ9_BUILDSPEC="osx_x86-64_cmprssptrs" - fi + OPENJ9_BUILD_OS=osx else - AC_MSG_ERROR([Unsupported OpenJ9 platform ${OPENJDK_BUILD_OS}!]) + AC_MSG_ERROR([Unsupported OpenJ9 platform ${OPENJ9_BUILD_OS}!]) fi elif test "x$OPENJ9_CPU" = xppc-64_le ; then OPENJ9_PLATFORM_CODE=xl64 - if test "x$OPENJ9_LIBS_SUBDIR" != xdefault ; then - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_ppc-64_cmprssptrs_le" + if test "x$OMR_MIXED_REFERENCES_MODE" = xoff ; then + if test "x$OPENJ9_LIBS_SUBDIR" != xdefault ; then + OPENJ9_BUILD_MODE_ARCH="ppc-64_cmprssptrs_le" + fi + else + OPENJ9_BUILD_MODE_ARCH="ppc-64_mxdptrs_le" fi elif test "x$OPENJ9_CPU" = x390-64 ; then OPENJ9_PLATFORM_CODE=xz64 @@ -319,9 +337,12 @@ AC_DEFUN([OPENJ9_PLATFORM_SETUP], AC_MSG_ERROR([Unsupported OpenJ9 cpu ${OPENJ9_CPU}!]) fi + OPENJ9_BUILDSPEC="${OPENJ9_BUILD_OS}_${OPENJ9_BUILD_MODE_ARCH}" + AC_SUBST(OPENJ9_BUILDSPEC) AC_SUBST(OPENJ9_PLATFORM_CODE) AC_SUBST(OPENJ9_LIBS_SUBDIR) + AC_SUBST(OMR_MIXED_REFERENCES_MODE) ]) AC_DEFUN([OPENJ9_CHECK_NASM_VERSION], @@ -381,7 +402,7 @@ AC_DEFUN([OPENJ9_THIRD_PARTY_REQUIREMENTS], FREEMARKER_JAR= if test "x$OPENJ9_ENABLE_CMAKE" != xtrue ; then - if test "x$with_freemarker_jar" == x -o "x$with_freemarker_jar" == xno ; then + if test "x$with_freemarker_jar" = x -o "x$with_freemarker_jar" = xno ; then printf "\n" printf "The FreeMarker library is required to build the OpenJ9 build tools\n" printf "and has to be provided during configure process.\n" diff --git a/jdk/make/closed/autoconf/custom-spec.gmk.in b/jdk/make/closed/autoconf/custom-spec.gmk.in index 63ebb77e942..b95a3782b9b 100644 --- a/jdk/make/closed/autoconf/custom-spec.gmk.in +++ b/jdk/make/closed/autoconf/custom-spec.gmk.in @@ -80,6 +80,9 @@ OPENJ9_PLATFORM_CODE := @OPENJ9_PLATFORM_CODE@ OPENJ9_LIBS_SUBDIR := @OPENJ9_LIBS_SUBDIR@ +# Mixed References Mode +OMR_MIXED_REFERENCES_MODE := @OMR_MIXED_REFERENCES_MODE@ + # Export autoconf cache variables for CC/CXX. # This is for the case where ccache is enabled. # It ensures that OMR autoconf uses the compiler, not ccache. diff --git a/jdk/make/closed/autoconf/generated-configure.sh b/jdk/make/closed/autoconf/generated-configure.sh index 5c5c6abad04..6c66d3ff25c 100644 --- a/jdk/make/closed/autoconf/generated-configure.sh +++ b/jdk/make/closed/autoconf/generated-configure.sh @@ -905,6 +905,7 @@ CMAKE USERNAME JDK_FIX_VERSION JDK_MOD_VERSION +OMR_MIXED_REFERENCES_MODE OPENJ9_LIBS_SUBDIR OPENJ9_PLATFORM_CODE OPENJ9_BUILDSPEC @@ -1076,6 +1077,7 @@ with_jvm_variants enable_debug with_debug_level with_noncompressedrefs +with_mixedrefs with_cmake with_openj9_cc with_openj9_cxx @@ -1949,6 +1951,8 @@ Optional Packages: [release] --with-noncompressedrefs build non-compressedrefs vm (large heap) + --with-mixedrefs build mixedrefs vm (--with-mixedrefs=static or + --with-mixedrefs=dynamic) --with-cmake enable building openJ9 with CMake --with-openj9-cc build OpenJ9 with a specific C compiler --with-openj9-cxx build OpenJ9 with a specific C++ compiler @@ -4546,7 +4550,7 @@ VS_SDK_PLATFORM_NAME_2017= # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1604507962 +DATE_WHEN_GENERATED=1605236068 ############################################################################### # @@ -15187,6 +15191,13 @@ fi +# Check whether --with-mixedrefs was given. +if test "${with_mixedrefs+set}" = set; then : + withval=$with_mixedrefs; +fi + + + # Convert openjdk cpu names to openj9 names case "$build_cpu" in x86_64) @@ -15209,43 +15220,53 @@ fi ;; esac - if test "x$with_noncompressedrefs" != x -o "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_${OPENJ9_CPU}" + + # Default OPENJ9_BUILD_OS=OPENJDK_BUILD_OS, but override with OpenJ9 equivalent as appropriate + OPENJ9_BUILD_OS="${OPENJDK_BUILD_OS}" + + OMR_MIXED_REFERENCES_MODE=off + if test "x$with_mixedrefs" != x -a "x$with_mixedrefs" != xno; then + if test "x$with_mixedrefs" = xyes -o "x$with_mixedrefs" = xstatic; then + OMR_MIXED_REFERENCES_MODE=static + elif test "x$with_mixedrefs" = xdynamic; then + OMR_MIXED_REFERENCES_MODE=dynamic + else + as_fn_error $? "OpenJ9 supports --with-mixedrefs=static and --with-mixedrefs=dynamic" "$LINENO" 5 + fi + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}_mxdptrs" + OPENJ9_LIBS_SUBDIR=default + elif test "x$with_noncompressedrefs" = xyes ; then + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}" OPENJ9_LIBS_SUBDIR=default else - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_${OPENJ9_CPU}_cmprssptrs" + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_CPU}_cmprssptrs" OPENJ9_LIBS_SUBDIR=compressedrefs fi if test "x$OPENJ9_CPU" = xx86-64 ; then - if test "x$OPENJDK_BUILD_OS" = xlinux ; then + if test "x$OPENJ9_BUILD_OS" = xlinux ; then OPENJ9_PLATFORM_CODE=xa64 - elif test "x$OPENJDK_BUILD_OS" = xwindows ; then + elif test "x$OPENJ9_BUILD_OS" = xwindows ; then OPENJ9_PLATFORM_CODE=wa64 - if test "x$OPENJ9_LIBS_SUBDIR" = xdefault ; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then - OPENJ9_PLATFORM_CODE=wi32 - OPENJ9_BUILDSPEC="win_x86" - else - OPENJ9_BUILDSPEC="win_x86-64" - fi - else - OPENJ9_BUILDSPEC="win_x86-64_cmprssptrs" + OPENJ9_BUILD_OS=win + if test "x$OPENJDK_TARGET_CPU_BITS" = x32 ; then + OPENJ9_PLATFORM_CODE=wi32 + OPENJ9_BUILD_MODE_ARCH="x86" fi - elif test "x$OPENJDK_BUILD_OS" = xmacosx ; then + elif test "x$OPENJ9_BUILD_OS" = xmacosx ; then OPENJ9_PLATFORM_CODE=oa64 - if test "x$OPENJ9_LIBS_SUBDIR" = xdefault ; then - OPENJ9_BUILDSPEC="osx_x86-64" - else - OPENJ9_BUILDSPEC="osx_x86-64_cmprssptrs" - fi + OPENJ9_BUILD_OS=osx else - as_fn_error $? "Unsupported OpenJ9 platform ${OPENJDK_BUILD_OS}!" "$LINENO" 5 + as_fn_error $? "Unsupported OpenJ9 platform ${OPENJ9_BUILD_OS}!" "$LINENO" 5 fi elif test "x$OPENJ9_CPU" = xppc-64_le ; then OPENJ9_PLATFORM_CODE=xl64 - if test "x$OPENJ9_LIBS_SUBDIR" != xdefault ; then - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_ppc-64_cmprssptrs_le" + if test "x$OMR_MIXED_REFERENCES_MODE" = xoff ; then + if test "x$OPENJ9_LIBS_SUBDIR" != xdefault ; then + OPENJ9_BUILD_MODE_ARCH="ppc-64_cmprssptrs_le" + fi + else + OPENJ9_BUILD_MODE_ARCH="ppc-64_mxdptrs_le" fi elif test "x$OPENJ9_CPU" = x390-64 ; then OPENJ9_PLATFORM_CODE=xz64 @@ -15257,6 +15278,9 @@ fi as_fn_error $? "Unsupported OpenJ9 cpu ${OPENJ9_CPU}!" "$LINENO" 5 fi + OPENJ9_BUILDSPEC="${OPENJ9_BUILD_OS}_${OPENJ9_BUILD_MODE_ARCH}" + + @@ -15277,7 +15301,7 @@ fi # Check whether --with-cmake was given. if test "${with_cmake+set}" = set; then : withval=$with_cmake; - if test "x$with_cmake" == xyes -o "x$with_cmake" == x ; then + if test "x$with_cmake" = xyes -o "x$with_cmake" = x ; then with_cmake=cmake fi if test "x$with_cmake" != xno ; then @@ -15485,10 +15509,15 @@ else with_cmake=no fi - if test "$with_cmake" == yes ; then + if test "$with_cmake" = yes ; then OPENJ9_ENABLE_CMAKE=true else OPENJ9_ENABLE_CMAKE=false + + # Currently, mixedrefs mode is only available with CMake enabled + if test "x$OMR_MIXED_REFERENCES_MODE" != xoff ; then + as_fn_error $? "--with-mixedrefs=[static|dynamic] requires --with-cmake" "$LINENO" 5 + fi fi @@ -17648,7 +17677,7 @@ fi FREEMARKER_JAR= if test "x$OPENJ9_ENABLE_CMAKE" != xtrue ; then - if test "x$with_freemarker_jar" == x -o "x$with_freemarker_jar" == xno ; then + if test "x$with_freemarker_jar" = x -o "x$with_freemarker_jar" = xno ; then printf "\n" printf "The FreeMarker library is required to build the OpenJ9 build tools\n" printf "and has to be provided during configure process.\n"