22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "classfile/classLoaderData.inline.hpp" |
26 #include "classfile/classLoaderData.inline.hpp" |
|
27 #include "classfile/classLoaderDataGraph.inline.hpp" |
27 #include "classfile/dictionary.hpp" |
28 #include "classfile/dictionary.hpp" |
28 #include "classfile/javaClasses.hpp" |
29 #include "classfile/javaClasses.hpp" |
29 #include "classfile/systemDictionary.hpp" |
30 #include "classfile/systemDictionary.hpp" |
30 #include "classfile/vmSymbols.hpp" |
31 #include "classfile/vmSymbols.hpp" |
31 #include "gc/shared/collectedHeap.inline.hpp" |
32 #include "gc/shared/collectedHeap.inline.hpp" |
736 } |
737 } |
737 |
738 |
738 void Klass::oop_verify_on(oop obj, outputStream* st) { |
739 void Klass::oop_verify_on(oop obj, outputStream* st) { |
739 guarantee(oopDesc::is_oop(obj), "should be oop"); |
740 guarantee(oopDesc::is_oop(obj), "should be oop"); |
740 guarantee(obj->klass()->is_klass(), "klass field is not a klass"); |
741 guarantee(obj->klass()->is_klass(), "klass field is not a klass"); |
|
742 } |
|
743 |
|
744 Klass* Klass::decode_klass_raw(narrowKlass narrow_klass) { |
|
745 return (Klass*)(void*)( (uintptr_t)Universe::narrow_klass_base() + |
|
746 ((uintptr_t)narrow_klass << Universe::narrow_klass_shift())); |
|
747 } |
|
748 |
|
749 bool Klass::is_valid(Klass* k) { |
|
750 if (!is_aligned(k, sizeof(MetaWord))) return false; |
|
751 if ((size_t)k < os::min_page_size()) return false; |
|
752 |
|
753 if (!os::is_readable_range(k, k + 1)) return false; |
|
754 if (!MetaspaceUtils::is_range_in_committed(k, k + 1)) return false; |
|
755 |
|
756 if (!Symbol::is_valid(k->name())) return false; |
|
757 return ClassLoaderDataGraph::is_valid(k->class_loader_data()); |
741 } |
758 } |
742 |
759 |
743 klassVtable Klass::vtable() const { |
760 klassVtable Klass::vtable() const { |
744 return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size()); |
761 return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size()); |
745 } |
762 } |