< prev index next >

src/share/vm/oops/instanceKlass.cpp

Print this page




3190 
3191   const Array<Method*>* methods_array = methods();
3192   if (methods()) {
3193     for (int i = 0; i < methods_array->length(); i++) {
3194       Method* method = methods_array->at(i);
3195       if (method) {
3196         sz->_method_count ++;
3197         method->collect_statistics(sz);
3198       }
3199     }
3200   }
3201 }
3202 #endif // INCLUDE_SERVICES
3203 
3204 // Verification
3205 
3206 class VerifyFieldClosure: public OopClosure {
3207  protected:
3208   template <class T> void do_oop_work(T* p) {
3209     oop obj = oopDesc::load_decode_heap_oop(p);
3210     if (!obj->is_oop_or_null()) {
3211       tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
3212       Universe::print_on(tty);
3213       guarantee(false, "boom");
3214     }
3215   }
3216  public:
3217   virtual void do_oop(oop* p)       { VerifyFieldClosure::do_oop_work(p); }
3218   virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
3219 };
3220 
3221 void InstanceKlass::verify_on(outputStream* st) {
3222 #ifndef PRODUCT
3223   // Avoid redundant verifies, this really should be in product.
3224   if (_verify_count == Universe::verify_count()) return;
3225   _verify_count = Universe::verify_count();
3226 #endif
3227 
3228   // Verify Klass
3229   Klass::verify_on(st);
3230 




3190 
3191   const Array<Method*>* methods_array = methods();
3192   if (methods()) {
3193     for (int i = 0; i < methods_array->length(); i++) {
3194       Method* method = methods_array->at(i);
3195       if (method) {
3196         sz->_method_count ++;
3197         method->collect_statistics(sz);
3198       }
3199     }
3200   }
3201 }
3202 #endif // INCLUDE_SERVICES
3203 
3204 // Verification
3205 
3206 class VerifyFieldClosure: public OopClosure {
3207  protected:
3208   template <class T> void do_oop_work(T* p) {
3209     oop obj = oopDesc::load_decode_heap_oop(p);
3210     if (!oopDesc::is_oop_or_null(obj)) {
3211       tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p2i(p), p2i(obj));
3212       Universe::print_on(tty);
3213       guarantee(false, "boom");
3214     }
3215   }
3216  public:
3217   virtual void do_oop(oop* p)       { VerifyFieldClosure::do_oop_work(p); }
3218   virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
3219 };
3220 
3221 void InstanceKlass::verify_on(outputStream* st) {
3222 #ifndef PRODUCT
3223   // Avoid redundant verifies, this really should be in product.
3224   if (_verify_count == Universe::verify_count()) return;
3225   _verify_count = Universe::verify_count();
3226 #endif
3227 
3228   // Verify Klass
3229   Klass::verify_on(st);
3230 


< prev index next >