comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 12281:4f9a42c33738

8022887: Assertion hit while using class and redefining it with RedefineClasses simultaneously Summary: Need to refetch each method from InstanceKlass after all safepoints. Removed leaky PreviousVersionInfo code. Reviewed-by: dcubed, sspitsyn
author coleenp
date Fri, 20 Sep 2013 09:30:02 -0400
parents 0d3ff4d36a31
children 0f37d1badced
comparison
equal deleted inserted replaced
12279:6eb908998b32 12281:4f9a42c33738
2805 _matching_new_methods, 2805 _matching_new_methods,
2806 _matching_methods_length, 2806 _matching_methods_length,
2807 &trace_name_printed); 2807 &trace_name_printed);
2808 } 2808 }
2809 } 2809 }
2810 { 2810
2811 ResourceMark rm(_thread); 2811 // the previous versions' constant pool caches may need adjustment
2812 // PreviousVersionInfo objects returned via PreviousVersionWalker 2812 PreviousVersionWalker pvw(_thread, ik);
2813 // contain a GrowableArray of handles. We have to clean up the 2813 for (PreviousVersionNode * pv_node = pvw.next_previous_version();
2814 // GrowableArray _after_ the PreviousVersionWalker destructor 2814 pv_node != NULL; pv_node = pvw.next_previous_version()) {
2815 // has destroyed the handles. 2815 other_cp = pv_node->prev_constant_pool();
2816 { 2816 cp_cache = other_cp->cache();
2817 // the previous versions' constant pool caches may need adjustment 2817 if (cp_cache != NULL) {
2818 PreviousVersionWalker pvw(ik); 2818 cp_cache->adjust_method_entries(_matching_old_methods,
2819 for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); 2819 _matching_new_methods,
2820 pv_info != NULL; pv_info = pvw.next_previous_version()) { 2820 _matching_methods_length,
2821 other_cp = pv_info->prev_constant_pool_handle(); 2821 &trace_name_printed);
2822 cp_cache = other_cp->cache(); 2822 }
2823 if (cp_cache != NULL) { 2823 }
2824 cp_cache->adjust_method_entries(_matching_old_methods,
2825 _matching_new_methods,
2826 _matching_methods_length,
2827 &trace_name_printed);
2828 }
2829 }
2830 } // pvw is cleaned up
2831 } // rm is cleaned up
2832 } 2824 }
2833 } 2825 }
2834 2826
2835 void VM_RedefineClasses::update_jmethod_ids() { 2827 void VM_RedefineClasses::update_jmethod_ids() {
2836 for (int j = 0; j < _matching_methods_length; ++j) { 2828 for (int j = 0; j < _matching_methods_length; ++j) {
2940 obsolete_count++; 2932 obsolete_count++;
2941 2933
2942 // obsolete methods need a unique idnum 2934 // obsolete methods need a unique idnum
2943 u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum(); 2935 u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
2944 if (num != ConstMethod::UNSET_IDNUM) { 2936 if (num != ConstMethod::UNSET_IDNUM) {
2945 // u2 old_num = old_method->method_idnum();
2946 old_method->set_method_idnum(num); 2937 old_method->set_method_idnum(num);
2947 // TO DO: attach obsolete annotations to obsolete method's new idnum 2938 }
2948 } 2939
2949 // With tracing we try not to "yack" too much. The position of 2940 // With tracing we try not to "yack" too much. The position of
2950 // this trace assumes there are fewer obsolete methods than 2941 // this trace assumes there are fewer obsolete methods than
2951 // EMCP methods. 2942 // EMCP methods.
2952 RC_TRACE(0x00000100, ("mark %s(%s) as obsolete", 2943 RC_TRACE(0x00000100, ("mark %s(%s) as obsolete",
2953 old_method->name()->as_C_string(), 2944 old_method->name()->as_C_string(),