8292318: Memory corruption in remove_dumptime_info

Reviewed-by: coleenp, ccheung
This commit is contained in:
Ioi Lam 2022-08-22 03:43:27 +00:00
parent 9a65524e2f
commit 27b0f7726b
7 changed files with 39 additions and 85 deletions

View file

@ -401,6 +401,11 @@ class ConstantPoolCache: public MetaspaceObj {
// If you add a new field that points to any metaspace object, you
// must add this field to ConstantPoolCache::metaspace_pointers_do().
int _length;
// The narrowOop pointer to the archived resolved_references. Set at CDS dump
// time when caching java heap object is supported.
CDS_JAVA_HEAP_ONLY(int _archived_references_index;) // Gap on LP64
ConstantPool* _constant_pool; // the corresponding constant pool
// The following fields need to be modified at runtime, so they cannot be
@ -413,9 +418,7 @@ class ConstantPoolCache: public MetaspaceObj {
// RedefineClasses support
uint64_t _gc_epoch;
// The narrowOop pointer to the archived resolved_references. Set at CDS dump
// time when caching java heap object is supported.
CDS_JAVA_HEAP_ONLY(int _archived_references_index;)
CDS_ONLY(Array<ConstantPoolCacheEntry>* _initial_entries;)
// Sizing
debug_only(friend class ClassVerifier;)
@ -454,7 +457,7 @@ class ConstantPoolCache: public MetaspaceObj {
// CDS support
void remove_unshareable_info();
void save_for_archive();
void save_for_archive(TRAPS);
private:
void walk_entries_for_initialization(bool check_only);
void set_length(int length) { _length = length; }