Mercurial > hg > truffle
comparison src/share/vm/oops/method.cpp @ 7176:59c790074993
8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
Summary: Make metaspace::contains be lock free and used to see if something is in metaspace, also compare Method* with vtbl pointer.
Reviewed-by: dholmes, sspitsyn, dcubed, jmasa
author | coleenp |
---|---|
date | Wed, 28 Nov 2012 17:50:21 -0500 |
parents | 070d523b96a7 |
children | 5505fbbae3d3 |
comparison
equal
deleted
inserted
replaced
7175:b51dc8df86e5 | 7176:59c790074993 |
---|---|
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 } |