mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8005076: Creating a CDS archive with one alignment and running another causes a crash
Save the alignment when writing the CDS and compare it when reading the CDS. Reviewed-by: kvn, coleenp
This commit is contained in:
parent
89e575df23
commit
cfea76669a
4 changed files with 19 additions and 16 deletions
|
@ -119,6 +119,7 @@ void FileMapInfo::populate_header(size_t alignment) {
|
|||
_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 @@ bool FileMapInfo::validate() {
|
|||
" 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue