8211837: Creation of the default CDS Archive should depend on ENABLE_CDS
authorsimonis
Mon, 08 Oct 2018 17:41:44 +0200
changeset 52039 15a9f90aa00f
parent 52038 957de5be48bc
child 52040 d8aebcc2d3ac
8211837: Creation of the default CDS Archive should depend on ENABLE_CDS Reviewed-by: shade, goetz, mdoerr, iklam
make/autoconf/hotspot.m4
make/autoconf/jdk-options.m4
--- a/make/autoconf/hotspot.m4	Mon Oct 08 06:52:41 2018 -0700
+++ b/make/autoconf/hotspot.m4	Mon Oct 08 17:41:44 2018 +0200
@@ -252,14 +252,6 @@
     AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
   fi
 
-  # 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
-
   AC_SUBST(ENABLE_CDS)
 ])
 
@@ -489,6 +481,34 @@
   # All variants but minimal (and custom) get these features
   NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc jni-check jvmti management nmt services vm-structs"
 
+  # 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.
+  DISABLE_CDS=`$ECHO $DISABLED_JVM_FEATURES | $GREP cds`
+  if test "x$DISABLE_CDS" = "xcds"; 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
+
+  # Disable CDS for zero, minimal, core..
+  if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(minimal) || HOTSPOT_CHECK_JVM_VARIANT(core); 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
--- a/make/autoconf/jdk-options.m4	Mon Oct 08 06:52:41 2018 -0700
+++ b/make/autoconf/jdk-options.m4	Mon Oct 08 17:41:44 2018 +0200
@@ -527,7 +527,7 @@
 
   # 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)); then
+  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"
@@ -610,7 +610,6 @@
 #
 # Disable the default CDS archive generation
 #   cross compilation - disabled
-#   zero              - off by default (not a tested configuration)
 #
 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
 [
@@ -618,15 +617,15 @@
       [Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])])
 
   AC_MSG_CHECKING([if a default CDS archive should be generated])
-  if test "x$COMPILE_TYPE" = "xcross"; then
+  if test "x$ENABLE_CDS" = "xfalse"; then
+    AC_MSG_RESULT([no, because CDS is disabled])
+    BUILD_CDS_ARCHIVE="false"
+  elif test "x$COMPILE_TYPE" = "xcross"; then
     AC_MSG_RESULT([no, not possible with cross compilation])
     BUILD_CDS_ARCHIVE="false"
   elif test "x$enable_cds_archive" = "xyes"; then
     AC_MSG_RESULT([yes, forced])
     BUILD_CDS_ARCHIVE="true"
-  elif HOTSPOT_CHECK_JVM_VARIANT(zero); then
-    AC_MSG_RESULT([no])
-    BUILD_CDS_ARCHIVE="false"
   elif test "x$enable_cds_archive" = "x"; then
     AC_MSG_RESULT([yes])
     BUILD_CDS_ARCHIVE="true"