Skip to content
Permalink
Browse files
8253079: DeterministicDump.java fails due to garbage in structure pad…
…ding

Reviewed-by: minqi, jiefu, shade
  • Loading branch information
iklam committed Sep 22, 2020
1 parent a4affd5 commit 284bbf02ddba7c13e0f93ddb3967615ebaeeb3dc
Showing 3 changed files with 7 additions and 1 deletion.
@@ -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);
@@ -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);
@@ -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);

1 comment on commit 284bbf0

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 284bbf0 Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.