# HG changeset patch # User mbaesken # Date 1500362084 -7200 # Tue Jul 18 09:14:44 2017 +0200 # Node ID b1991a8b4e54ac430295a9f5ad8903c9750e6ef7 # Parent 2fe2a593e8ebf3a9e4dcd9ba3333a7b43126589d 8184323: compile-time guard some UseSharedSpaces-only coding with the INCLUDE_CDS macro diff --git a/src/os/posix/vm/vmError_posix.cpp b/src/os/posix/vm/vmError_posix.cpp --- a/src/os/posix/vm/vmError_posix.cpp +++ b/src/os/posix/vm/vmError_posix.cpp @@ -127,6 +127,7 @@ // Write a hint to the stream in case siginfo relates to a segv/bus error // and the offending address points into CDS archive. void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) { +#if INCLUDE_CDS if (siginfo && UseSharedSpaces) { const siginfo_t* const si = (siginfo_t*)siginfo; if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) { @@ -140,5 +141,6 @@ } } } +#endif } diff --git a/src/os/windows/vm/vmError_windows.cpp b/src/os/windows/vm/vmError_windows.cpp --- a/src/os/windows/vm/vmError_windows.cpp +++ b/src/os/windows/vm/vmError_windows.cpp @@ -51,6 +51,7 @@ // Write a hint to the stream in case siginfo relates to a segv/bus error // and the offending address points into CDS archive. void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) { +#if INCLUDE_CDS if (siginfo && UseSharedSpaces) { const EXCEPTION_RECORD* const er = (const EXCEPTION_RECORD*)siginfo; if (er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR && @@ -61,8 +62,9 @@ if (mapinfo->is_in_shared_space(fault_addr)) { st->print("Error accessing class data sharing archive. " "Mapped file inaccessible during execution, possible disk/network problem."); + } } } - } } +#endif } diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -2146,13 +2146,16 @@ // Preload commonly used klasses WKID scan = FIRST_WKID; // first do Object, then String, Class +#if INCLUDE_CDS if (UseSharedSpaces) { initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK); // Initialize the constant pool for the Object_class InstanceKlass* ik = InstanceKlass::cast(Object_klass()); ik->constants()->restore_unshareable_info(CHECK); initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); - } else { + } else +#endif + { initialize_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK); } diff --git a/src/share/vm/memory/universe.cpp b/src/share/vm/memory/universe.cpp --- a/src/share/vm/memory/universe.cpp +++ b/src/share/vm/memory/universe.cpp @@ -263,11 +263,14 @@ void initialize_basic_type_klass(Klass* k, TRAPS) { Klass* ok = SystemDictionary::Object_klass(); +#if INCLUDE_CDS if (UseSharedSpaces) { ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); assert(k->super() == ok, "u3"); k->restore_unshareable_info(loader_data, Handle(), CHECK); - } else { + } else +#endif + { k->initialize_supers(ok, CHECK); } k->append_to_sibling_list(); @@ -321,6 +324,7 @@ _the_null_string = StringTable::intern("null", CHECK); _the_min_jint_string = StringTable::intern("-2147483648", CHECK); +#if INCLUDE_CDS if (UseSharedSpaces) { // Verify shared interfaces array. assert(_the_array_interfaces_array->at(0) == @@ -328,7 +332,9 @@ assert(_the_array_interfaces_array->at(1) == SystemDictionary::Serializable_klass(), "u3"); MetaspaceShared::fixup_shared_string_regions(); - } else { + } else +#endif + { // Set up shared interfaces array. (Do this before supers are set up.) _the_array_interfaces_array->at_put(0, SystemDictionary::Cloneable_klass()); _the_array_interfaces_array->at_put(1, SystemDictionary::Serializable_klass()); @@ -691,6 +697,7 @@ Universe::_throw_illegal_access_error_cache = new LatestMethodCache(); Universe::_do_stack_walk_cache = new LatestMethodCache(); +#if INCLUDE_CDS if (UseSharedSpaces) { // Read the data structures supporting the shared spaces (shared // system dictionary, symbol table, etc.). After that, access to @@ -699,13 +706,17 @@ // currently mapped regions. MetaspaceShared::initialize_shared_spaces(); StringTable::create_table(); - } else { + } else +#endif + { SymbolTable::create_table(); StringTable::create_table(); +#if INCLUDE_CDS if (DumpSharedSpaces) { MetaspaceShared::prepare_for_dumping(); } +#endif } if (strlen(VerifySubSet) > 0) { Universe::initialize_verify_flags(); diff --git a/src/share/vm/prims/jvmtiRedefineClasses.cpp b/src/share/vm/prims/jvmtiRedefineClasses.cpp --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -173,6 +173,7 @@ void VM_RedefineClasses::doit() { Thread *thread = Thread::current(); +#if INCLUDE_CDS if (UseSharedSpaces) { // Sharing is enabled so we remap the shared readonly space to // shared readwrite, private just in case we need to redefine @@ -184,6 +185,7 @@ return; } } +#endif // Mark methods seen on stack and everywhere else so old methods are not // cleaned up if they're on the stack.