2173 return dereference_vptr(&m) == dereference_vptr(ptr); 2174 } 2175 2176 // Check that this pointer is valid by checking that the vtbl pointer matches 2177 bool Method::is_valid_method() const { 2178 if (this == NULL) { 2179 return false; 2180 } else if ((intptr_t(this) & (wordSize-1)) != 0) { 2181 // Quick sanity check on pointer. 2182 return false; 2183 } else if (is_shared()) { 2184 return MetaspaceShared::is_valid_shared_method(this); 2185 } else if (Metaspace::contains_non_shared(this)) { 2186 return has_method_vptr((const void*)this); 2187 } else { 2188 return false; 2189 } 2190 } 2191 2192 #ifndef PRODUCT 2193 void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) { 2194 out->print_cr("jni_method_id count = %d", loader_data->jmethod_ids()->count_methods()); 2195 } 2196 #endif // PRODUCT 2197 2198 2199 // Printing 2200 2201 #ifndef PRODUCT 2202 2203 void Method::print_on(outputStream* st) const { 2204 ResourceMark rm; 2205 assert(is_method(), "must be method"); 2206 st->print_cr("%s", internal_name()); 2207 st->print_cr(" - this oop: " INTPTR_FORMAT, p2i(this)); 2208 st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr(); 2209 st->print (" - constants: " INTPTR_FORMAT " ", p2i(constants())); 2210 constants()->print_value_on(st); st->cr(); 2211 st->print (" - access: 0x%x ", access_flags().as_int()); access_flags().print_on(st); st->cr(); 2212 st->print (" - name: "); name()->print_value_on(st); st->cr(); 2213 st->print (" - signature: "); signature()->print_value_on(st); st->cr(); 2214 st->print_cr(" - max stack: %d", max_stack()); | 2173 return dereference_vptr(&m) == dereference_vptr(ptr); 2174 } 2175 2176 // Check that this pointer is valid by checking that the vtbl pointer matches 2177 bool Method::is_valid_method() const { 2178 if (this == NULL) { 2179 return false; 2180 } else if ((intptr_t(this) & (wordSize-1)) != 0) { 2181 // Quick sanity check on pointer. 2182 return false; 2183 } else if (is_shared()) { 2184 return MetaspaceShared::is_valid_shared_method(this); 2185 } else if (Metaspace::contains_non_shared(this)) { 2186 return has_method_vptr((const void*)this); 2187 } else { 2188 return false; 2189 } 2190 } 2191 2192 #ifndef PRODUCT 2193 void Method::print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) { 2194 out->print(" jni_method_id count = %d", loader_data->jmethod_ids()->count_methods()); 2195 } 2196 #endif // PRODUCT 2197 2198 2199 // Printing 2200 2201 #ifndef PRODUCT 2202 2203 void Method::print_on(outputStream* st) const { 2204 ResourceMark rm; 2205 assert(is_method(), "must be method"); 2206 st->print_cr("%s", internal_name()); 2207 st->print_cr(" - this oop: " INTPTR_FORMAT, p2i(this)); 2208 st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr(); 2209 st->print (" - constants: " INTPTR_FORMAT " ", p2i(constants())); 2210 constants()->print_value_on(st); st->cr(); 2211 st->print (" - access: 0x%x ", access_flags().as_int()); access_flags().print_on(st); st->cr(); 2212 st->print (" - name: "); name()->print_value_on(st); st->cr(); 2213 st->print (" - signature: "); signature()->print_value_on(st); st->cr(); 2214 st->print_cr(" - max stack: %d", max_stack()); |