3066 if (methods()) {
3067 for (int i = 0; i < methods_array->length(); i++) {
3068 Method* method = methods_array->at(i);
3069 if (method) {
3070 sz->_method_count ++;
3071 method->collect_statistics(sz);
3072 }
3073 }
3074 }
3075 }
3076 #endif // INCLUDE_SERVICES
3077
3078 // Verification
3079
3080 class VerifyFieldClosure: public OopClosure {
3081 protected:
3082 template <class T> void do_oop_work(T* p) {
3083 oop obj = oopDesc::load_decode_heap_oop(p);
3084 if (!obj->is_oop_or_null()) {
3085 tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
3086 Universe::print();
3087 guarantee(false, "boom");
3088 }
3089 }
3090 public:
3091 virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); }
3092 virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
3093 };
3094
3095 void InstanceKlass::verify_on(outputStream* st) {
3096 #ifndef PRODUCT
3097 // Avoid redundant verifies, this really should be in product.
3098 if (_verify_count == Universe::verify_count()) return;
3099 _verify_count = Universe::verify_count();
3100 #endif
3101
3102 // Verify Klass
3103 Klass::verify_on(st);
3104
3105 // Verify that klass is present in ClassLoaderData
3106 guarantee(class_loader_data()->contains_klass(this),
|
3066 if (methods()) {
3067 for (int i = 0; i < methods_array->length(); i++) {
3068 Method* method = methods_array->at(i);
3069 if (method) {
3070 sz->_method_count ++;
3071 method->collect_statistics(sz);
3072 }
3073 }
3074 }
3075 }
3076 #endif // INCLUDE_SERVICES
3077
3078 // Verification
3079
3080 class VerifyFieldClosure: public OopClosure {
3081 protected:
3082 template <class T> void do_oop_work(T* p) {
3083 oop obj = oopDesc::load_decode_heap_oop(p);
3084 if (!obj->is_oop_or_null()) {
3085 tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
3086 Universe::print_on(tty);
3087 guarantee(false, "boom");
3088 }
3089 }
3090 public:
3091 virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); }
3092 virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
3093 };
3094
3095 void InstanceKlass::verify_on(outputStream* st) {
3096 #ifndef PRODUCT
3097 // Avoid redundant verifies, this really should be in product.
3098 if (_verify_count == Universe::verify_count()) return;
3099 _verify_count = Universe::verify_count();
3100 #endif
3101
3102 // Verify Klass
3103 Klass::verify_on(st);
3104
3105 // Verify that klass is present in ClassLoaderData
3106 guarantee(class_loader_data()->contains_klass(this),
|