< prev index next >
src/share/vm/oops/instanceKlass.cpp
Print this page
*** 3368,3378 ****
// RedefineClasses() support for previous versions:
int InstanceKlass::_previous_version_count = 0;
// Purge previous versions before adding new previous versions of the class.
void InstanceKlass::purge_previous_versions(InstanceKlass* ik) {
- assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
if (ik->previous_versions() != NULL) {
// This klass has previous versions so see what we can cleanup
// while it is safe to do so.
int deleted_count = 0; // leave debugging breadcrumbs
--- 3368,3377 ----
*** 3397,3412 ****
if (!pvcp->on_stack()) {
// If the constant pool isn't on stack, none of the methods
// are executing. Unlink this previous_version.
// The previous version InstanceKlass is on the ClassLoaderData deallocate list
// so will be deallocated during the next phase of class unloading.
! //
! // Update count for class unloading.
! _previous_version_count--;
! log_trace(redefine, class, iklass, purge)
! ("previous version " INTPTR_FORMAT " is dead. previous_version_count = %d",
! p2i(pv_node), _previous_version_count);
// For debugging purposes.
pv_node->set_is_scratch_class();
pv_node->class_loader_data()->add_to_deallocate_list(pv_node);
pv_node = pv_node->previous_versions();
last->link_previous_versions(pv_node);
--- 3396,3406 ----
if (!pvcp->on_stack()) {
// If the constant pool isn't on stack, none of the methods
// are executing. Unlink this previous_version.
// The previous version InstanceKlass is on the ClassLoaderData deallocate list
// so will be deallocated during the next phase of class unloading.
! log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is dead", p2i(pv_node));
// For debugging purposes.
pv_node->set_is_scratch_class();
pv_node->class_loader_data()->add_to_deallocate_list(pv_node);
pv_node = pv_node->previous_versions();
last->link_previous_versions(pv_node);
*** 3517,3527 ****
// also used to clean MethodData links to redefined methods that are no longer running.
void InstanceKlass::add_previous_version(instanceKlassHandle scratch_class,
int emcp_method_count) {
assert(Thread::current()->is_VM_thread(),
"only VMThread can add previous versions");
- assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
ResourceMark rm;
log_trace(redefine, class, iklass, add)
("adding previous version ref for %s, EMCP_cnt=%d", scratch_class->external_name(), emcp_method_count);
--- 3511,3520 ----
*** 3541,3550 ****
--- 3534,3545 ----
if (!cp_ref->on_stack()) {
log_trace(redefine, class, iklass, add)("scratch class not added; no methods are running");
// For debugging purposes.
scratch_class->set_is_scratch_class();
scratch_class->class_loader_data()->add_to_deallocate_list(scratch_class());
+ // Update count for class unloading.
+ _previous_version_count--;
return;
}
if (emcp_method_count != 0) {
// At least one method is still running, check for EMCP methods
*** 3568,3585 ****
}
}
}
// Add previous version if any methods are still running.
! // Update count for class unloading.
! _previous_version_count++;
! log_trace(redefine, class, iklass, add)
! ("scratch class added; one of its methods is on_stack. previous_version_count = %d",
! _previous_version_count);
assert(scratch_class->previous_versions() == NULL, "shouldn't have a previous version");
scratch_class->link_previous_versions(previous_versions());
link_previous_versions(scratch_class());
} // end add_previous_version()
#endif // INCLUDE_JVMTI
Method* InstanceKlass::method_with_idnum(int idnum) {
--- 3563,3578 ----
}
}
}
// Add previous version if any methods are still running.
! log_trace(redefine, class, iklass, add)("scratch class added; one of its methods is on_stack");
assert(scratch_class->previous_versions() == NULL, "shouldn't have a previous version");
scratch_class->link_previous_versions(previous_versions());
link_previous_versions(scratch_class());
+ // Update count for class unloading.
+ _previous_version_count++;
} // end add_previous_version()
#endif // INCLUDE_JVMTI
Method* InstanceKlass::method_with_idnum(int idnum) {
< prev index next >