src/share/vm/oops/instanceKlass.hpp

Print this page




 737   // On-stack replacement support
 738   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };
 739   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };
 740   void add_osr_nmethod(nmethod* n);
 741   void remove_osr_nmethod(nmethod* n);
 742   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
 743 
 744   // Breakpoint support (see methods on Method* for details)
 745   BreakpointInfo* breakpoints() const       { return _breakpoints; };
 746   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
 747 
 748   // support for stub routines
 749   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
 750   TRACE_DEFINE_OFFSET;
 751   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
 752 
 753   // subclass/subinterface checks
 754   bool implements_interface(Klass* k) const;
 755   bool is_same_or_direct_interface(Klass* k) const;
 756 





 757   // Access to the implementor of an interface.
 758   Klass* implementor() const
 759   {
 760     Klass** k = adr_implementor();
 761     if (k == NULL) {
 762       return NULL;
 763     } else {
 764       return *k;
 765     }
 766   }
 767 
 768   void set_implementor(Klass* k) {
 769     assert(is_interface(), "not interface");
 770     Klass** addr = adr_implementor();
 771     assert(addr != NULL, "null addr");
 772     if (addr != NULL) {
 773       *addr = k;
 774     }
 775   }
 776 


 794   // virtual operations from Klass
 795   bool is_leaf_class() const               { return _subklass == NULL; }
 796   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
 797   bool compute_is_subtype_of(Klass* k);
 798   bool can_be_primary_super_slow() const;
 799   int oop_size(oop obj)  const             { return size_helper(); }
 800   bool oop_is_instance_slow() const        { return true; }
 801 
 802   // Iterators
 803   void do_local_static_fields(FieldClosure* cl);
 804   void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
 805   void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
 806 
 807   void methods_do(void f(Method* method));
 808   void array_klasses_do(void f(Klass* k));
 809   void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
 810   bool super_types_do(SuperTypeClosure* blk);
 811 
 812   // Casting from Klass*
 813   static InstanceKlass* cast(Klass* k) {
 814     assert(k->is_klass(), "must be");
 815     assert(k->oop_is_instance(), "cast to InstanceKlass");
 816     return (InstanceKlass*) k;
 817   }
 818 
 819   InstanceKlass* java_super() const {
 820     return (super() == NULL) ? NULL : cast(super());
 821   }
 822 
 823   // Sizing (in words)
 824   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
 825 
 826   static int size(int vtable_length, int itable_length,
 827                   int nonstatic_oop_map_size,
 828                   bool is_interface, bool is_anonymous) {
 829     return align_object_size(header_size() +
 830            align_object_offset(vtable_length) +
 831            align_object_offset(itable_length) +
 832            ((is_interface || is_anonymous) ?
 833              align_object_offset(nonstatic_oop_map_size) :
 834              nonstatic_oop_map_size) +
 835            (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +




 737   // On-stack replacement support
 738   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };
 739   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };
 740   void add_osr_nmethod(nmethod* n);
 741   void remove_osr_nmethod(nmethod* n);
 742   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
 743 
 744   // Breakpoint support (see methods on Method* for details)
 745   BreakpointInfo* breakpoints() const       { return _breakpoints; };
 746   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
 747 
 748   // support for stub routines
 749   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
 750   TRACE_DEFINE_OFFSET;
 751   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
 752 
 753   // subclass/subinterface checks
 754   bool implements_interface(Klass* k) const;
 755   bool is_same_or_direct_interface(Klass* k) const;
 756 
 757 #ifdef ASSERT
 758   // check whether this class or one of its superclasses was redefined
 759   bool has_redefined_this_or_super() const;
 760 #endif
 761 
 762   // Access to the implementor of an interface.
 763   Klass* implementor() const
 764   {
 765     Klass** k = adr_implementor();
 766     if (k == NULL) {
 767       return NULL;
 768     } else {
 769       return *k;
 770     }
 771   }
 772 
 773   void set_implementor(Klass* k) {
 774     assert(is_interface(), "not interface");
 775     Klass** addr = adr_implementor();
 776     assert(addr != NULL, "null addr");
 777     if (addr != NULL) {
 778       *addr = k;
 779     }
 780   }
 781 


 799   // virtual operations from Klass
 800   bool is_leaf_class() const               { return _subklass == NULL; }
 801   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
 802   bool compute_is_subtype_of(Klass* k);
 803   bool can_be_primary_super_slow() const;
 804   int oop_size(oop obj)  const             { return size_helper(); }
 805   bool oop_is_instance_slow() const        { return true; }
 806 
 807   // Iterators
 808   void do_local_static_fields(FieldClosure* cl);
 809   void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
 810   void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
 811 
 812   void methods_do(void f(Method* method));
 813   void array_klasses_do(void f(Klass* k));
 814   void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
 815   bool super_types_do(SuperTypeClosure* blk);
 816 
 817   // Casting from Klass*
 818   static InstanceKlass* cast(Klass* k) {
 819     assert(k == NULL || k->is_klass(), "must be");
 820     assert(k == NULL || k->oop_is_instance(), "cast to InstanceKlass");
 821     return (InstanceKlass*) k;
 822   }
 823 
 824   InstanceKlass* java_super() const {
 825     return (super() == NULL) ? NULL : cast(super());
 826   }
 827 
 828   // Sizing (in words)
 829   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
 830 
 831   static int size(int vtable_length, int itable_length,
 832                   int nonstatic_oop_map_size,
 833                   bool is_interface, bool is_anonymous) {
 834     return align_object_size(header_size() +
 835            align_object_offset(vtable_length) +
 836            align_object_offset(itable_length) +
 837            ((is_interface || is_anonymous) ?
 838              align_object_offset(nonstatic_oop_map_size) :
 839              nonstatic_oop_map_size) +
 840            (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +