From 33c02cdee5807645395b9ca2c44c38932dd84648 Mon Sep 17 00:00:00 2001 From: Sharon Wang Date: Wed, 21 Oct 2020 12:19:45 -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/OpenJ9.gmk | 1 + closed/autoconf/custom-hook.m4 | 74 +++++++++++++++++---------- closed/autoconf/custom-spec.gmk.in | 3 ++ closed/custom/copy/Copy-java.base.gmk | 2 + 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/closed/OpenJ9.gmk b/closed/OpenJ9.gmk index 26eea35d3e2..69d11f7cef9 100644 --- a/closed/OpenJ9.gmk +++ b/closed/OpenJ9.gmk @@ -338,6 +338,7 @@ ifeq (true,$(OPENJ9_ENABLE_CMAKE)) -DJ9VM_OMR_DIR="$(OPENJ9OMR_TOPDIR)" \ -DJAVA_SPEC_VERSION=$(VERSION_FEATURE) \ -DOMR_DDR=$(OPENJ9_ENABLE_DDR) \ + -DOMR_MIXED_REFERENCES_MODE=$(OMR_MIXED_REFERENCES_MODE) \ -DOPENJ9_BUILD=true \ -DOPENJ9_SHA=$(OPENJ9_SHA) \ -DOPENJDK_VERSION_NUMBER_FOUR_POSITIONS=$(VERSION_NUMBER_FOUR_POSITIONS) \ diff --git a/closed/autoconf/custom-hook.m4 b/closed/autoconf/custom-hook.m4 index c086310afc1..5f7845dab75 100644 --- a/closed/autoconf/custom-hook.m4 +++ b/closed/autoconf/custom-hook.m4 @@ -54,7 +54,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 ], @@ -75,6 +75,11 @@ AC_DEFUN([OPENJ9_CONFIGURE_CMAKE], # at this point with_cmake should either be no, or the name of the cmake command if test "x$with_cmake" = xno ; then 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 else OPENJ9_ENABLE_CMAKE=true if AS_EXECUTABLE_P(["$with_cmake"]) ; then @@ -342,43 +347,56 @@ 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)])]) + # When compiling natively host_cpu and build_cpu are the same. But when # cross compiling we need to work with the host_cpu (which is where the final # JVM will run). OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) - if test "x$with_noncompressedrefs" = x ; then - OPENJ9_BUILDSPEC="${OPENJDK_BUILD_OS}_${OPENJ9_CPU}_cmprssptrs" - OPENJ9_LIBS_SUBDIR=compressedrefs - else - 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_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 - OPENJ9_BUILDSPEC=win_x86-64 - else - OPENJ9_BUILDSPEC=win_x86-64_cmprssptrs - fi - elif test "x$OPENJDK_BUILD_OS" = xmacosx ; then + OPENJ9_BUILD_OS=win + 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 @@ -386,26 +404,30 @@ AC_DEFUN([OPENJ9_PLATFORM_SETUP], OPENJ9_PLATFORM_CODE=ap64 elif test "x$OPENJ9_CPU" = xarm ; then OPENJ9_PLATFORM_CODE=xr32 - OPENJ9_BUILDSPEC=linux_arm_linaro + OPENJ9_BUILD_OS=linux + OPENJ9_BUILD_MODE_ARCH=arm_linaro OPENJ9_LIBS_SUBDIR=default elif test "x$OPENJ9_CPU" = xaarch64 ; then OPENJ9_PLATFORM_CODE=xr64 if test "x$COMPILE_TYPE" = xcross ; then - OPENJ9_BUILDSPEC="${OPENJ9_BUILDSPEC}_cross" + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_BUILD_MODE_ARCH}_cross" fi elif test "x$OPENJ9_CPU" = xriscv64 ; then OPENJ9_PLATFORM_CODE=rv64 if test "x$COMPILE_TYPE" = xcross ; then - OPENJ9_BUILDSPEC="${OPENJ9_BUILDSPEC}_cross" + OPENJ9_BUILD_MODE_ARCH="${OPENJ9_BUILD_MODE_ARCH}_cross" fi else 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(COMPILER_VERSION_STRING) AC_SUBST(OPENJ9_LIBS_SUBDIR) + AC_SUBST(OMR_MIXED_REFERENCES_MODE) ]) AC_DEFUN([OPENJ9_CHECK_NASM_VERSION], @@ -452,7 +474,7 @@ AC_DEFUN([OPENJ9_THIRD_PARTY_REQUIREMENTS], FREEMARKER_JAR= if test "x$OPENJ9_ENABLE_CMAKE" != xtrue ; then AC_MSG_CHECKING([that freemarker location is set]) - 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 AC_MSG_RESULT([no]) printf "\n" printf "The FreeMarker library is required to build the OpenJ9 build tools\n" diff --git a/closed/autoconf/custom-spec.gmk.in b/closed/autoconf/custom-spec.gmk.in index be9d524a4eb..3047edaf090 100644 --- a/closed/autoconf/custom-spec.gmk.in +++ b/closed/autoconf/custom-spec.gmk.in @@ -85,6 +85,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/closed/custom/copy/Copy-java.base.gmk b/closed/custom/copy/Copy-java.base.gmk index b0f6e2772a3..a2383c30b8f 100644 --- a/closed/custom/copy/Copy-java.base.gmk +++ b/closed/custom/copy/Copy-java.base.gmk @@ -63,7 +63,9 @@ $(call openj9_copy_shlibs, \ $(if $(filter zos,$(OPENJDK_TARGET_OS)),j9a2e) \ j9dmp29 \ j9gc29 \ + $(if $(filter static,$(OMR_MIXED_REFERENCES_MODE)),j9gc_full29) \ j9gcchk29 \ + $(if $(filter static,$(OMR_MIXED_REFERENCES_MODE)),j9gcchk_full29) \ j9hookable29 \ $(if $(filter zos,$(OPENJDK_TARGET_OS)),j9ifa29) \ $(if $(filter $(NO_JIT_CPUS),$(OPENJDK_TARGET_CPU)),,j9jit29) \