1.1 --- a/src/share/vm/oops/method.cpp Thu May 15 09:25:27 2014 -0400 1.2 +++ b/src/share/vm/oops/method.cpp Thu May 15 18:23:26 2014 -0400 1.3 @@ -1873,6 +1873,14 @@ 1.4 loader_data->jmethod_ids()->clear_all_methods(); 1.5 } 1.6 1.7 +bool Method::has_method_vptr(const void* ptr) { 1.8 + Method m; 1.9 + // This assumes that the vtbl pointer is the first word of a C++ object. 1.10 + // This assumption is also in universe.cpp patch_klass_vtble 1.11 + void* vtbl2 = dereference_vptr((const void*)&m); 1.12 + void* this_vtbl = dereference_vptr(ptr); 1.13 + return vtbl2 == this_vtbl; 1.14 +} 1.15 1.16 // Check that this pointer is valid by checking that the vtbl pointer matches 1.17 bool Method::is_valid_method() const { 1.18 @@ -1881,12 +1889,7 @@ 1.19 } else if (!is_metaspace_object()) { 1.20 return false; 1.21 } else { 1.22 - Method m; 1.23 - // This assumes that the vtbl pointer is the first word of a C++ object. 1.24 - // This assumption is also in universe.cpp patch_klass_vtble 1.25 - void* vtbl2 = dereference_vptr((void*)&m); 1.26 - void* this_vtbl = dereference_vptr((void*)this); 1.27 - return vtbl2 == this_vtbl; 1.28 + return has_method_vptr((const void*)this); 1.29 } 1.30 } 1.31