696 // in the CLD graph but not in production. 697 assert(Metaspace::contains((address)this), "Should be"); 698 699 guarantee(this->is_klass(),"should be klass"); 700 701 if (super() != NULL) { 702 guarantee(super()->is_klass(), "should be klass"); 703 } 704 if (secondary_super_cache() != NULL) { 705 Klass* ko = secondary_super_cache(); 706 guarantee(ko->is_klass(), "should be klass"); 707 } 708 for ( uint i = 0; i < primary_super_limit(); i++ ) { 709 Klass* ko = _primary_supers[i]; 710 if (ko != NULL) { 711 guarantee(ko->is_klass(), "should be klass"); 712 } 713 } 714 715 if (java_mirror() != NULL) { 716 guarantee(java_mirror()->is_oop(), "should be instance"); 717 } 718 } 719 720 void Klass::oop_verify_on(oop obj, outputStream* st) { 721 guarantee(obj->is_oop(), "should be oop"); 722 guarantee(obj->klass()->is_klass(), "klass field is not a klass"); 723 } 724 725 klassVtable Klass::vtable() const { 726 return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size()); 727 } 728 729 vtableEntry* Klass::start_of_vtable() const { 730 return (vtableEntry*) ((address)this + in_bytes(vtable_start_offset())); 731 } 732 733 Method* Klass::method_at_vtable(int index) { 734 #ifndef PRODUCT 735 assert(index >= 0, "valid vtable index"); 736 if (DebugVtables) { 737 verify_vtable_index(index); 738 } 739 #endif 740 return start_of_vtable()[index].method(); 741 } | 696 // in the CLD graph but not in production. 697 assert(Metaspace::contains((address)this), "Should be"); 698 699 guarantee(this->is_klass(),"should be klass"); 700 701 if (super() != NULL) { 702 guarantee(super()->is_klass(), "should be klass"); 703 } 704 if (secondary_super_cache() != NULL) { 705 Klass* ko = secondary_super_cache(); 706 guarantee(ko->is_klass(), "should be klass"); 707 } 708 for ( uint i = 0; i < primary_super_limit(); i++ ) { 709 Klass* ko = _primary_supers[i]; 710 if (ko != NULL) { 711 guarantee(ko->is_klass(), "should be klass"); 712 } 713 } 714 715 if (java_mirror() != NULL) { 716 guarantee(oopDesc::is_oop(java_mirror()), "should be instance"); 717 } 718 } 719 720 void Klass::oop_verify_on(oop obj, outputStream* st) { 721 guarantee(oopDesc::is_oop(obj), "should be oop"); 722 guarantee(obj->klass()->is_klass(), "klass field is not a klass"); 723 } 724 725 klassVtable Klass::vtable() const { 726 return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size()); 727 } 728 729 vtableEntry* Klass::start_of_vtable() const { 730 return (vtableEntry*) ((address)this + in_bytes(vtable_start_offset())); 731 } 732 733 Method* Klass::method_at_vtable(int index) { 734 #ifndef PRODUCT 735 assert(index >= 0, "valid vtable index"); 736 if (DebugVtables) { 737 verify_vtable_index(index); 738 } 739 #endif 740 return start_of_vtable()[index].method(); 741 } |