changeset 51259:d9753e3db0c6

8204965: Fix '--disable-cds' and disable CDS on AIX by default Reviewed-by: erikj, jiangli, stuefe, dholmes
author simonis
date Tue, 19 Jun 2018 09:43:53 +0200
parents 724ed31f9d05
children 9fdfe5ca0e5e
files make/autoconf/hotspot.m4 src/hotspot/share/classfile/classListParser.cpp src/hotspot/share/prims/jvmtiEnv.cpp src/hotspot/share/runtime/vmStructs.cpp test/lib/jdk/test/lib/Platform.java
diffstat 5 files changed, 38 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/hotspot.m4	Tue Jun 19 09:34:39 2018 +0200
+++ b/make/autoconf/hotspot.m4	Tue Jun 19 09:43:53 2018 +0200
@@ -241,10 +241,12 @@
 #
 AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS],
 [
-  AC_ARG_ENABLE([cds], [AS_HELP_STRING([--enable-cds@<:@=yes/no@:>@],
-      [enable class data sharing feature in non-minimal VM. Default is yes.])])
+  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" = "xyes"; then
+  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"
@@ -252,6 +254,14 @@
     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)
 ])
 
@@ -424,8 +434,21 @@
 
   # 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"
+
+  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.
--- a/src/hotspot/share/classfile/classListParser.cpp	Tue Jun 19 09:34:39 2018 +0200
+++ b/src/hotspot/share/classfile/classListParser.cpp	Tue Jun 19 09:43:53 2018 +0200
@@ -274,8 +274,8 @@
 // This function is used for loading classes for customized class loaders
 // during archive dumping.
 InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
-#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(AIX)))
-  // The only supported platforms are: (1) Linux/64-bit; (2) Solaris/64-bit; (3) AIX/64-bit
+#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS)))
+  // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit
   //
   // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
   // method in test/lib/jdk/test/lib/Platform.java.
--- a/src/hotspot/share/prims/jvmtiEnv.cpp	Tue Jun 19 09:34:39 2018 +0200
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp	Tue Jun 19 09:43:53 2018 +0200
@@ -657,7 +657,11 @@
 
     // add the jar file to the bootclasspath
     log_info(class, load)("opened: %s", zip_entry->name());
+#if INCLUDE_CDS
     ClassLoaderExt::append_boot_classpath(zip_entry);
+#else
+    ClassLoader::add_to_boot_append_entries(zip_entry);
+#endif
     return JVMTI_ERROR_NONE;
   } else {
     return JVMTI_ERROR_WRONG_PHASE;
--- a/src/hotspot/share/runtime/vmStructs.cpp	Tue Jun 19 09:34:39 2018 +0200
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Tue Jun 19 09:43:53 2018 +0200
@@ -1117,11 +1117,11 @@
   /* FileMapInfo fields (CDS archive related) */                                                                                     \
   /********************************************/                                                                                     \
                                                                                                                                      \
-  nonstatic_field(FileMapInfo,                 _header,                                       FileMapInfo::FileMapHeader*)           \
-     static_field(FileMapInfo,                 _current_info,                                 FileMapInfo*)                          \
-  nonstatic_field(FileMapInfo::FileMapHeader,  _space[0],                                     FileMapInfo::FileMapHeader::space_info)\
-  nonstatic_field(FileMapInfo::FileMapHeader::space_info, _addr._base,                        char*)                                 \
-  nonstatic_field(FileMapInfo::FileMapHeader::space_info, _used,                              size_t)                                \
+  CDS_ONLY(nonstatic_field(FileMapInfo,                            _header,                   FileMapInfo::FileMapHeader*))          \
+  CDS_ONLY(   static_field(FileMapInfo,                            _current_info,             FileMapInfo*))                         \
+  CDS_ONLY(nonstatic_field(FileMapInfo::FileMapHeader,             _space[0],                 FileMapInfo::FileMapHeader::space_info))\
+  CDS_ONLY(nonstatic_field(FileMapInfo::FileMapHeader::space_info, _addr._base,               char*))                                \
+  CDS_ONLY(nonstatic_field(FileMapInfo::FileMapHeader::space_info, _used,                     size_t))                               \
                                                                                                                                      \
   /******************/                                                                                                               \
   /* VMError fields */                                                                                                               \
--- a/test/lib/jdk/test/lib/Platform.java	Tue Jun 19 09:34:39 2018 +0200
+++ b/test/lib/jdk/test/lib/Platform.java	Tue Jun 19 09:43:53 2018 +0200
@@ -344,8 +344,7 @@
         boolean isLinux = Platform.isLinux();
         boolean is64 = Platform.is64bit();
         boolean isSolaris = Platform.isSolaris();
-        boolean isAix = Platform.isAix();
 
-        return (is64 && (isLinux || isSolaris || isAix));
+        return (is64 && (isLinux || isSolaris));
     }
 }