8253079: DeterministicDump.java fails due to garbage in structure padding

Reviewed-by: minqi, jiefu, shade
This commit is contained in:
Ioi Lam 2020-09-22 08:04:26 +00:00
parent a4affd5b04
commit 284bbf02dd
3 changed files with 7 additions and 1 deletions

View File

@ -454,6 +454,7 @@ void ModuleEntry::init_as_archived_entry() {
if (_location != NULL) {
_location = ArchiveBuilder::get_relocated_symbol(_location);
}
JFR_ONLY(set_trace_id(0));// re-init at runtime
ArchivePtrMarker::mark_pointer((address*)&_reads);
ArchivePtrMarker::mark_pointer((address*)&_version);

View File

@ -238,6 +238,7 @@ void PackageEntry::init_as_archived_entry() {
_module = ModuleEntry::get_archived_entry(_module);
_qualified_exports = (GrowableArray<ModuleEntry*>*)archived_qualified_exports;
_defined_by_cds_in_class_path = 0;
JFR_ONLY(set_trace_id(0)); // re-init at runtime
ArchivePtrMarker::mark_pointer((address*)literal_addr());
ArchivePtrMarker::mark_pointer((address*)&_module);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -95,6 +95,10 @@ template <class T, MEMFLAGS F> HashtableEntry<T, F>* Hashtable<T, F>::new_entry(
template <class T, MEMFLAGS F> HashtableEntry<T, F>* Hashtable<T, F>::allocate_new_entry(unsigned int hashValue, T obj) {
HashtableEntry<T, F>* entry = (HashtableEntry<T, F>*) NEW_C_HEAP_ARRAY(char, this->entry_size(), F);
if (DumpSharedSpaces) {
// Avoid random bits in structure padding so we can have deterministic content in CDS archive
memset((void*)entry, 0, this->entry_size());
}
entry->set_hash(hashValue);
entry->set_literal(obj);
entry->set_next(NULL);