src/share/vm/prims/jvmtiRedefineClasses.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8067713 Cdiff src/share/vm/prims/jvmtiRedefineClasses.cpp

src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page

        

*** 146,164 **** // because CMS might think this is still live. cld->add_to_deallocate_list((InstanceKlass*)_scratch_classes[i]); _scratch_classes[i] = NULL; } // Disable any dependent concurrent compilations SystemDictionary::notice_modification(); // Set flag indicating that some invariants are no longer true. // See jvmtiExport.hpp for detailed explanation. JvmtiExport::set_has_redefined_a_class(); ! // check_class() is optionally called for product bits, but is ! // always called for non-product bits. #ifdef PRODUCT if (RC_TRACE_ENABLED(0x00004000)) { #endif RC_TRACE_WITH_THREAD(0x00004000, thread, ("calling check_class")); CheckClass check_class(thread); --- 146,168 ---- // because CMS might think this is still live. cld->add_to_deallocate_list((InstanceKlass*)_scratch_classes[i]); _scratch_classes[i] = NULL; } + // Clean out MethodData pointing to old Method* + MethodDataCleaner clean_weak_method_links; + ClassLoaderDataGraph::classes_do(&clean_weak_method_links); + // Disable any dependent concurrent compilations SystemDictionary::notice_modification(); // Set flag indicating that some invariants are no longer true. // See jvmtiExport.hpp for detailed explanation. JvmtiExport::set_has_redefined_a_class(); ! // check_class() is optionally called for product bits, but is ! // always called for non-product bits. #ifdef PRODUCT if (RC_TRACE_ENABLED(0x00004000)) { #endif RC_TRACE_WITH_THREAD(0x00004000, thread, ("calling check_class")); CheckClass check_class(thread);
*** 3443,3452 **** --- 3447,3472 ---- } } } } + // Clean method data for this class + void VM_RedefineClasses::MethodDataCleaner::do_klass(Klass* k) { + if (k->oop_is_instance()) { + InstanceKlass *ik = InstanceKlass::cast(k); + // Clean MethodData of this class's methods so they don't refer to + // old methods that are no longer running. + Array<Method*>* methods = ik->methods(); + int num_methods = methods->length(); + for (int index2 = 0; index2 < num_methods; ++index2) { + if (methods->at(index2)->method_data() != NULL) { + methods->at(index2)->method_data()->clean_weak_method_links(); + } + } + } + } + void VM_RedefineClasses::update_jmethod_ids() { for (int j = 0; j < _matching_methods_length; ++j) { Method* old_method = _matching_old_methods[j]; jmethodID jmid = old_method->find_jmethod_id_or_null(); if (jmid != NULL) {
src/share/vm/prims/jvmtiRedefineClasses.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File