711 ByteSize Klass::vtable_start_offset() {
712 return in_ByteSize(InstanceKlass::header_size() * wordSize);
713 }
714
715 #ifndef PRODUCT
716
717 bool Klass::verify_vtable_index(int i) {
718 int limit = vtable_length()/vtableEntry::size();
719 assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
720 return true;
721 }
722
723 bool Klass::verify_itable_index(int i) {
724 assert(is_instance_klass(), "");
725 int method_count = klassItable::method_count_for_interface(this);
726 assert(i >= 0 && i < method_count, "index out of bounds");
727 return true;
728 }
729
730 #endif
731
732 /////////////// Unit tests ///////////////
733
734 #ifndef PRODUCT
735
736 class TestKlass {
737 public:
738 static void test_oop_is_instanceClassLoader() {
739 Klass* klass = SystemDictionary::ClassLoader_klass();
740 guarantee(klass->is_instance_klass(), "assert");
741 guarantee(InstanceKlass::cast(klass)->is_class_loader_instance_klass(), "test failed");
742
743 klass = SystemDictionary::String_klass();
744 guarantee(!klass->is_instance_klass() ||
745 !InstanceKlass::cast(klass)->is_class_loader_instance_klass(),
746 "test failed");
747 }
748 };
749
750 void TestKlass_test() {
751 TestKlass::test_oop_is_instanceClassLoader();
752 }
753
754 #endif // PRODUCT
|
711 ByteSize Klass::vtable_start_offset() {
712 return in_ByteSize(InstanceKlass::header_size() * wordSize);
713 }
714
715 #ifndef PRODUCT
716
717 bool Klass::verify_vtable_index(int i) {
718 int limit = vtable_length()/vtableEntry::size();
719 assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
720 return true;
721 }
722
723 bool Klass::verify_itable_index(int i) {
724 assert(is_instance_klass(), "");
725 int method_count = klassItable::method_count_for_interface(this);
726 assert(i >= 0 && i < method_count, "index out of bounds");
727 return true;
728 }
729
730 #endif
|