src/share/vm/prims/jvmtiRedefineClasses.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri Aug 22 10:18:44 2014
--- new/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri Aug 22 10:18:42 2014
*** 2824,2838 ****
--- 2824,2837 ----
&trace_name_printed);
}
}
// the previous versions' constant pool caches may need adjustment
! PreviousVersionWalker pvw(_thread, ik);
! for (PreviousVersionNode * pv_node = pvw.next_previous_version();
! pv_node != NULL; pv_node = pvw.next_previous_version()) {
! other_cp = pv_node->prev_constant_pool();
cp_cache = other_cp->cache();
! for (InstanceKlass* pv_node = ik->previous_versions();
! pv_node != NULL;
! pv_node = pv_node->previous_versions()) {
! cp_cache = pv_node->constants()->cache();
if (cp_cache != NULL) {
cp_cache->adjust_method_entries(_matching_old_methods,
_matching_new_methods,
_matching_methods_length,
&trace_name_printed);
*** 2853,2865 ****
--- 2852,2863 ----
"should be replaced");
}
}
}
void VM_RedefineClasses::check_methods_and_mark_as_obsolete(
BitMap *emcp_methods, int * emcp_method_count_p) {
*emcp_method_count_p = 0;
+ int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
+ int emcp_method_count = 0;
int obsolete_count = 0;
int old_index = 0;
for (int j = 0; j < _matching_methods_length; ++j, ++old_index) {
Method* old_method = _matching_old_methods[j];
Method* new_method = _matching_new_methods[j];
*** 2929,2941 ****
--- 2927,2939 ----
//
// It looks like we will have to live with the limited savings
// that we get from effectively overwriting the old methods
// when the new methods are attached to the_class.
// track which methods are EMCP for add_previous_version() call
emcp_methods->set_bit(old_index);
! (*emcp_method_count_p)++;
+ // Count number of methods that are EMCP. The method will be marked
+ // old but not obsolete if it is EMCP.
// An EMCP method is _not_ obsolete. An obsolete method has a
// different jmethodID than the current method. An EMCP method
// has the same jmethodID as the current method. Having the
// same jmethodID for all EMCP versions of a method allows for
*** 2980,2993 ****
--- 2978,2992 ----
// EMCP methods.
RC_TRACE(0x00000100, ("mark deleted %s(%s) as obsolete",
old_method->name()->as_C_string(),
old_method->signature()->as_C_string()));
}
! assert((*emcp_method_count_p + obsolete_count) == _old_methods->length(),
"sanity check");
! RC_TRACE(0x00000100, ("EMCP_cnt=%d, obsolete_cnt=%d", *emcp_method_count_p,
obsolete_count));
+ return emcp_method_count;
}
// This internal class transfers the native function registration from old methods
// to new methods. It is designed to handle both the simple case of unchanged
// native methods and the complex cases of native method prefixes being added and/or
*** 3377,3391 ****
--- 3376,3387 ----
// vtable's class and "the new class".
old_constants->set_pool_holder(scratch_class());
#endif
! // track which methods are EMCP for add_previous_version() call below
! BitMap emcp_methods(_old_methods->length());
int emcp_method_count = 0;
emcp_methods.clear(); // clears 0..(length() - 1)
check_methods_and_mark_as_obsolete(&emcp_methods, &emcp_method_count);
! // track number of methods are EMCP for add_previous_version() call below
! int emcp_method_count = check_methods_and_mark_as_obsolete();
transfer_old_native_function_registrations(the_class);
// The class file bytes from before any retransformable agents mucked
// with them was cached on the scratch class, move to the_class.
// Note: we still want to do this if nothing needed caching since it
*** 3469,3481 ****
--- 3465,3478 ----
the_class->set_enclosing_method_indices(
scratch_class->enclosing_method_class_index(),
scratch_class->enclosing_method_method_index());
scratch_class->set_enclosing_method_indices(old_class_idx, old_method_idx);
+ the_class->set_has_been_redefined();
+
// keep track of previous versions of this class
! the_class->add_previous_version(scratch_class, &emcp_methods,
emcp_method_count);
! the_class->add_previous_version(scratch_class, emcp_method_count);
RC_TIMER_STOP(_timer_rsc_phase1);
RC_TIMER_START(_timer_rsc_phase2);
// Adjust constantpool caches and vtables for all classes
src/share/vm/prims/jvmtiRedefineClasses.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File