diff --git a/doc/building.html b/doc/building.html index 2f59ca8775b..d34d94c2954 100644 --- a/doc/building.html +++ b/doc/building.html @@ -473,7 +473,7 @@ CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
  • --with-version-string=<string> - Specify the version string this build will be identified with.
  • --with-version-<part>=<value> - A group of options, where <part> can be any of pre, opt, build, major, minor, security or patch. Use these options to modify just the corresponding part of the version string from the default, or the value provided by --with-version-string.
  • --with-jvm-variants=<variant>[,<variant>...] - Build the specified variant (or variants) of Hotspot. Valid variants are: server, client, minimal, core, zero, custom. Note that not all variants are possible to combine in a single build.
  • -
  • --with-jvm-features=<feature>[,<feature>...] - Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For the custom JVM variant, this default list is empty. A complete list of available JVM features can be found using bash configure --help.
  • +
  • --enable-jvm-feature-<feature> or --disable-jvm-feature-<feature> - Include (or exclude) <feature> as a JVM feature in Hotspot. You can also specify a list of features to be enabled, separated by space or comma, as --with-jvm-features=<feature>[,<feature>...]. If you prefix <feature> with a -, it will be disabled. These options will modify the default list of features for the JVM variant(s) you are building. For the custom JVM variant, the default list is empty. A complete list of valid JVM features can be found using bash configure --help.
  • --with-target-bits=<bits> - Create a target binary suitable for running on a <bits> platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a reduced build.)
  • On Linux, BSD and AIX, it is possible to override where Java by default searches for runtime/JNI libraries. This can be useful in situations where there is a special shared directory for system JNI libraries. This setting can in turn be overriden at runtime by setting the java.library.path property.

    diff --git a/doc/building.md b/doc/building.md index ca1634737be..a3c4ee66831 100644 --- a/doc/building.md +++ b/doc/building.md @@ -684,11 +684,14 @@ features, use `bash configure --help=short` instead.) (or variants) of Hotspot. Valid variants are: `server`, `client`, `minimal`, `core`, `zero`, `custom`. Note that not all variants are possible to combine in a single build. - * `--with-jvm-features=[,...]` - Use the specified JVM - features when building Hotspot. The list of features will be enabled on top - of the default list. For the `custom` JVM variant, this default list is - empty. A complete list of available JVM features can be found using `bash - configure --help`. + * `--enable-jvm-feature-` or `--disable-jvm-feature-` - + Include (or exclude) `` as a JVM feature in Hotspot. You can also + specify a list of features to be enabled, separated by space or comma, as + `--with-jvm-features=[,...]`. If you prefix `` + with a `-`, it will be disabled. These options will modify the default list + of features for the JVM variant(s) you are building. For the `custom` JVM + variant, the default list is empty. A complete list of valid JVM features + can be found using `bash configure --help`. * `--with-target-bits=` - Create a target binary suitable for running on a `` platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a diff --git a/make/autoconf/basics.m4 b/make/autoconf/basics.m4 index e1f1c080495..028890d8428 100644 --- a/make/autoconf/basics.m4 +++ b/make/autoconf/basics.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -417,6 +417,21 @@ AC_DEFUN([BASIC_DEPRECATED_ARG_ENABLE], fi ]) +############################################################################### +# Register an --enable-* argument as an alias for another argument. +# $1: The name of the enable argument for the new alias, not including --enable- +# $2: The full name of the argument of which to make this an alias, including +# --enable- or --with-. +AC_DEFUN([BASIC_ALIASED_ARG_ENABLE], +[ + AC_ARG_ENABLE($1, [AS_HELP_STRING([--enable-$1], [alias for $2])], [ + # Use m4 to strip initial -- from target ($2), convert - to _, prefix enable_ + # to new alias name, and create a shell variable assignment, + # e.g.: enable_old_style="$enable_new_alias" + translit(patsubst($2, --), -, _)="$[enable_]translit($1, -, _)" + ]) +]) + ############################################################################### AC_DEFUN_ONCE([BASIC_INIT], [ diff --git a/make/autoconf/configure.ac b/make/autoconf/configure.ac index 7ba3ae011cf..122364d02f5 100644 --- a/make/autoconf/configure.ac +++ b/make/autoconf/configure.ac @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,16 @@ AC_INIT(OpenJDK, openjdk, build-dev@openjdk.java.net,,http://openjdk.java.net) AC_CONFIG_AUX_DIR([$TOPDIR/make/autoconf/build-aux]) m4_include([build-aux/pkg.m4]) +AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK]) +AC_DEFUN_ONCE([CUSTOM_LATE_HOOK]) +AC_DEFUN_ONCE([CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK]) +AC_DEFUN_ONCE([CUSTOM_SUMMARY_AND_WARNINGS_HOOK]) + +# This line needs to be here, verbatim, after the dummy hook definitions but +# before all includes. It is replaced with custom functionality when building +# custom sources. +#CUSTOM_AUTOCONF_INCLUDE + # Include these first... m4_include([basics.m4]) m4_include([basics_windows.m4]) @@ -47,22 +57,13 @@ m4_include([help.m4]) m4_include([hotspot.m4]) m4_include([jdk-options.m4]) m4_include([jdk-version.m4]) +m4_include([jvm-features.m4]) m4_include([libraries.m4]) m4_include([platform.m4]) m4_include([source-dirs.m4]) m4_include([toolchain.m4]) m4_include([toolchain_windows.m4]) -AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK]) -AC_DEFUN_ONCE([CUSTOM_LATE_HOOK]) -AC_DEFUN_ONCE([CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK]) -AC_DEFUN_ONCE([CUSTOM_SUMMARY_AND_WARNINGS_HOOK]) - -# This line needs to be here, verbatim, after all includes and the dummy hook -# definitions. It is replaced with custom functionality when building -# custom sources. -#CUSTOM_AUTOCONF_INCLUDE - ############################################################################### # # Initialization / Boot-strapping @@ -203,12 +204,6 @@ JDKOPT_SETUP_CODE_COVERAGE # AddressSanitizer JDKOPT_SETUP_ADDRESS_SANITIZER -# Need toolchain to setup dtrace -HOTSPOT_SETUP_DTRACE -HOTSPOT_ENABLE_DISABLE_AOT -HOTSPOT_ENABLE_DISABLE_CDS -HOTSPOT_ENABLE_DISABLE_GTEST - ############################################################################### # # Check dependencies for external and internal libraries. @@ -221,9 +216,17 @@ BASIC_COMPILE_FIXPATH LIB_DETERMINE_DEPENDENCIES LIB_SETUP_LIBRARIES -# Hotspot setup depends on lib checks. +############################################################################### +# +# Setup hotspot and JVM features (needs toolchain). +# +############################################################################### -HOTSPOT_SETUP_JVM_FEATURES +JVM_FEATURES_PARSE_OPTIONS +JVM_FEATURES_SETUP + +HOTSPOT_ENABLE_DISABLE_GTEST +HOTSPOT_SETUP_MISC ############################################################################### # @@ -277,9 +280,6 @@ BASIC_TEST_USABILITY_ISSUES # At the end, call the custom hook. (Dummy macro if no custom sources available) CUSTOM_LATE_HOOK -# This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features. -HOTSPOT_FINALIZE_JVM_FEATURES - # Did user specify any unknown variables? BASIC_CHECK_LEFTOVER_OVERRIDDEN diff --git a/make/autoconf/help.m4 b/make/autoconf/help.m4 index 36b00c0b492..ab8dce2dbb4 100644 --- a/make/autoconf/help.m4 +++ b/make/autoconf/help.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -192,8 +192,8 @@ AC_DEFUN_ONCE([HELP_PRINT_ADDITIONAL_HELP_AND_EXIT], # Print available jvm features $PRINTF "The following JVM features are available as arguments to --with-jvm-features.\n" - $PRINTF "Which are valid to use depends on the target platform.\n " - $PRINTF "%s " $VALID_JVM_FEATURES + $PRINTF "Which are valid to use depends on the target platform and JVM variant.\n " + $PRINTF "%s " valid_jvm_features $PRINTF "\n" # And now exit directly diff --git a/make/autoconf/hotspot.m4 b/make/autoconf/hotspot.m4 index d9005341058..5461a6fb60a 100644 --- a/make/autoconf/hotspot.m4 +++ b/make/autoconf/hotspot.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,14 +23,6 @@ # questions. # -# All valid JVM features, regardless of platform -VALID_JVM_FEATURES="compiler1 compiler2 zero minimal dtrace jvmti jvmci \ - graal vm-structs jni-check services management epsilongc g1gc parallelgc serialgc shenandoahgc zgc nmt cds \ - static-build link-time-opt aot jfr" - -# Deprecated JVM features (these are ignored, but with a warning) -DEPRECATED_JVM_FEATURES="trace cmsgc" - # All valid JVM variants VALID_JVM_VARIANTS="server client minimal core zero custom" @@ -46,32 +38,6 @@ VALID_JVM_VARIANTS="server client minimal core zero custom" AC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT], [ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ]) -############################################################################### -# Check if the specified JVM feature is enabled. To be used in shell if -# constructs, like this: -# if HOTSPOT_CHECK_JVM_FEATURE(jvmti); then -# -# Only valid to use after HOTSPOT_SETUP_JVM_FEATURES has setup features. - -# Definition kept in one line to allow inlining in if statements. -# Additional [] needed to keep m4 from mangling shell constructs. -AC_DEFUN([HOTSPOT_CHECK_JVM_FEATURE], -[ [ [[ " $JVM_FEATURES " =~ " $1 " ]] ] ]) - -############################################################################### -# Check if the specified JVM feature is explicitly disabled. To be used in -# shell if constructs, like this: -# if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then -# -# This function is internal to hotspot.m4, and is only used when constructing -# the valid set of enabled JVM features. Users outside of hotspot.m4 should just -# use HOTSPOT_CHECK_JVM_FEATURE to check if a feature is enabled or not. - -# Definition kept in one line to allow inlining in if statements. -# Additional [] needed to keep m4 from mangling shell constructs. -AC_DEFUN([HOTSPOT_IS_JVM_FEATURE_DISABLED], -[ [ [[ " $DISABLED_JVM_FEATURES " =~ " $1 " ]] ] ]) - ############################################################################### # Check which variants of the JVM that we want to build. Available variants are: # server: normal interpreter, and a tiered C1/C2 compiler @@ -84,7 +50,8 @@ AC_DEFUN([HOTSPOT_IS_JVM_FEATURE_DISABLED], AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], [ AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants], - [JVM variants (separated by commas) to build (server,client,minimal,core,zero,custom) @<:@server@:>@])]) + [JVM variants to build, separated by commas (server client minimal core + zero custom) @<:@server@:>@])]) if test "x$with_jvm_variants" = x; then with_jvm_variants="server" @@ -108,7 +75,8 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], AC_MSG_RESULT([$JVM_VARIANTS]) # Check that the selected variants are valid - BASIC_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, $VALID_JVM_VARIANTS) + BASIC_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, \ + $VALID_JVM_VARIANTS) if test "x$INVALID_VARIANTS" != x; then AC_MSG_NOTICE([Unknown variant(s) specified: "$INVALID_VARIANTS"]) AC_MSG_NOTICE([The available JVM variants are: "$VALID_JVM_VARIANTS"]) @@ -117,9 +85,11 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], # All "special" variants share the same output directory ("server") VALID_MULTIPLE_JVM_VARIANTS="server client minimal" - BASIC_GET_NON_MATCHING_VALUES(INVALID_MULTIPLE_VARIANTS, $JVM_VARIANTS, $VALID_MULTIPLE_JVM_VARIANTS) - if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then - AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.]) + BASIC_GET_NON_MATCHING_VALUES(INVALID_MULTIPLE_VARIANTS, $JVM_VARIANTS, \ + $VALID_MULTIPLE_JVM_VARIANTS) + if test "x$INVALID_MULTIPLE_VARIANTS" != x && \ + test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then + AC_MSG_ERROR([You can only build multiple variants using these variants: '$VALID_MULTIPLE_JVM_VARIANTS']) fi # The "main" variant is the one used by other libs to link against during the @@ -139,473 +109,9 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], AC_SUBST(JVM_VARIANTS) AC_SUBST(VALID_JVM_VARIANTS) AC_SUBST(JVM_VARIANT_MAIN) - - if HOTSPOT_CHECK_JVM_VARIANT(zero); then - # zero behaves as a platform and rewrites these values. This is really weird. :( - # We are guaranteed that we do not build any other variants when building zero. - HOTSPOT_TARGET_CPU=zero - HOTSPOT_TARGET_CPU_ARCH=zero - fi ]) ############################################################################### -# Check if dtrace should be enabled and has all prerequisites present. -# -AC_DEFUN_ONCE([HOTSPOT_SETUP_DTRACE], -[ - # Test for dtrace dependencies - AC_ARG_ENABLE([dtrace], [AS_HELP_STRING([--enable-dtrace@<:@=yes/no/auto@:>@], - [enable dtrace. Default is auto, where dtrace is enabled if all dependencies - are present.])]) - - DTRACE_DEP_MISSING=false - - AC_MSG_CHECKING([for dtrace tool]) - if test "x$DTRACE" != "x" && test -x "$DTRACE"; then - AC_MSG_RESULT([$DTRACE]) - else - AC_MSG_RESULT([not found, cannot build dtrace]) - DTRACE_DEP_MISSING=true - fi - - AC_CHECK_HEADERS([sys/sdt.h], [DTRACE_HEADERS_OK=yes],[DTRACE_HEADERS_OK=no]) - if test "x$DTRACE_HEADERS_OK" != "xyes"; then - DTRACE_DEP_MISSING=true - fi - - AC_MSG_CHECKING([if dtrace should be built]) - if test "x$enable_dtrace" = "xyes"; then - if test "x$DTRACE_DEP_MISSING" = "xtrue"; then - AC_MSG_RESULT([no, missing dependencies]) - HELP_MSG_MISSING_DEPENDENCY([dtrace]) - AC_MSG_ERROR([Cannot enable dtrace with missing dependencies. See above. $HELP_MSG]) - else - INCLUDE_DTRACE=true - AC_MSG_RESULT([yes, forced]) - fi - elif test "x$enable_dtrace" = "xno"; then - INCLUDE_DTRACE=false - AC_MSG_RESULT([no, forced]) - elif test "x$enable_dtrace" = "xauto" || test "x$enable_dtrace" = "x"; then - if test "x$DTRACE_DEP_MISSING" = "xtrue"; then - INCLUDE_DTRACE=false - AC_MSG_RESULT([no, missing dependencies]) - else - INCLUDE_DTRACE=true - AC_MSG_RESULT([yes, dependencies present]) - fi - else - AC_MSG_ERROR([Invalid value for --enable-dtrace: $enable_dtrace]) - fi -]) - -################################################################################ -# Check if AOT should be enabled -# -AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_AOT], -[ - AC_ARG_ENABLE([aot], [AS_HELP_STRING([--enable-aot@<:@=yes/no/auto@:>@], - [enable ahead of time compilation feature. Default is auto, where aot is enabled if all dependencies are present.])]) - - if test "x$enable_aot" = "x" || test "x$enable_aot" = "xauto"; then - ENABLE_AOT="true" - elif test "x$enable_aot" = "xyes"; then - ENABLE_AOT="true" - elif test "x$enable_aot" = "xno"; then - ENABLE_AOT="false" - else - AC_MSG_ERROR([Invalid value for --enable-aot: $enable_aot]) - fi - - if test "x$ENABLE_AOT" = "xtrue"; then - # Only enable AOT on X64 platforms. - if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then - if test -e "${TOPDIR}/src/jdk.aot"; then - if test -e "${TOPDIR}/src/jdk.internal.vm.compiler"; then - ENABLE_AOT="true" - else - ENABLE_AOT="false" - if test "x$enable_aot" = "xyes"; then - AC_MSG_ERROR([Cannot build AOT without src/jdk.internal.vm.compiler sources. Remove --enable-aot.]) - fi - fi - else - ENABLE_AOT="false" - if test "x$enable_aot" = "xyes"; then - AC_MSG_ERROR([Cannot build AOT without src/jdk.aot sources. Remove --enable-aot.]) - fi - fi - else - ENABLE_AOT="false" - if test "x$enable_aot" = "xyes"; then - AC_MSG_ERROR([AOT is currently only supported on x86_64 and aarch64. Remove --enable-aot.]) - fi - fi - fi - - AC_SUBST(ENABLE_AOT) -]) - -################################################################################ -# Allow to disable CDS -# -AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS], -[ - AC_ARG_ENABLE([cds], [AS_HELP_STRING([--enable-cds@<:@=yes/no/auto@:>@], - [enable class data sharing feature in non-minimal VM. Default is auto, where cds is enabled if supported on the platform.])]) - - if test "x$enable_cds" = "x" || test "x$enable_cds" = "xauto"; then - ENABLE_CDS="true" - elif test "x$enable_cds" = "xyes"; then - ENABLE_CDS="true" - elif test "x$enable_cds" = "xno"; then - ENABLE_CDS="false" - else - AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds]) - fi - - AC_SUBST(ENABLE_CDS) -]) - -############################################################################### -# Set up all JVM features for each JVM variant. -# -AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES], -[ - # Prettify the VALID_JVM_FEATURES string - BASIC_SORT_LIST(VALID_JVM_FEATURES, $VALID_JVM_FEATURES) - - # The user can in some cases supply additional jvm features. For the custom - # variant, this defines the entire variant. - AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features], - [JVM features to enable (foo) or disable (-foo), separated by comma. Use '--help' to show possible values @<:@none@:>@])]) - if test "x$with_jvm_features" != x; then - AC_MSG_CHECKING([user specified JVM feature list]) - USER_JVM_FEATURE_LIST=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'` - AC_MSG_RESULT([$user_jvm_feature_list]) - # These features will be added to all variant defaults - JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'` - # These features will be removed from all variant defaults - DISABLED_JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'` - - # Verify that the user has provided valid features - BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $VALID_JVM_FEATURES $DEPRECATED_JVM_FEATURES) - if test "x$INVALID_FEATURES" != x; then - AC_MSG_NOTICE([Unknown JVM features specified: "$INVALID_FEATURES"]) - AC_MSG_NOTICE([The available JVM features are: "$VALID_JVM_FEATURES"]) - AC_MSG_ERROR([Cannot continue]) - fi - - # Check if the user has provided deprecated features - BASIC_GET_MATCHING_VALUES(DEPRECATED_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $DEPRECATED_JVM_FEATURES) - if test "x$DEPRECATED_FEATURES" != x; then - AC_MSG_WARN([Deprecated JVM features specified (will be ignored): "$DEPRECATED_FEATURES"]) - # Filter out deprecated features - BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES, $JVM_FEATURES, $DEPRECATED_FEATURES) - BASIC_GET_NON_MATCHING_VALUES(DISABLED_JVM_FEATURES, $DISABLED_JVM_FEATURES, $DEPRECATED_FEATURES) - fi - - fi - - # Override hotspot cpu definitions for ARM platforms - if test "x$OPENJDK_TARGET_CPU" = xarm; then - HOTSPOT_TARGET_CPU=arm_32 - HOTSPOT_TARGET_CPU_DEFINE="ARM32" - fi - - # Verify that dependencies are met for explicitly set features. - if HOTSPOT_CHECK_JVM_FEATURE(jvmti) && ! HOTSPOT_CHECK_JVM_FEATURE(services); then - AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services']) - fi - - if HOTSPOT_CHECK_JVM_FEATURE(management) && ! HOTSPOT_CHECK_JVM_FEATURE(nmt); then - AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt']) - fi - - if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then - AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1']) - fi - - # Enable JFR by default, except for Zero, linux-sparcv9 and on minimal. - if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then - if test "x$OPENJDK_TARGET_OS" != xaix; then - if test "x$OPENJDK_TARGET_OS" != xlinux || test "x$OPENJDK_TARGET_CPU" != xsparcv9; then - NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jfr" - fi - fi - fi - - # Only enable Shenandoah on supported arches - AC_MSG_CHECKING([if shenandoah can be built]) - if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then - AC_MSG_RESULT([yes]) - else - DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES shenandoahgc" - AC_MSG_RESULT([no, platform not supported]) - fi - - # Only enable ZGC on supported platforms - if (test "x$OPENJDK_TARGET_OS" = "xwindows" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then - AC_MSG_CHECKING([if zgc can be built on windows]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[struct MEM_EXTENDED_PARAMETER x;]]) - ], - [ - AC_MSG_RESULT([yes]) - CAN_BUILD_ZGC_ON_WINDOWS="yes" - ], - [ - AC_MSG_RESULT([no, missing required APIs]) - CAN_BUILD_ZGC_ON_WINDOWS="no" - ] - ) - fi - - AC_MSG_CHECKING([if zgc can be built]) - if (test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xx86_64") || \ - (test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64") || \ - (test "x$CAN_BUILD_ZGC_ON_WINDOWS" = "xyes") || \ - (test "x$OPENJDK_TARGET_OS" = "xmacosx" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then - AC_MSG_RESULT([yes]) - else - DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES zgc" - AC_MSG_RESULT([no, platform not supported]) - fi - - # Disable unsupported GCs for Zero - if HOTSPOT_CHECK_JVM_VARIANT(zero); then - DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES epsilongc g1gc zgc shenandoahgc" - fi - - # Turn on additional features based on other parts of configure - if test "x$INCLUDE_DTRACE" = "xtrue"; then - JVM_FEATURES="$JVM_FEATURES dtrace" - else - if HOTSPOT_CHECK_JVM_FEATURE(dtrace); then - AC_MSG_ERROR([To enable dtrace, you must use --enable-dtrace]) - fi - fi - - if test "x$STATIC_BUILD" = "xtrue"; then - JVM_FEATURES="$JVM_FEATURES static-build" - else - if HOTSPOT_CHECK_JVM_FEATURE(static-build); then - AC_MSG_ERROR([To enable static-build, you must use --enable-static-build]) - fi - fi - - if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then - if HOTSPOT_CHECK_JVM_FEATURE(zero); then - AC_MSG_ERROR([To enable zero, you must use --with-jvm-variants=zero]) - fi - fi - - AC_MSG_CHECKING([if jvmci module jdk.internal.vm.ci should be built]) - # Check if jvmci is diabled - if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then - AC_MSG_RESULT([no, forced]) - JVM_FEATURES_jvmci="" - INCLUDE_JVMCI="false" - else - # Only enable jvmci on x86_64 and aarch64 - if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \ - test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then - AC_MSG_RESULT([yes]) - JVM_FEATURES_jvmci="jvmci" - INCLUDE_JVMCI="true" - else - AC_MSG_RESULT([no]) - JVM_FEATURES_jvmci="" - INCLUDE_JVMCI="false" - if HOTSPOT_CHECK_JVM_FEATURE(jvmci); then - AC_MSG_ERROR([JVMCI is currently not supported on this platform.]) - fi - fi - fi - - AC_SUBST(INCLUDE_JVMCI) - - AC_MSG_CHECKING([if graal module jdk.internal.vm.compiler should be built]) - # Check if graal is diabled - if HOTSPOT_IS_JVM_FEATURE_DISABLED(graal); then - AC_MSG_RESULT([no, forced]) - JVM_FEATURES_graal="" - INCLUDE_GRAAL="false" - else - if HOTSPOT_CHECK_JVM_FEATURE(graal); then - AC_MSG_RESULT([yes, forced]) - if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then - AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci']) - fi - JVM_FEATURES_graal="graal" - INCLUDE_GRAAL="true" - else - # By default enable graal build on x64 or where AOT is available. - # graal build requires jvmci. - if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \ - (test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \ - test "x$ENABLE_AOT" = "xtrue") ; then - AC_MSG_RESULT([yes]) - JVM_FEATURES_graal="graal" - INCLUDE_GRAAL="true" - else - AC_MSG_RESULT([no]) - JVM_FEATURES_graal="" - INCLUDE_GRAAL="false" - fi - fi - fi - - AC_SUBST(INCLUDE_GRAAL) - - # Disable aot with '--with-jvm-features=-aot' - if HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then - ENABLE_AOT="false" - fi - - AC_MSG_CHECKING([if aot should be enabled]) - if test "x$ENABLE_AOT" = "xtrue"; then - if test "x$JVM_FEATURES_graal" != "xgraal"; then - if test "x$enable_aot" = "xyes" || HOTSPOT_CHECK_JVM_FEATURE(aot); then - AC_MSG_RESULT([yes, forced]) - AC_MSG_ERROR([Specified JVM feature 'aot' requires feature 'graal']) - else - AC_MSG_RESULT([no]) - fi - JVM_FEATURES_aot="" - ENABLE_AOT="false" - else - if test "x$enable_aot" = "xyes" || HOTSPOT_CHECK_JVM_FEATURE(aot); then - AC_MSG_RESULT([yes, forced]) - else - AC_MSG_RESULT([yes]) - fi - JVM_FEATURES_aot="aot" - fi - else - if test "x$enable_aot" = "xno" || HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then - AC_MSG_RESULT([no, forced]) - else - AC_MSG_RESULT([no]) - fi - JVM_FEATURES_aot="" - if HOTSPOT_CHECK_JVM_FEATURE(aot); then - AC_MSG_ERROR([To enable aot, you must use --enable-aot]) - fi - fi - - AC_SUBST(ENABLE_AOT) - - if test "x$OPENJDK_TARGET_CPU" = xarm ; then - # Default to use link time optimizations on minimal on arm - JVM_FEATURES_link_time_opt="link-time-opt" - else - JVM_FEATURES_link_time_opt="" - fi - - # All variants but minimal (and custom) get these features - NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES g1gc parallelgc serialgc epsilongc shenandoahgc jni-check jvmti management nmt services vm-structs zgc" - - # Disable CDS on AIX. - if test "x$OPENJDK_TARGET_OS" = "xaix"; then - ENABLE_CDS="false" - if test "x$enable_cds" = "xyes"; then - AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.]) - fi - fi - - # Disable CDS if user requested it with --with-jvm-features=-cds. - if HOTSPOT_IS_JVM_FEATURE_DISABLED(cds); then - ENABLE_CDS="false" - if test "x$enable_cds" = "xyes"; then - AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.]) - fi - fi - - if ! HOTSPOT_CHECK_JVM_VARIANT(server) && ! HOTSPOT_CHECK_JVM_VARIANT(client); then - # ..except when the user explicitely requested it with --enable-jvm-features - if ! HOTSPOT_CHECK_JVM_FEATURE(cds); then - ENABLE_CDS="false" - if test "x$enable_cds" = "xyes"; then - AC_MSG_ERROR([CDS not implemented for variants zero, minimal, core. Remove --enable-cds.]) - fi - fi - fi - - AC_MSG_CHECKING([if cds should be enabled]) - if test "x$ENABLE_CDS" = "xtrue"; then - if test "x$enable_cds" = "xyes"; then - AC_MSG_RESULT([yes, forced]) - else - AC_MSG_RESULT([yes]) - fi - NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds" - else - if test "x$enable_cds" = "xno"; then - AC_MSG_RESULT([no, forced]) - else - AC_MSG_RESULT([no]) - fi - fi - - # Enable features depending on variant. - JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal" - JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES" - JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES" - JVM_FEATURES_minimal="compiler1 minimal serialgc $JVM_FEATURES $JVM_FEATURES_link_time_opt" - JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES" - JVM_FEATURES_custom="$JVM_FEATURES" - - AC_SUBST(JVM_FEATURES_server) - AC_SUBST(JVM_FEATURES_client) - AC_SUBST(JVM_FEATURES_core) - AC_SUBST(JVM_FEATURES_minimal) - AC_SUBST(JVM_FEATURES_zero) - AC_SUBST(JVM_FEATURES_custom) - - # Used for verification of Makefiles by check-jvm-feature - AC_SUBST(VALID_JVM_FEATURES) - - # --with-cpu-port is no longer supported - BASIC_DEPRECATED_ARG_WITH(with-cpu-port) -]) - -############################################################################### -# Finalize JVM features once all setup is complete, including custom setup. -# -AC_DEFUN_ONCE([HOTSPOT_FINALIZE_JVM_FEATURES], -[ - for variant in $JVM_VARIANTS; do - AC_MSG_CHECKING([JVM features for JVM variant '$variant']) - features_var_name=JVM_FEATURES_$variant - JVM_FEATURES_FOR_VARIANT=${!features_var_name} - - # Filter out user-requested disabled features - BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT, $DISABLED_JVM_FEATURES) - - # Keep feature lists sorted and free of duplicates - BASIC_SORT_LIST(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT) - - # Update real feature set variable - eval $features_var_name='"'$JVM_FEATURES_FOR_VARIANT'"' - AC_MSG_RESULT(["$JVM_FEATURES_FOR_VARIANT"]) - - # Verify that we have at least one gc selected - GC_FEATURES=`$ECHO $JVM_FEATURES_FOR_VARIANT | $GREP gc` - if test "x$GC_FEATURES" = x; then - AC_MSG_WARN([Invalid JVM features: No gc selected for variant $variant.]) - fi - - # Validate features (for configure script errors, not user errors) - BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES_FOR_VARIANT, $VALID_JVM_FEATURES) - if test "x$INVALID_FEATURES" != x; then - AC_MSG_ERROR([Internal configure script error. Invalid JVM feature(s): $INVALID_FEATURES]) - fi - done -]) - -################################################################################ # Check if gtest should be built # AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST], @@ -644,3 +150,25 @@ AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST], AC_SUBST(BUILD_GTEST) ]) + +############################################################################### +# Misc hotspot setup that does not fit elsewhere. +# +AC_DEFUN_ONCE([HOTSPOT_SETUP_MISC], +[ + if HOTSPOT_CHECK_JVM_VARIANT(zero); then + # zero behaves as a platform and rewrites these values. This is a bit weird. + # But when building zero, we never build any other variants so it works. + HOTSPOT_TARGET_CPU=zero + HOTSPOT_TARGET_CPU_ARCH=zero + fi + + # Override hotspot cpu definitions for ARM platforms + if test "x$OPENJDK_TARGET_CPU" = xarm; then + HOTSPOT_TARGET_CPU=arm_32 + HOTSPOT_TARGET_CPU_DEFINE="ARM32" + fi + + # --with-cpu-port is no longer supported + BASIC_DEPRECATED_ARG_WITH(with-cpu-port) +]) diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 2fed5c64c67..cb14330afa6 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -616,33 +616,24 @@ AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST], Default is to generate it when either the server or client JVMs are built and enable-cds is true.])]) - # Check if it's likely that it's possible to generate the classlist. Depending - # on exact jvm configuration it could be possible anyway. - if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) || HOTSPOT_CHECK_JVM_FEATURE(cds)); then - ENABLE_GENERATE_CLASSLIST_POSSIBLE="true" - else - ENABLE_GENERATE_CLASSLIST_POSSIBLE="false" - fi + # In jvm-features.m4 ENABLE_CDS is set to true iff all JVM variants has cds + # enabled. AC_MSG_CHECKING([if the CDS classlist generation should be enabled]) if test "x$enable_generate_classlist" = "xyes"; then AC_MSG_RESULT([yes, forced]) ENABLE_GENERATE_CLASSLIST="true" - if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then - if test "x$ENABLE_CDS" = "xfalse"; then - # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the - # classlist file. It never will work in this case since the VM will report - # an error for DumpLoadedClassList when CDS is disabled. - AC_MSG_ERROR([Generation of classlist is not possible with enable-cds=false]) - else - AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS]) - fi + if test "x$ENABLE_CDS" = "xfalse"; then + # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the + # classlist file. It never will work in this case since the VM will report + # an error for DumpLoadedClassList when CDS is disabled. + AC_MSG_ERROR([Generation of classlist is not possible without JVM feature 'cds']) fi elif test "x$enable_generate_classlist" = "xno"; then AC_MSG_RESULT([no, forced]) ENABLE_GENERATE_CLASSLIST="false" elif test "x$enable_generate_classlist" = "x"; then - if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xtrue"; then + if test "x$ENABLE_CDS" = "xtrue"; then AC_MSG_RESULT([yes]) ENABLE_GENERATE_CLASSLIST="true" else diff --git a/make/autoconf/jvm-features.m4 b/make/autoconf/jvm-features.m4 new file mode 100644 index 00000000000..536071cff58 --- /dev/null +++ b/make/autoconf/jvm-features.m4 @@ -0,0 +1,639 @@ +# +# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +############################################################################### +# Terminology used in this file: +# +# Valid features == All possible features that the JVM knows about. +# Deprecated features == Previously known features (not considered valid). +# Available features == Features that are possible to use in this configuration. +# Default features == Features that are on by default in this configuration. +# Enabled features == Features requested by the user to be present. +# Disabled features == Features excluded from being used by the user. +# Active features == The exact set of features to be used for a JVM variant. +# +# All valid features are considered available, unless listed as unavailable. +# All available features will be turned on as default, unless listed in a filter. +############################################################################### + +# We need these as m4 defines to be able to loop over them using m4 later on. + +# All valid JVM features, regardless of platform +define(jvm_features_valid, m4_normalize( \ + ifdef([custom_jvm_features_valid], custom_jvm_features_valid) \ + \ + aot cds compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check \ + jvmci jvmti link-time-opt management minimal nmt parallelgc serialgc \ + services shenandoahgc static-build vm-structs zero zgc \ +)) + +# Deprecated JVM features (these are ignored, but with a warning) +define(jvm_features_deprecated, m4_normalize( + cmsgc trace \ +)) + + +############################################################################### +# Parse command line options for JVM feature selection. After this function +# has run $JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED and $JVM_FEATURES_VALID +# can be used. +# +AC_DEFUN_ONCE([JVM_FEATURES_PARSE_OPTIONS], +[ + # Setup shell variables from the m4 lists + BASIC_SORT_LIST(JVM_FEATURES_VALID, "jvm_features_valid") + BASIC_SORT_LIST(JVM_FEATURES_DEPRECATED, "jvm_features_deprecated") + + # For historical reasons, some jvm features have their own, shorter names. + # Keep those as aliases for the --enable-jvm-feature-* style arguments. + BASIC_ALIASED_ARG_ENABLE(aot, --enable-jvm-feature-aot) + BASIC_ALIASED_ARG_ENABLE(cds, --enable-jvm-feature-cds) + BASIC_ALIASED_ARG_ENABLE(dtrace, --enable-jvm-feature-dtrace) + + # First check for features using the + # --with-jvm-features="<[-]feature>[,<[-]feature> ...]" syntax. + AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features], + [JVM features to enable (foo) or disable (-foo), separated by comma. Use + '--help' to show possible values @<:@none@:>@])]) + if test "x$with_jvm_features" != x; then + # Replace "," with " ". + user_jvm_feature_list=${with_jvm_features//,/ } + JVM_FEATURES_ENABLED=`$ECHO $user_jvm_feature_list | \ + $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'` + JVM_FEATURES_DISABLED=`$ECHO $user_jvm_feature_list | \ + $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'` + + # Verify that the user has provided only valid (or deprecated) features + BASIC_GET_NON_MATCHING_VALUES(invalid_features, $JVM_FEATURES_ENABLED \ + $JVM_FEATURES_DISABLED, $JVM_FEATURES_VALID $JVM_FEATURES_DEPRECATED) + if test "x$invalid_features" != x; then + AC_MSG_NOTICE([Unknown JVM features specified: '$invalid_features']) + AC_MSG_NOTICE([The available JVM features are: '$JVM_FEATURES_VALID']) + AC_MSG_ERROR([Cannot continue]) + fi + + # Check if the user has provided deprecated features + BASIC_GET_MATCHING_VALUES(deprecated_features, $JVM_FEATURES_ENABLED \ + $JVM_FEATURES_DISABLED, $JVM_FEATURES_DEPRECATED) + if test "x$deprecated_features" != x; then + AC_MSG_WARN([Deprecated JVM features specified (will be ignored): '$deprecated_features']) + # Filter out deprecated features + BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_ENABLED, \ + $JVM_FEATURES_ENABLED, $deprecated_features) + BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_DISABLED, \ + $JVM_FEATURES_DISABLED, $deprecated_features) + fi + fi + + # Then check for features using the "--enable-jvm-feature-" syntax. + # Using m4, loop over all features with the variable FEATURE. + m4_foreach(FEATURE, m4_split(jvm_features_valid), [ + AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING( + [--enable-jvm-feature-FEATURE], [enable jvm feature 'FEATURE'])) + + # Create an m4 variable containing a shell variable name (like + # "enable_jvm_feature_static_build"). + define(FEATURE_SHELL, [enable_jvm_feature_]translit(FEATURE, -, _)) + + if test "x$FEATURE_SHELL" = xyes; then + JVM_FEATURES_ENABLED="$JVM_FEATURES_ENABLED FEATURE" + elif test "x$FEATURE_SHELL" = xno; then + JVM_FEATURES_DISABLED="$JVM_FEATURES_DISABLED FEATURE" + elif test "x$FEATURE_SHELL" != x; then + AC_MSG_ERROR([Invalid value for --enable-jvm-feature-FEATURE: '$FEATURE_SHELL']) + fi + + undefine([FEATURE_SHELL]) + ]) + + # Likewise, check for deprecated arguments. + m4_foreach(FEATURE, m4_split(jvm_features_deprecated), [ + AC_ARG_ENABLE(jvm-feature-FEATURE, AS_HELP_STRING( + [--enable-jvm-feature-FEATURE], [enable jvm feature 'FEATURE' + (deprecated)])) + + define(FEATURE_SHELL, [enable_jvm_feature_]translit(FEATURE, -, _)) + + if test "x$FEATURE_SHELL" != x; then + AC_MSG_WARN([Deprecated JVM feature, will be ignored: --enable-jvm-feature-FEATURE]) + fi + + undefine([FEATURE_SHELL]) + ]) + + # Warn if the user has both enabled and disabled a feature + # If this happens, disable will override enable. + BASIC_GET_MATCHING_VALUES(enabled_and_disabled, $JVM_FEATURES_ENABLED, \ + $JVM_FEATURES_DISABLED) + if test "x$enabled_and_disabled" != x; then + AC_MSG_WARN([Disabling of these features will override enabling: '$enabled_and_disabled']) + fi + + # Clean up lists and announce results to user + BASIC_SORT_LIST(JVM_FEATURES_ENABLED, $JVM_FEATURES_ENABLED) + AC_MSG_CHECKING([for JVM features enabled by the user]) + if test "x$JVM_FEATURES_ENABLED" != x; then + AC_MSG_RESULT(['$JVM_FEATURES_ENABLED']) + else + AC_MSG_RESULT([none]) + fi + + BASIC_SORT_LIST(JVM_FEATURES_DISABLED, $JVM_FEATURES_DISABLED) + AC_MSG_CHECKING([for JVM features disabled by the user]) + if test "x$JVM_FEATURES_DISABLED" != x; then + AC_MSG_RESULT(['$JVM_FEATURES_DISABLED']) + else + AC_MSG_RESULT([none]) + fi + + # Makefiles use VALID_JVM_FEATURES in check-jvm-feature to verify correctness. + VALID_JVM_FEATURES="$JVM_FEATURES_VALID" + AC_SUBST(VALID_JVM_FEATURES) +]) + +############################################################################### +# Helper function for the JVM_FEATURES_CHECK_* suite. +# The code in the code block should assign 'false' to the variable AVAILABLE +# if the feature is not available, and this function will handle everything +# else that is needed. +# +# arg 1: The name of the feature to test +# arg 2: The code block to execute +# +AC_DEFUN([JVM_FEATURES_CHECK_AVAILABILITY], +[ + # Assume that feature is available + AVAILABLE=true + + # Execute feature test block + $2 + + AC_MSG_CHECKING([if JVM feature '$1' is available]) + if test "x$AVAILABLE" = "xtrue"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + JVM_FEATURES_PLATFORM_UNAVAILABLE="$JVM_FEATURES_PLATFORM_UNAVAILABLE $1" + fi +]) + +############################################################################### +# Check if the feature 'aot' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_AOT], +[ + JVM_FEATURES_CHECK_AVAILABILITY(aot, [ + AC_MSG_CHECKING([if platform is supported by AOT]) + # AOT is only available where JVMCI is available since it requires JVMCI. + if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \ + test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + + AC_MSG_CHECKING([if AOT source code is present]) + if test -e "${TOPDIR}/src/jdk.internal.vm.compiler" && \ + test -e "${TOPDIR}/src/jdk.aot"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, missing src/jdk.internal.vm.compiler or src/jdk.aot]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'cds' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_CDS], +[ + JVM_FEATURES_CHECK_AVAILABILITY(cds, [ + AC_MSG_CHECKING([if platform is supported by CDS]) + if test "x$OPENJDK_TARGET_OS" != xaix; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_OS]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'dtrace' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_DTRACE], +[ + JVM_FEATURES_CHECK_AVAILABILITY(dtrace, [ + AC_MSG_CHECKING([for dtrace tool]) + if test "x$DTRACE" != "x" && test -x "$DTRACE"; then + AC_MSG_RESULT([$DTRACE]) + else + AC_MSG_RESULT([no]) + AVAILABLE=false + fi + + AC_CHECK_HEADERS([sys/sdt.h], [dtrace_headers_ok=true]) + if test "x$dtrace_headers_ok" != "xtrue"; then + HELP_MSG_MISSING_DEPENDENCY([dtrace]) + AC_MSG_NOTICE([Cannot enable dtrace with missing dependencies. See above.]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'graal' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_GRAAL], +[ + JVM_FEATURES_CHECK_AVAILABILITY(graal, [ + AC_MSG_CHECKING([if platform is supported by Graal]) + # Graal is only available where JVMCI is available since it requires JVMCI. + if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \ + test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'jfr' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_JFR], +[ + JVM_FEATURES_CHECK_AVAILABILITY(jfr, [ + AC_MSG_CHECKING([if platform is supported by JFR]) + if test "x$OPENJDK_TARGET_OS" = xaix || \ + test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-sparcv9"; then + AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) + AVAILABLE=false + else + AC_MSG_RESULT([yes]) + fi + ]) +]) + +############################################################################### +# Check if the feature 'jvmci' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_JVMCI], +[ + JVM_FEATURES_CHECK_AVAILABILITY(jvmci, [ + AC_MSG_CHECKING([if platform is supported by JVMCI]) + if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \ + test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'shenandoahgc' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_SHENANDOAHGC], +[ + JVM_FEATURES_CHECK_AVAILABILITY(shenandoahgc, [ + AC_MSG_CHECKING([if platform is supported by Shenandoah]) + if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || \ + test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'static-build' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_STATIC_BUILD], +[ + JVM_FEATURES_CHECK_AVAILABILITY(static-build, [ + AC_MSG_CHECKING([if static-build is enabled in configure]) + if test "x$STATIC_BUILD" = "xtrue"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, use --enable-static-build to enable static build.]) + AVAILABLE=false + fi + ]) +]) + +############################################################################### +# Check if the feature 'zgc' is available on this platform. +# +AC_DEFUN_ONCE([JVM_FEATURES_CHECK_ZGC], +[ + JVM_FEATURES_CHECK_AVAILABILITY(zgc, [ + AC_MSG_CHECKING([if platform is supported by ZGC]) + if test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then + if test "x$OPENJDK_TARGET_OS" = "xlinux" || \ + test "x$OPENJDK_TARGET_OS" = "xwindows" || \ + test "x$OPENJDK_TARGET_OS" = "xmacosx"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + elif test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-aarch64"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no, $OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) + AVAILABLE=false + fi + + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then + AC_MSG_CHECKING([if Windows APIs required for ZGC is present]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[struct MEM_EXTENDED_PARAMETER x;]]) + ], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no, missing required APIs]) + AVAILABLE=false + ] + ) + fi + ]) +]) + +############################################################################### +# Setup JVM_FEATURES_PLATFORM_UNAVAILABLE and JVM_FEATURES_PLATFORM_FILTER +# to contain those features that are unavailable, or should be off by default, +# for this platform, regardless of JVM variant. +# +AC_DEFUN_ONCE([JVM_FEATURES_PREPARE_PLATFORM], +[ + # The checks below should add unavailable features to + # JVM_FEATURES_PLATFORM_UNAVAILABLE. + + JVM_FEATURES_CHECK_AOT + JVM_FEATURES_CHECK_CDS + JVM_FEATURES_CHECK_DTRACE + JVM_FEATURES_CHECK_GRAAL + JVM_FEATURES_CHECK_JFR + JVM_FEATURES_CHECK_JVMCI + JVM_FEATURES_CHECK_SHENANDOAHGC + JVM_FEATURES_CHECK_STATIC_BUILD + JVM_FEATURES_CHECK_ZGC + + # Filter out features by default for all variants on certain platforms. + # Make sure to just add to JVM_FEATURES_PLATFORM_FILTER, since it could + # have a value already from custom extensions. + if test "x$OPENJDK_TARGET_OS" = xaix; then + JVM_FEATURES_PLATFORM_FILTER="$JVM_FEATURES_PLATFORM_FILTER jfr" + fi + + if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = "xlinux-sparcv9"; then + JVM_FEATURES_PLATFORM_FILTER="$JVM_FEATURES_PLATFORM_FILTER jfr" + fi +]) + +############################################################################### +# Setup JVM_FEATURES_VARIANT_UNAVAILABLE and JVM_FEATURES_VARIANT_FILTER +# to contain those features that are unavailable, or should be off by default, +# for this particular JVM variant. +# +# arg 1: JVM variant +# +AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT], +[ + variant=$1 + + # Check which features are unavailable for this JVM variant. + # This means that is not possible to build these features for this variant. + if test "x$variant" = "xminimal"; then + JVM_FEATURES_VARIANT_UNAVAILABLE="cds zero" + elif test "x$variant" = "xcore"; then + JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero" + elif test "x$variant" = "xzero"; then + JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \ + epsilongc g1gc graal jvmci minimal shenandoahgc zgc" + else + JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero" + fi + + # Check which features should be off by default for this JVM variant. + if test "x$variant" = "xclient"; then + JVM_FEATURES_VARIANT_FILTER="aot compiler2 graal jvmci link-time-opt" + elif test "x$variant" = "xminimal"; then + JVM_FEATURES_VARIANT_FILTER="aot cds compiler2 dtrace epsilongc g1gc \ + graal jfr jni-check jvmci jvmti management nmt parallelgc services \ + shenandoahgc vm-structs zgc" + if test "x$OPENJDK_TARGET_CPU" != xarm ; then + # Only arm-32 should have link-time-opt enabled as default. + JVM_FEATURES_VARIANT_FILTER="$JVM_FEATURES_VARIANT_FILTER \ + link-time-opt" + fi + elif test "x$variant" = "xcore"; then + JVM_FEATURES_VARIANT_FILTER="aot compiler1 compiler2 graal jvmci \ + link-time-opt" + elif test "x$variant" = "xzero"; then + JVM_FEATURES_VARIANT_FILTER="jfr link-time-opt" + else + JVM_FEATURES_VARIANT_FILTER="link-time-opt" + fi +]) + +############################################################################### +# Calculate the actual set of active JVM features for this JVM variant. Store +# the result in JVM_FEATURES_ACTIVE. +# +# arg 1: JVM variant +# +AC_DEFUN([JVM_FEATURES_CALCULATE_ACTIVE], +[ + variant=$1 + + # The default is set to all valid features except those unavailable or listed + # in a filter. + if test "x$variant" != xcustom; then + BASIC_GET_NON_MATCHING_VALUES(default_for_variant, $JVM_FEATURES_VALID, \ + $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE \ + $JVM_FEATURES_PLATFORM_FILTER $JVM_FEATURES_VARIANT_FILTER) + else + # Except for the 'custom' variant, where the default is to start with an + # empty set. + default_for_variant="" + fi + + # Verify that explicitly enabled features are available + BASIC_GET_MATCHING_VALUES(enabled_but_unavailable, $JVM_FEATURES_ENABLED, \ + $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE) + if test "x$enabled_but_unavailable" != x; then + AC_MSG_NOTICE([ERROR: Unavailable JVM features explicitly enabled for '$variant': '$enabled_but_unavailable']) + AC_MSG_ERROR([Cannot continue]) + fi + + # Notify the user if their command line options has no real effect + BASIC_GET_MATCHING_VALUES(enabled_but_default, $JVM_FEATURES_ENABLED, \ + $default_for_variant) + if test "x$enabled_but_default" != x; then + AC_MSG_NOTICE([Default JVM features explicitly enabled for '$variant': '$enabled_but_default']) + fi + BASIC_GET_MATCHING_VALUES(disabled_but_unavailable, $JVM_FEATURES_DISABLED, \ + $JVM_FEATURES_PLATFORM_UNAVAILABLE $JVM_FEATURES_VARIANT_UNAVAILABLE) + if test "x$disabled_but_unavailable" != x; then + AC_MSG_NOTICE([Unavailable JVM features explicitly disabled for '$variant': '$disabled_but_unavailable']) + fi + + # JVM_FEATURES_ACTIVE is the set of all default features and all explicitly + # enabled features, with the explicitly disabled features filtered out. + BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_ACTIVE, $default_for_variant \ + $JVM_FEATURES_ENABLED, $JVM_FEATURES_DISABLED) +]) + +############################################################################### +# Helper function for JVM_FEATURES_VERIFY. Check if the specified JVM +# feature is active. To be used in shell if constructs, like this: +# 'if JVM_FEATURES_IS_ACTIVE(jvmti); then' +# +# Definition kept in one line to allow inlining in if statements. +# Additional [] needed to keep m4 from mangling shell constructs. +AC_DEFUN([JVM_FEATURES_IS_ACTIVE], +[ [ [[ " $JVM_FEATURES_ACTIVE " =~ ' '$1' ' ]] ] ]) + +############################################################################### +# Verify that the resulting set of features is consistent and legal. +# +# arg 1: JVM variant +# +AC_DEFUN([JVM_FEATURES_VERIFY], +[ + variant=$1 + + # Verify that dependencies are met for inter-feature relations. + if JVM_FEATURES_IS_ACTIVE(aot) && ! JVM_FEATURES_IS_ACTIVE(graal); then + AC_MSG_ERROR([Specified JVM feature 'aot' requires feature 'graal' for variant '$variant']) + fi + + if JVM_FEATURES_IS_ACTIVE(graal) && ! JVM_FEATURES_IS_ACTIVE(jvmci); then + AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci' for variant '$variant']) + fi + + if JVM_FEATURES_IS_ACTIVE(jvmci) && ! (JVM_FEATURES_IS_ACTIVE(compiler1) || \ + JVM_FEATURES_IS_ACTIVE(compiler2)); then + AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1' for variant '$variant']) + fi + + if JVM_FEATURES_IS_ACTIVE(jvmti) && ! JVM_FEATURES_IS_ACTIVE(services); then + AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services' for variant '$variant']) + fi + + if JVM_FEATURES_IS_ACTIVE(management) && ! JVM_FEATURES_IS_ACTIVE(nmt); then + AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt' for variant '$variant']) + fi + + # For backwards compatibility, disable a feature "globally" if one variant + # is missing the feature. + if ! JVM_FEATURES_IS_ACTIVE(aot); then + ENABLE_AOT="false" + fi + if ! JVM_FEATURES_IS_ACTIVE(cds); then + ENABLE_CDS="false" + fi + if ! JVM_FEATURES_IS_ACTIVE(graal); then + INCLUDE_GRAAL="false" + fi + if ! JVM_FEATURES_IS_ACTIVE(jvmci); then + INCLUDE_JVMCI="false" + fi + + # Verify that we have at least one gc selected (i.e., feature named "*gc"). + if ! JVM_FEATURES_IS_ACTIVE(.*gc); then + AC_MSG_NOTICE([At least one gc needed for variant '$variant'.]) + AC_MSG_NOTICE([Specified features: '$JVM_FEATURES_ACTIVE']) + AC_MSG_ERROR([Cannot continue]) + fi +]) + +############################################################################### +# Set up all JVM features for each enabled JVM variant. Requires that +# JVM_FEATURES_PARSE_OPTIONS has been called. +# +AC_DEFUN_ONCE([JVM_FEATURES_SETUP], +[ + # Set up variant-independent factors + JVM_FEATURES_PREPARE_PLATFORM + + # For backwards compatibility, tentatively enable these features "globally", + # and disable them in JVM_FEATURES_VERIFY if a variant is found that are + # missing any of them. + ENABLE_AOT="true" + ENABLE_CDS="true" + INCLUDE_GRAAL="true" + INCLUDE_JVMCI="true" + + for variant in $JVM_VARIANTS; do + # Figure out if any features are unavailable, or should be filtered out + # by default, for this variant. + # Store the result in JVM_FEATURES_VARIANT_UNAVAILABLE and + # JVM_FEATURES_VARIANT_FILTER. + JVM_FEATURES_PREPARE_VARIANT($variant) + + # Calculate the resulting set of enabled features for this variant. + # The result is stored in JVM_FEATURES_ACTIVE. + JVM_FEATURES_CALCULATE_ACTIVE($variant) + + # Verify consistency for JVM_FEATURES_ACTIVE. + JVM_FEATURES_VERIFY($variant) + + # Keep feature list sorted and free of duplicates + BASIC_SORT_LIST(JVM_FEATURES_ACTIVE, $JVM_FEATURES_ACTIVE) + AC_MSG_CHECKING([JVM features to use for variant '$variant']) + AC_MSG_RESULT(['$JVM_FEATURES_ACTIVE']) + + # Save this as e.g. JVM_FEATURES_server, using indirect variable + # referencing. + features_var_name=JVM_FEATURES_$variant + eval $features_var_name=\"$JVM_FEATURES_ACTIVE\" + done + + # Unfortunately AC_SUBST does not work with non-literally named variables, + # so list all variants here. + AC_SUBST(JVM_FEATURES_server) + AC_SUBST(JVM_FEATURES_client) + AC_SUBST(JVM_FEATURES_minimal) + AC_SUBST(JVM_FEATURES_core) + AC_SUBST(JVM_FEATURES_zero) + AC_SUBST(JVM_FEATURES_custom) + + AC_SUBST(ENABLE_AOT) + AC_SUBST(INCLUDE_GRAAL) + AC_SUBST(INCLUDE_JVMCI) + +]) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index fe9069d95f5..001b1015cb2 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -251,7 +251,7 @@ var getJibProfilesCommon = function (input, data) { configure_args: concat(["--enable-jtreg-failure-handler"], "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I,zh_TW,zh_HK", "--disable-manpages", - "--with-jvm-features=-shenandoahgc", + "--disable-jvm-feature-shenandoahgc", versionArgs(input, common)) }; // Extra settings for debug profiles diff --git a/src/hotspot/.mx.jvmci/mx_jvmci.py b/src/hotspot/.mx.jvmci/mx_jvmci.py index 98f4f6e3485..9162cd16af8 100644 --- a/src/hotspot/.mx.jvmci/mx_jvmci.py +++ b/src/hotspot/.mx.jvmci/mx_jvmci.py @@ -1,7 +1,7 @@ # # ---------------------------------------------------------------------------------------------------- # -# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -153,8 +153,8 @@ To build hotspot and import it into the JDK: "mx make hotspot import-hotspot" # JDK10 must be bootstrapped with a JDK9 compliance = mx.JavaCompliance('9') jdk9 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value) - cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal', - '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk9.home, '--with-jvm-features=graal'] + cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--enable-jvm-feature-graal', + '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk9.home] mx.run(cmd, cwd=_get_jdk_dir()) cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel] if mx.get_opts().verbose: