< prev index next >

src/share/vm/oops/klass.cpp

Print this page




 673     if (ko != NULL) {
 674       guarantee(ko->is_klass(), "should be klass");
 675     }
 676   }
 677 
 678   if (java_mirror() != NULL) {
 679     guarantee(java_mirror()->is_oop(), "should be instance");
 680   }
 681 }
 682 
 683 void Klass::oop_verify_on(oop obj, outputStream* st) {
 684   guarantee(obj->is_oop(),  "should be oop");
 685   guarantee(obj->klass()->is_klass(), "klass field is not a klass");
 686 }
 687 
 688 #ifndef PRODUCT
 689 
 690 bool Klass::verify_vtable_index(int i) {
 691   if (oop_is_instance()) {
 692     int limit = ((InstanceKlass*)this)->vtable_length()/vtableEntry::size();
 693     assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit));
 694   } else {
 695     assert(oop_is_array(), "Must be");
 696     int limit = ((ArrayKlass*)this)->vtable_length()/vtableEntry::size();
 697     assert(i >= 0 && i < limit, err_msg("index %d out of bounds %d", i, limit));
 698   }
 699   return true;
 700 }
 701 
 702 bool Klass::verify_itable_index(int i) {
 703   assert(oop_is_instance(), "");
 704   int method_count = klassItable::method_count_for_interface(this);
 705   assert(i >= 0 && i < method_count, "index out of bounds");
 706   return true;
 707 }
 708 
 709 #endif
 710 
 711 /////////////// Unit tests ///////////////
 712 
 713 #ifndef PRODUCT
 714 
 715 class TestKlass {
 716  public:
 717   static void test_oop_is_instanceClassLoader() {


 673     if (ko != NULL) {
 674       guarantee(ko->is_klass(), "should be klass");
 675     }
 676   }
 677 
 678   if (java_mirror() != NULL) {
 679     guarantee(java_mirror()->is_oop(), "should be instance");
 680   }
 681 }
 682 
 683 void Klass::oop_verify_on(oop obj, outputStream* st) {
 684   guarantee(obj->is_oop(),  "should be oop");
 685   guarantee(obj->klass()->is_klass(), "klass field is not a klass");
 686 }
 687 
 688 #ifndef PRODUCT
 689 
 690 bool Klass::verify_vtable_index(int i) {
 691   if (oop_is_instance()) {
 692     int limit = ((InstanceKlass*)this)->vtable_length()/vtableEntry::size();
 693     assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
 694   } else {
 695     assert(oop_is_array(), "Must be");
 696     int limit = ((ArrayKlass*)this)->vtable_length()/vtableEntry::size();
 697     assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
 698   }
 699   return true;
 700 }
 701 
 702 bool Klass::verify_itable_index(int i) {
 703   assert(oop_is_instance(), "");
 704   int method_count = klassItable::method_count_for_interface(this);
 705   assert(i >= 0 && i < method_count, "index out of bounds");
 706   return true;
 707 }
 708 
 709 #endif
 710 
 711 /////////////// Unit tests ///////////////
 712 
 713 #ifndef PRODUCT
 714 
 715 class TestKlass {
 716  public:
 717   static void test_oop_is_instanceClassLoader() {
< prev index next >