hotspot/src/share/vm/oops/method.cpp
changeset 14579 7f6ce6e3dd80
parent 14488 ab48109f7d1b
child 14587 e9f641f0d3a9
equal deleted inserted replaced
14578:d02f669f4da8 14579:7f6ce6e3dd80
  1810 }
  1810 }
  1811 
  1811 
  1812 // Called when the class loader is unloaded to make all methods weak.
  1812 // Called when the class loader is unloaded to make all methods weak.
  1813 void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
  1813 void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
  1814   loader_data->jmethod_ids()->clear_all_methods();
  1814   loader_data->jmethod_ids()->clear_all_methods();
       
  1815 }
       
  1816 
       
  1817 
       
  1818 // Check that this pointer is valid by checking that the vtbl pointer matches
       
  1819 bool Method::is_valid_method() const {
       
  1820   if (this == NULL) {
       
  1821     return false;
       
  1822   } else if (!is_metaspace_object()) {
       
  1823     return false;
       
  1824   } else {
       
  1825     Method m;
       
  1826     // This assumes that the vtbl pointer is the first word of a C++ object.
       
  1827     // This assumption is also in universe.cpp patch_klass_vtble
       
  1828     void* vtbl2 = dereference_vptr((void*)&m);
       
  1829     void* this_vtbl = dereference_vptr((void*)this);
       
  1830     return vtbl2 == this_vtbl;
       
  1831   }
  1815 }
  1832 }
  1816 
  1833 
  1817 #ifndef PRODUCT
  1834 #ifndef PRODUCT
  1818 void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) {
  1835 void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) {
  1819   out->print_cr("jni_method_id count = %d", loader_data->jmethod_ids()->count_methods());
  1836   out->print_cr("jni_method_id count = %d", loader_data->jmethod_ids()->count_methods());
  1933   guarantee(constants()->is_metadata(), "should be metadata");
  1950   guarantee(constants()->is_metadata(), "should be metadata");
  1934   guarantee(constMethod()->is_constMethod(), "should be ConstMethod*");
  1951   guarantee(constMethod()->is_constMethod(), "should be ConstMethod*");
  1935   guarantee(constMethod()->is_metadata(), "should be metadata");
  1952   guarantee(constMethod()->is_metadata(), "should be metadata");
  1936   MethodData* md = method_data();
  1953   MethodData* md = method_data();
  1937   guarantee(md == NULL ||
  1954   guarantee(md == NULL ||
  1938       md->is_metadata(), "should be in permspace");
  1955       md->is_metadata(), "should be metadata");
  1939   guarantee(md == NULL ||
  1956   guarantee(md == NULL ||
  1940       md->is_methodData(), "should be method data");
  1957       md->is_methodData(), "should be method data");
  1941 }
  1958 }