diff --git a/src/hotspot/share/classfile/placeholders.cpp b/src/hotspot/share/classfile/placeholders.cpp index 88b8d0fcc20..18707c04b46 100644 --- a/src/hotspot/share/classfile/placeholders.cpp +++ b/src/hotspot/share/classfile/placeholders.cpp @@ -326,7 +326,12 @@ void PlaceholderTable::find_and_remove(unsigned int hash, PlaceholderEntry *probe = get_entry(hash, name, loader_data); if (probe != NULL) { log(probe, "find_and_remove", action); - probe->remove_seen_thread(thread, action); + + bool empty = probe->remove_seen_thread(thread, action); + if (empty && action == LOAD_SUPER) { + probe->set_supername(NULL); + } + // If no other threads using this entry, and this thread is not using this entry for other states if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL) && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) { diff --git a/src/hotspot/share/classfile/placeholders.hpp b/src/hotspot/share/classfile/placeholders.hpp index d85ac9adfdc..0474632e690 100644 --- a/src/hotspot/share/classfile/placeholders.hpp +++ b/src/hotspot/share/classfile/placeholders.hpp @@ -142,8 +142,12 @@ class PlaceholderEntry : public HashtableEntry { Symbol* supername() const { return _supername; } void set_supername(Symbol* supername) { - _supername = supername; - if (_supername != NULL) _supername->increment_refcount(); + if (supername != _supername) { + _supername = supername; + if (_supername != NULL) { + _supername->increment_refcount(); + } + } } Thread* definer() const {return _definer; }