791 nmethod* osr_nmethods_head() const { return _osr_nmethods_head; };
792 void set_osr_nmethods_head(nmethod* h) { _osr_nmethods_head = h; };
793 void add_osr_nmethod(nmethod* n);
794 void remove_osr_nmethod(nmethod* n);
795 int mark_osr_nmethods(const Method* m);
796 nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
797
798 // Breakpoint support (see methods on Method* for details)
799 BreakpointInfo* breakpoints() const { return _breakpoints; };
800 void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
801
802 // support for stub routines
803 static ByteSize init_state_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
804 TRACE_DEFINE_OFFSET;
805 static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
806
807 // subclass/subinterface checks
808 bool implements_interface(Klass* k) const;
809 bool is_same_or_direct_interface(Klass* k) const;
810
811 // Access to the implementor of an interface.
812 Klass* implementor() const
813 {
814 Klass** k = adr_implementor();
815 if (k == NULL) {
816 return NULL;
817 } else {
818 return *k;
819 }
820 }
821
822 void set_implementor(Klass* k) {
823 assert(is_interface(), "not interface");
824 Klass** addr = adr_implementor();
825 assert(addr != NULL, "null addr");
826 if (addr != NULL) {
827 *addr = k;
828 }
829 }
830
848 // virtual operations from Klass
849 bool is_leaf_class() const { return _subklass == NULL; }
850 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
851 bool compute_is_subtype_of(Klass* k);
852 bool can_be_primary_super_slow() const;
853 int oop_size(oop obj) const { return size_helper(); }
854 bool oop_is_instance_slow() const { return true; }
855
856 // Iterators
857 void do_local_static_fields(FieldClosure* cl);
858 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
859 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
860
861 void methods_do(void f(Method* method));
862 void array_klasses_do(void f(Klass* k));
863 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
864 bool super_types_do(SuperTypeClosure* blk);
865
866 // Casting from Klass*
867 static InstanceKlass* cast(Klass* k) {
868 assert(k->is_klass(), "must be");
869 assert(k->oop_is_instance(), "cast to InstanceKlass");
870 return (InstanceKlass*) k;
871 }
872
873 InstanceKlass* java_super() const {
874 return (super() == NULL) ? NULL : cast(super());
875 }
876
877 // Sizing (in words)
878 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
879
880 static int size(int vtable_length, int itable_length,
881 int nonstatic_oop_map_size,
882 bool is_interface, bool is_anonymous) {
883 return align_object_size(header_size() +
884 align_object_offset(vtable_length) +
885 align_object_offset(itable_length) +
886 ((is_interface || is_anonymous) ?
887 align_object_offset(nonstatic_oop_map_size) :
888 nonstatic_oop_map_size) +
889 (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
|
791 nmethod* osr_nmethods_head() const { return _osr_nmethods_head; };
792 void set_osr_nmethods_head(nmethod* h) { _osr_nmethods_head = h; };
793 void add_osr_nmethod(nmethod* n);
794 void remove_osr_nmethod(nmethod* n);
795 int mark_osr_nmethods(const Method* m);
796 nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
797
798 // Breakpoint support (see methods on Method* for details)
799 BreakpointInfo* breakpoints() const { return _breakpoints; };
800 void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
801
802 // support for stub routines
803 static ByteSize init_state_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
804 TRACE_DEFINE_OFFSET;
805 static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
806
807 // subclass/subinterface checks
808 bool implements_interface(Klass* k) const;
809 bool is_same_or_direct_interface(Klass* k) const;
810
811 #ifdef ASSERT
812 // check whether this class or one of its superclasses was redefined
813 bool has_redefined_this_or_super() const;
814 #endif
815
816 // Access to the implementor of an interface.
817 Klass* implementor() const
818 {
819 Klass** k = adr_implementor();
820 if (k == NULL) {
821 return NULL;
822 } else {
823 return *k;
824 }
825 }
826
827 void set_implementor(Klass* k) {
828 assert(is_interface(), "not interface");
829 Klass** addr = adr_implementor();
830 assert(addr != NULL, "null addr");
831 if (addr != NULL) {
832 *addr = k;
833 }
834 }
835
853 // virtual operations from Klass
854 bool is_leaf_class() const { return _subklass == NULL; }
855 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
856 bool compute_is_subtype_of(Klass* k);
857 bool can_be_primary_super_slow() const;
858 int oop_size(oop obj) const { return size_helper(); }
859 bool oop_is_instance_slow() const { return true; }
860
861 // Iterators
862 void do_local_static_fields(FieldClosure* cl);
863 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
864 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
865
866 void methods_do(void f(Method* method));
867 void array_klasses_do(void f(Klass* k));
868 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
869 bool super_types_do(SuperTypeClosure* blk);
870
871 // Casting from Klass*
872 static InstanceKlass* cast(Klass* k) {
873 assert(k == NULL || k->is_klass(), "must be");
874 assert(k == NULL || k->oop_is_instance(), "cast to InstanceKlass");
875 return (InstanceKlass*) k;
876 }
877
878 InstanceKlass* java_super() const {
879 return (super() == NULL) ? NULL : cast(super());
880 }
881
882 // Sizing (in words)
883 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
884
885 static int size(int vtable_length, int itable_length,
886 int nonstatic_oop_map_size,
887 bool is_interface, bool is_anonymous) {
888 return align_object_size(header_size() +
889 align_object_offset(vtable_length) +
890 align_object_offset(itable_length) +
891 ((is_interface || is_anonymous) ?
892 align_object_offset(nonstatic_oop_map_size) :
893 nonstatic_oop_map_size) +
894 (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
|