# HG changeset patch # User hseigel # Date 1357670291 18000 # Node ID 56114889655951ee803faaf6fa00de6dd1218713 # Parent 6c3f47d964f33a1e8bb91197ee09e1d192f4471e 8005076: Creating a CDS archive with one alignment and running another causes a crash. Summary: Save the alignment when writing the CDS and compare it when reading the CDS. Reviewed-by: kvn, coleenp diff -r 6c3f47d964f3 -r 561148896559 src/share/vm/memory/filemap.cpp --- a/src/share/vm/memory/filemap.cpp Mon Jan 07 15:32:51 2013 -0500 +++ b/src/share/vm/memory/filemap.cpp Tue Jan 08 13:38:11 2013 -0500 @@ -119,6 +119,7 @@ _header._magic = 0xf00baba2; _header._version = _current_version; _header._alignment = alignment; + _header._obj_alignment = ObjectAlignmentInBytes; // The following fields are for sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's @@ -473,6 +474,12 @@ " version or build of HotSpot."); return false; } + if (_header._obj_alignment != ObjectAlignmentInBytes) { + fail_continue("The shared archive file's ObjectAlignmentInBytes of %d" + " does not equal the current ObjectAlignmentInBytes of %d.", + _header._obj_alignment, ObjectAlignmentInBytes); + return false; + } // Cannot verify interpreter yet, as it can only be created after the GC // heap has been initialized. diff -r 6c3f47d964f3 -r 561148896559 src/share/vm/memory/filemap.hpp --- a/src/share/vm/memory/filemap.hpp Mon Jan 07 15:32:51 2013 -0500 +++ b/src/share/vm/memory/filemap.hpp Tue Jan 08 13:38:11 2013 -0500 @@ -63,6 +63,7 @@ int _magic; // identify file type. int _version; // (from enum, above.) size_t _alignment; // how shared archive should be aligned + int _obj_alignment; // value of ObjectAlignmentInBytes struct space_info { int _file_offset; // sizeof(this) rounded to vm page size diff -r 6c3f47d964f3 -r 561148896559 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Mon Jan 07 15:32:51 2013 -0500 +++ b/src/share/vm/runtime/arguments.cpp Tue Jan 08 13:38:11 2013 -0500 @@ -1331,14 +1331,14 @@ // then a saved space from compressed oops. if ((int)ObjectAlignmentInBytes > 256) { jio_fprintf(defaultStream::error_stream(), - "error: ObjectAlignmentInBytes=%d must not be greater then 256\n", + "error: ObjectAlignmentInBytes=%d must not be greater than 256\n", (int)ObjectAlignmentInBytes); return false; } // In case page size is very small. if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) { jio_fprintf(defaultStream::error_stream(), - "error: ObjectAlignmentInBytes=%d must be less then page size %d\n", + "error: ObjectAlignmentInBytes=%d must be less than page size %d\n", (int)ObjectAlignmentInBytes, os::vm_page_size()); return false; } @@ -2997,11 +2997,6 @@ FLAG_SET_DEFAULT(UseLargePages, false); } - // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting - if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) { - SharedReadOnlySize = 14*M; - } - if (DumpSharedSpaces) { if (RequireSharedSpaces) { warning("cannot dump shared archive while using shared archive"); diff -r 6c3f47d964f3 -r 561148896559 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Mon Jan 07 15:32:51 2013 -0500 +++ b/src/share/vm/runtime/globals.hpp Tue Jan 08 13:38:11 2013 -0500 @@ -1830,7 +1830,7 @@ \ product(intx, CMSIsTooFullPercentage, 98, \ "An absolute ceiling above which CMS will always consider the " \ - "perm gen ripe for collection") \ + "unloading of classes when class unloading is enabled") \ \ develop(bool, CMSTestInFreeList, false, \ "Check if the coalesced range is already in the " \ @@ -1899,13 +1899,13 @@ "Metadata deallocation alot interval") \ \ develop(bool, TraceMetadataChunkAllocation, false, \ - "Trace humongous metadata allocations") \ + "Trace chunk metadata allocations") \ \ product(bool, TraceMetadataHumongousAllocation, false, \ "Trace humongous metadata allocations") \ \ develop(bool, TraceMetavirtualspaceAllocation, false, \ - "Trace humongous metadata allocations") \ + "Trace virtual space metadata allocations") \ \ notproduct(bool, ExecuteInternalVMTests, false, \ "Enable execution of internal VM tests.") \ @@ -3537,10 +3537,10 @@ /* Shared spaces */ \ \ product(bool, UseSharedSpaces, true, \ - "Use shared spaces in the permanent generation") \ + "Use shared spaces for metadata") \ \ product(bool, RequireSharedSpaces, false, \ - "Require shared spaces in the permanent generation") \ + "Require shared spaces for metadata") \ \ product(bool, DumpSharedSpaces, false, \ "Special mode: JVM reads a class list, loads classes, builds " \ @@ -3551,16 +3551,16 @@ "Print usage of shared spaces") \ \ product(uintx, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M), \ - "Size of read-write space in permanent generation (in bytes)") \ + "Size of read-write space for metadata (in bytes)") \ \ product(uintx, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M), \ - "Size of read-only space in permanent generation (in bytes)") \ + "Size of read-only space for metadata (in bytes)") \ \ product(uintx, SharedMiscDataSize, NOT_LP64(2*M) LP64_ONLY(4*M), \ - "Size of the shared data area adjacent to the heap (in bytes)") \ + "Size of the shared miscellaneous data area (in bytes)") \ \ product(uintx, SharedMiscCodeSize, 120*K, \ - "Size of the shared code area adjacent to the heap (in bytes)") \ + "Size of the shared miscellaneous code area (in bytes)") \ \ product(uintx, SharedDummyBlockSize, 0, \ "Size of dummy block used to shift heap addresses (in bytes)") \