< prev index next >

src/share/vm/oops/method.cpp

Print this page
rev 6875 : 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
Reviewed-by: mgerdin, coleenp, bdelsart


1846   Method* m = resolve_jmethod_id(mid);
1847   assert(m != NULL, "should be called with non-null method");
1848   InstanceKlass* ik = m->method_holder();
1849   ClassLoaderData* cld = ik->class_loader_data();
1850   if (cld->jmethod_ids() == NULL) return false;
1851   return (cld->jmethod_ids()->contains((Method**)mid));
1852 }
1853 
1854 Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
1855   if (mid == NULL) return NULL;
1856   Method* o = resolve_jmethod_id(mid);
1857   if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
1858     return NULL;
1859   }
1860   return o;
1861 };
1862 
1863 void Method::set_on_stack(const bool value) {
1864   // Set both the method itself and its constant pool.  The constant pool
1865   // on stack means some method referring to it is also on the stack.
1866   _access_flags.set_on_stack(value);
1867   constants()->set_on_stack(value);
1868   if (value) MetadataOnStackMark::record(this);




1869 }
1870 
1871 // Called when the class loader is unloaded to make all methods weak.
1872 void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
1873   loader_data->jmethod_ids()->clear_all_methods();
1874 }
1875 
1876 bool Method::has_method_vptr(const void* ptr) {
1877   Method m;
1878   // This assumes that the vtbl pointer is the first word of a C++ object.
1879   // This assumption is also in universe.cpp patch_klass_vtble
1880   void* vtbl2 = dereference_vptr((const void*)&m);
1881   void* this_vtbl = dereference_vptr(ptr);
1882   return vtbl2 == this_vtbl;
1883 }
1884 
1885 // Check that this pointer is valid by checking that the vtbl pointer matches
1886 bool Method::is_valid_method() const {
1887   if (this == NULL) {
1888     return false;




1846   Method* m = resolve_jmethod_id(mid);
1847   assert(m != NULL, "should be called with non-null method");
1848   InstanceKlass* ik = m->method_holder();
1849   ClassLoaderData* cld = ik->class_loader_data();
1850   if (cld->jmethod_ids() == NULL) return false;
1851   return (cld->jmethod_ids()->contains((Method**)mid));
1852 }
1853 
1854 Method* Method::checked_resolve_jmethod_id(jmethodID mid) {
1855   if (mid == NULL) return NULL;
1856   Method* o = resolve_jmethod_id(mid);
1857   if (o == NULL || o == JNIMethodBlock::_free_method || !((Metadata*)o)->is_method()) {
1858     return NULL;
1859   }
1860   return o;
1861 };
1862 
1863 void Method::set_on_stack(const bool value) {
1864   // Set both the method itself and its constant pool.  The constant pool
1865   // on stack means some method referring to it is also on the stack.

1866   constants()->set_on_stack(value);
1867 
1868   bool succeeded = _access_flags.set_on_stack(value);
1869   if (value && succeeded) {
1870     MetadataOnStackMark::record(this, Thread::current());
1871   }
1872 }
1873 
1874 // Called when the class loader is unloaded to make all methods weak.
1875 void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
1876   loader_data->jmethod_ids()->clear_all_methods();
1877 }
1878 
1879 bool Method::has_method_vptr(const void* ptr) {
1880   Method m;
1881   // This assumes that the vtbl pointer is the first word of a C++ object.
1882   // This assumption is also in universe.cpp patch_klass_vtble
1883   void* vtbl2 = dereference_vptr((const void*)&m);
1884   void* this_vtbl = dereference_vptr(ptr);
1885   return vtbl2 == this_vtbl;
1886 }
1887 
1888 // Check that this pointer is valid by checking that the vtbl pointer matches
1889 bool Method::is_valid_method() const {
1890   if (this == NULL) {
1891     return false;


< prev index next >