< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page

        

*** 2415,2425 **** static void clear_all_breakpoints(Method* m) { m->clear_all_breakpoints(); } #endif ! void InstanceKlass::notify_unload_class(InstanceKlass* ik) { // notify the debugger if (JvmtiExport::should_post_class_unload()) { JvmtiExport::post_class_unload(ik); } --- 2415,2428 ---- static void clear_all_breakpoints(Method* m) { m->clear_all_breakpoints(); } #endif ! void InstanceKlass::unload_class(InstanceKlass* ik) { ! // Release dependencies. ! ik->dependencies().remove_all_dependents(); ! // notify the debugger if (JvmtiExport::should_post_class_unload()) { JvmtiExport::post_class_unload(ik); }
*** 2460,2479 **** if (jmeths != (jmethodID*)NULL) { release_set_methods_jmethod_ids(NULL); FreeHeap(jmeths); } ! // Release dependencies. ! // It is desirable to use DC::remove_all_dependents() here, but, unfortunately, ! // it is not safe (see JDK-8143408). The problem is that the klass dependency ! // context can contain live dependencies, since there's a race between nmethod & ! // klass unloading. If the klass is dead when nmethod unloading happens, relevant ! // dependencies aren't removed from the context associated with the class (see ! // nmethod::flush_dependencies). It ends up during klass unloading as seemingly ! // live dependencies pointing to unloaded nmethods and causes a crash in ! // DC::remove_all_dependents() when it touches unloaded nmethod. ! dependencies().wipe(); #if INCLUDE_JVMTI // Deallocate breakpoint records if (breakpoints() != 0x0) { methods_do(clear_all_breakpoints); --- 2463,2474 ---- if (jmeths != (jmethodID*)NULL) { release_set_methods_jmethod_ids(NULL); FreeHeap(jmeths); } ! assert(_dep_context == DependencyContext::EMPTY, ! "dependencies should already be cleaned"); #if INCLUDE_JVMTI // Deallocate breakpoint records if (breakpoints() != 0x0) { methods_do(clear_all_breakpoints);
< prev index next >