< prev index next >
src/share/vm/oops/method.cpp
Print this page
*** 109,118 ****
--- 109,119 ----
}
// Release Method*. The nmethod will be gone when we get here because
// we've walked the code cache.
void Method::deallocate_contents(ClassLoaderData* loader_data) {
+ clear_jmethod_id(loader_data);
MetadataFactory::free_metadata(loader_data, constMethod());
set_constMethod(NULL);
MetadataFactory::free_metadata(loader_data, method_data());
set_method_data(NULL);
MetadataFactory::free_metadata(loader_data, method_counters());
*** 1798,1807 ****
--- 1799,1819 ----
#ifdef ASSERT
assert(contains(m), "should be a methodID");
#endif // ASSERT
*m = _free_method;
}
+ void clear_method(Method* m) {
+ for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
+ for (int i = 0; i < number_of_methods; i++) {
+ if (b->_methods[i] == m) {
+ b->_methods[i] = NULL;
+ return;
+ }
+ }
+ }
+ // not found
+ }
// During class unloading the methods are cleared, which is different
// than freed.
void clear_all_methods() {
for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
*** 1870,1880 ****
*((Method**)jmid) = new_method;
}
bool Method::is_method_id(jmethodID mid) {
Method* m = resolve_jmethod_id(mid);
! assert(m != NULL, "should be called with non-null method");
InstanceKlass* ik = m->method_holder();
if (ik == NULL) {
return false;
}
ClassLoaderData* cld = ik->class_loader_data();
--- 1882,1894 ----
*((Method**)jmid) = new_method;
}
bool Method::is_method_id(jmethodID mid) {
Method* m = resolve_jmethod_id(mid);
! if (m == NULL) {
! return false;
! }
InstanceKlass* ik = m->method_holder();
if (ik == NULL) {
return false;
}
ClassLoaderData* cld = ik->class_loader_data();
*** 1903,1912 ****
--- 1917,1930 ----
if (value && succeeded) {
MetadataOnStackMark::record(this, Thread::current());
}
}
+ void Method::clear_jmethod_id(ClassLoaderData* loader_data) {
+ loader_data->jmethod_ids()->clear_method(this);
+ }
+
// Called when the class loader is unloaded to make all methods weak.
void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
loader_data->jmethod_ids()->clear_all_methods();
}
< prev index next >