775
776 // link this class into the implementors list of every interface it implements
777 void process_interfaces(Thread *thread);
778
779 // virtual operations from Klass
780 bool is_leaf_class() const { return _subklass == NULL; }
781 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
782 bool compute_is_subtype_of(Klass* k);
783 bool can_be_primary_super_slow() const;
784 int oop_size(oop obj) const { return size_helper(); }
785 bool oop_is_instance_slow() const { return true; }
786
787 // Iterators
788 void do_local_static_fields(FieldClosure* cl);
789 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
790 void do_local_static_fields(void f(fieldDescriptor*, TRAPS), TRAPS);
791
792 void methods_do(void f(Method* method));
793 void array_klasses_do(void f(Klass* k));
794 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
795 void with_array_klasses_do(void f(Klass* k));
796 bool super_types_do(SuperTypeClosure* blk);
797
798 // Casting from Klass*
799 static InstanceKlass* cast(Klass* k) {
800 assert(k->is_klass(), "must be");
801 assert(k->oop_is_instance(), "cast to InstanceKlass");
802 return (InstanceKlass*) k;
803 }
804
805 InstanceKlass* java_super() const {
806 return (super() == NULL) ? NULL : cast(super());
807 }
808
809 // Sizing (in words)
810 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
811
812 static int size(int vtable_length, int itable_length,
813 int nonstatic_oop_map_size,
814 bool is_interface, bool is_anonymous) {
815 return align_object_size(header_size() +
854 Klass** adr_implementor() const {
855 if (is_interface()) {
856 return (Klass**)end_of_nonstatic_oop_maps();
857 } else {
858 return NULL;
859 }
860 };
861
862 Klass** adr_host_klass() const {
863 if (is_anonymous()) {
864 Klass** adr_impl = adr_implementor();
865 if (adr_impl != NULL) {
866 return adr_impl + 1;
867 } else {
868 return end_of_nonstatic_oop_maps();
869 }
870 } else {
871 return NULL;
872 }
873 }
874
875 // Allocation profiling support
876 juint alloc_size() const { return _alloc_count * size_helper(); }
877 void set_alloc_size(juint n) {}
878
879 // Use this to return the size of an instance in heap words:
880 int size_helper() const {
881 return layout_helper_to_size_helper(layout_helper());
882 }
883
884 // This bit is initialized in classFileParser.cpp.
885 // It is false under any of the following conditions:
886 // - the class is abstract (including any interface)
887 // - the class has a finalizer (if !RegisterFinalizersAtInit)
888 // - the class size is larger than FastAllocateSizeLimit
889 // - the class is java/lang/Class, which cannot be allocated directly
890 bool can_be_fastpath_allocated() const {
891 return !layout_helper_needs_slow_path(layout_helper());
892 }
893
894 // Java vtable/itable
895 klassVtable* vtable() const; // return new klassVtable wrapper
896 inline Method* method_at_vtable(int index);
897 klassItable* itable() const; // return new klassItable wrapper
|
775
776 // link this class into the implementors list of every interface it implements
777 void process_interfaces(Thread *thread);
778
779 // virtual operations from Klass
780 bool is_leaf_class() const { return _subklass == NULL; }
781 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
782 bool compute_is_subtype_of(Klass* k);
783 bool can_be_primary_super_slow() const;
784 int oop_size(oop obj) const { return size_helper(); }
785 bool oop_is_instance_slow() const { return true; }
786
787 // Iterators
788 void do_local_static_fields(FieldClosure* cl);
789 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
790 void do_local_static_fields(void f(fieldDescriptor*, TRAPS), TRAPS);
791
792 void methods_do(void f(Method* method));
793 void array_klasses_do(void f(Klass* k));
794 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
795 bool super_types_do(SuperTypeClosure* blk);
796
797 // Casting from Klass*
798 static InstanceKlass* cast(Klass* k) {
799 assert(k->is_klass(), "must be");
800 assert(k->oop_is_instance(), "cast to InstanceKlass");
801 return (InstanceKlass*) k;
802 }
803
804 InstanceKlass* java_super() const {
805 return (super() == NULL) ? NULL : cast(super());
806 }
807
808 // Sizing (in words)
809 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
810
811 static int size(int vtable_length, int itable_length,
812 int nonstatic_oop_map_size,
813 bool is_interface, bool is_anonymous) {
814 return align_object_size(header_size() +
853 Klass** adr_implementor() const {
854 if (is_interface()) {
855 return (Klass**)end_of_nonstatic_oop_maps();
856 } else {
857 return NULL;
858 }
859 };
860
861 Klass** adr_host_klass() const {
862 if (is_anonymous()) {
863 Klass** adr_impl = adr_implementor();
864 if (adr_impl != NULL) {
865 return adr_impl + 1;
866 } else {
867 return end_of_nonstatic_oop_maps();
868 }
869 } else {
870 return NULL;
871 }
872 }
873
874 // Use this to return the size of an instance in heap words:
875 int size_helper() const {
876 return layout_helper_to_size_helper(layout_helper());
877 }
878
879 // This bit is initialized in classFileParser.cpp.
880 // It is false under any of the following conditions:
881 // - the class is abstract (including any interface)
882 // - the class has a finalizer (if !RegisterFinalizersAtInit)
883 // - the class size is larger than FastAllocateSizeLimit
884 // - the class is java/lang/Class, which cannot be allocated directly
885 bool can_be_fastpath_allocated() const {
886 return !layout_helper_needs_slow_path(layout_helper());
887 }
888
889 // Java vtable/itable
890 klassVtable* vtable() const; // return new klassVtable wrapper
891 inline Method* method_at_vtable(int index);
892 klassItable* itable() const; // return new klassItable wrapper
|