# HG changeset patch # User simonis # Date 1528900550 -7200 # Wed Jun 13 16:35:50 2018 +0200 # Node ID 1f21a95893595d2e03f8bee220018ace2db85559 # Parent 54fcaffa8face258b039e9b0caf0f7ad1deb67cc 8204965: Fix '--disable-cds' and disable CDS on AIX by default diff --git a/make/autoconf/hotspot.m4 b/make/autoconf/hotspot.m4 --- a/make/autoconf/hotspot.m4 +++ b/make/autoconf/hotspot.m4 @@ -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) ]) @@ -411,8 +421,21 @@ # All variants but minimal (and custom) get these features NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc 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. diff --git a/src/hotspot/share/classfile/classListParser.cpp b/src/hotspot/share/classfile/classListParser.cpp --- a/src/hotspot/share/classfile/classListParser.cpp +++ b/src/hotspot/share/classfile/classListParser.cpp @@ -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. diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -770,15 +770,19 @@ { assert(fd->signature() == vmSymbols::string_signature(), "just checking"); +#if INCLUDE_CDS_JAVA_HEAP if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) { // Archive the String field and update the pointer. oop s = mirror()->obj_field(fd->offset()); oop archived_s = StringTable::create_archived_string(s, CHECK); mirror()->obj_field_put(fd->offset(), archived_s); } else { +#endif oop string = fd->string_initial_value(CHECK); mirror()->obj_field_put(fd->offset(), string); +#if INCLUDE_CDS_JAVA_HEAP } +#endif } break; default: diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -649,7 +649,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; diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -2448,7 +2448,7 @@ \ /* Shared spaces */ \ \ - product(bool, UseSharedSpaces, true, \ + product(bool, UseSharedSpaces, CDS_ONLY(true) NOT_CDS(false), \ "Use shared spaces for metadata") \ \ product(bool, VerifySharedSpaces, false, \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -1117,7 +1117,7 @@ /********************************************/ \ \ nonstatic_field(FileMapInfo, _header, FileMapInfo::FileMapHeader*) \ - static_field(FileMapInfo, _current_info, FileMapInfo*) \ + CDS_ONLY(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) \ diff --git a/test/lib/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java --- a/test/lib/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -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)); } }