mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8249822: SymbolPropertyTable creates an extra OopHandle per entry
Add an assert to OopHandle assigment operator to catch leaking OopHandles, and fix code accordingly. Reviewed-by: sspitsyn, eosterlund, dholmes
This commit is contained in:
parent
8b005fa74e
commit
c63911b33b
8 changed files with 77 additions and 52 deletions
|
@ -53,7 +53,7 @@
|
|||
|
||||
void Klass::set_java_mirror(Handle m) {
|
||||
assert(!m.is_null(), "New mirror should never be null.");
|
||||
assert(_java_mirror.resolve() == NULL, "should only be used to initialize mirror");
|
||||
assert(_java_mirror.is_empty(), "should only be used to initialize mirror");
|
||||
_java_mirror = class_loader_data()->add_handle(m);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,10 @@ oop Klass::java_mirror_no_keepalive() const {
|
|||
return _java_mirror.peek();
|
||||
}
|
||||
|
||||
void Klass::replace_java_mirror(oop mirror) {
|
||||
_java_mirror.replace(mirror);
|
||||
}
|
||||
|
||||
bool Klass::is_cloneable() const {
|
||||
return _access_flags.is_cloneable_fast() ||
|
||||
is_subtype_of(SystemDictionary::Cloneable_klass());
|
||||
|
@ -195,10 +199,7 @@ void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word
|
|||
// which zeros out memory - calloc equivalent.
|
||||
// The constructor is also used from CppVtableCloner,
|
||||
// which doesn't zero out the memory before calling the constructor.
|
||||
// Need to set the _java_mirror field explicitly to not hit an assert that the field
|
||||
// should be NULL before setting it.
|
||||
Klass::Klass(KlassID id) : _id(id),
|
||||
_java_mirror(NULL),
|
||||
_prototype_header(markWord::prototype()),
|
||||
_shared_class_path_index(-1) {
|
||||
CDS_ONLY(_shared_class_flags = 0;)
|
||||
|
@ -555,7 +556,7 @@ void Klass::remove_java_mirror() {
|
|||
log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
|
||||
}
|
||||
// Just null out the mirror. The class_loader_data() no longer exists.
|
||||
_java_mirror = OopHandle();
|
||||
clear_java_mirror_handle();
|
||||
}
|
||||
|
||||
void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
|
||||
|
@ -609,7 +610,7 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec
|
|||
|
||||
// No archived mirror data
|
||||
log_debug(cds, mirror)("No archived mirror data for %s", external_name());
|
||||
_java_mirror = OopHandle();
|
||||
clear_java_mirror_handle();
|
||||
this->clear_has_raw_archived_mirror();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue