mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8232112: MDO extra_data_lock leaks during class unloading
Call the MDO destructor during class unloading. Reviewed-by: dholmes, eosterlund
This commit is contained in:
parent
d8c6516c92
commit
86fdbc0f85
4 changed files with 21 additions and 6 deletions
|
@ -2497,10 +2497,18 @@ void InstanceKlass::unload_class(InstanceKlass* ik) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void method_release_C_heap_structures(Method* m) {
|
||||
m->release_C_heap_structures();
|
||||
}
|
||||
|
||||
void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) {
|
||||
// Clean up C heap
|
||||
ik->release_C_heap_structures();
|
||||
ik->constants()->release_C_heap_structures();
|
||||
|
||||
// Deallocate and call destructors for MDO mutexes
|
||||
ik->methods_do(method_release_C_heap_structures);
|
||||
|
||||
}
|
||||
|
||||
void InstanceKlass::release_C_heap_structures() {
|
||||
|
|
|
@ -118,11 +118,6 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
|
|||
void Method::deallocate_contents(ClassLoaderData* loader_data) {
|
||||
MetadataFactory::free_metadata(loader_data, constMethod());
|
||||
set_constMethod(NULL);
|
||||
#if INCLUDE_JVMCI
|
||||
if (method_data()) {
|
||||
FailedSpeculation::free_failed_speculations(method_data()->get_failed_speculations_address());
|
||||
}
|
||||
#endif
|
||||
MetadataFactory::free_metadata(loader_data, method_data());
|
||||
set_method_data(NULL);
|
||||
MetadataFactory::free_metadata(loader_data, method_counters());
|
||||
|
@ -131,6 +126,16 @@ void Method::deallocate_contents(ClassLoaderData* loader_data) {
|
|||
if (code() != NULL) _code = NULL;
|
||||
}
|
||||
|
||||
void Method::release_C_heap_structures() {
|
||||
if (method_data()) {
|
||||
#if INCLUDE_JVMCI
|
||||
FailedSpeculation::free_failed_speculations(method_data()->get_failed_speculations_address());
|
||||
#endif
|
||||
// Destroy MethodData
|
||||
method_data()->~MethodData();
|
||||
}
|
||||
}
|
||||
|
||||
address Method::get_i2c_entry() {
|
||||
assert(adapter() != NULL, "must have");
|
||||
return adapter()->get_i2c_entry();
|
||||
|
|
|
@ -1006,6 +1006,8 @@ public:
|
|||
// Deallocation function for redefine classes or if an error occurs
|
||||
void deallocate_contents(ClassLoaderData* loader_data);
|
||||
|
||||
void release_C_heap_structures();
|
||||
|
||||
Method* get_new_method() const {
|
||||
InstanceKlass* holder = method_holder();
|
||||
Method* new_method = holder->method_with_idnum(orig_method_idnum());
|
||||
|
|
|
@ -2445,7 +2445,7 @@ public:
|
|||
virtual void metaspace_pointers_do(MetaspaceClosure* iter);
|
||||
virtual MetaspaceObj::Type type() const { return MethodDataType; }
|
||||
|
||||
// Deallocation support - no pointer fields to deallocate
|
||||
// Deallocation support - no metaspace pointer fields to deallocate
|
||||
void deallocate_contents(ClassLoaderData* loader_data) {}
|
||||
|
||||
// GC support
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue