< prev index next >

src/share/vm/oops/instanceKlass.hpp

Print this page




  77    oop _obj;
  78    outputStream* _st;
  79  public:
  80    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
  81    void do_field(fieldDescriptor* fd);
  82 };
  83 #endif  // !PRODUCT
  84 
  85 // ValueObjs embedded in klass. Describes where oops are located in instances of
  86 // this klass.
  87 class OopMapBlock VALUE_OBJ_CLASS_SPEC {
  88  public:
  89   // Byte offset of the first oop mapped by this block.
  90   int offset() const          { return _offset; }
  91   void set_offset(int offset) { _offset = offset; }
  92 
  93   // Number of oops in this block.
  94   uint count() const         { return _count; }
  95   void set_count(uint count) { _count = count; }
  96 
  97   // sizeof(OopMapBlock) in HeapWords.
  98   static const int size_in_words() {
  99     return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
 100       LogHeapWordSize;
 101   }
 102 
 103  private:
 104   int  _offset;
 105   uint _count;
 106 };
 107 
 108 struct JvmtiCachedClassFileData;
 109 
 110 class InstanceKlass: public Klass {
 111   friend class VMStructs;
 112   friend class JVMCIVMStructs;
 113   friend class ClassFileParser;
 114   friend class CompileReplay;
 115 
 116  protected:
 117   InstanceKlass(const ClassFileParser& parser, unsigned kind);
 118 
 119  public:
 120   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }


 910   void methods_do(void f(Method* method));
 911   void array_klasses_do(void f(Klass* k));
 912   void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
 913   bool super_types_do(SuperTypeClosure* blk);
 914 
 915   static InstanceKlass* cast(Klass* k) {
 916     return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
 917   }
 918 
 919   static const InstanceKlass* cast(const Klass* k) {
 920     assert(k != NULL, "k should not be null");
 921     assert(k->is_instance_klass(), "cast to InstanceKlass");
 922     return static_cast<const InstanceKlass*>(k);
 923   }
 924 
 925   InstanceKlass* java_super() const {
 926     return (super() == NULL) ? NULL : cast(super());
 927   }
 928 
 929   // Sizing (in words)
 930   static int header_size()            { return sizeof(InstanceKlass)/HeapWordSize; }
 931 
 932   static int size(int vtable_length, int itable_length,
 933                   int nonstatic_oop_map_size,
 934                   bool is_interface, bool is_anonymous) {
 935     return align_object_size(header_size() +
 936            vtable_length +
 937            itable_length +
 938            nonstatic_oop_map_size +
 939            (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
 940            (is_anonymous ? (int)sizeof(Klass*)/HeapWordSize : 0));
 941   }
 942   int size() const                    { return size(vtable_length(),
 943                                                itable_length(),
 944                                                nonstatic_oop_map_size(),
 945                                                is_interface(),
 946                                                is_anonymous());
 947   }
 948 #if INCLUDE_SERVICES
 949   virtual void collect_statistics(KlassSizeStats *sz) const;
 950 #endif
 951 
 952   static ByteSize vtable_start_offset()    { return in_ByteSize(header_size() * wordSize); }
 953   static ByteSize vtable_length_offset()   { return byte_offset_of(InstanceKlass, _vtable_len); }
 954 
 955   intptr_t* start_of_vtable() const        { return (intptr_t*) ((address)this + in_bytes(vtable_start_offset())); }
 956   intptr_t* start_of_itable() const        { return start_of_vtable() + vtable_length(); }
 957   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
 958 
 959   intptr_t* end_of_itable() const          { return start_of_itable() + itable_length(); }
 960 




  77    oop _obj;
  78    outputStream* _st;
  79  public:
  80    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
  81    void do_field(fieldDescriptor* fd);
  82 };
  83 #endif  // !PRODUCT
  84 
  85 // ValueObjs embedded in klass. Describes where oops are located in instances of
  86 // this klass.
  87 class OopMapBlock VALUE_OBJ_CLASS_SPEC {
  88  public:
  89   // Byte offset of the first oop mapped by this block.
  90   int offset() const          { return _offset; }
  91   void set_offset(int offset) { _offset = offset; }
  92 
  93   // Number of oops in this block.
  94   uint count() const         { return _count; }
  95   void set_count(uint count) { _count = count; }
  96 
  97   // sizeof(OopMapBlock) in words.
  98   static const int size_in_words() {
  99     return align_size_up(int(sizeof(OopMapBlock)), wordSize) >>
 100       LogBytesPerWord;
 101   }
 102 
 103  private:
 104   int  _offset;
 105   uint _count;
 106 };
 107 
 108 struct JvmtiCachedClassFileData;
 109 
 110 class InstanceKlass: public Klass {
 111   friend class VMStructs;
 112   friend class JVMCIVMStructs;
 113   friend class ClassFileParser;
 114   friend class CompileReplay;
 115 
 116  protected:
 117   InstanceKlass(const ClassFileParser& parser, unsigned kind);
 118 
 119  public:
 120   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }


 910   void methods_do(void f(Method* method));
 911   void array_klasses_do(void f(Klass* k));
 912   void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
 913   bool super_types_do(SuperTypeClosure* blk);
 914 
 915   static InstanceKlass* cast(Klass* k) {
 916     return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
 917   }
 918 
 919   static const InstanceKlass* cast(const Klass* k) {
 920     assert(k != NULL, "k should not be null");
 921     assert(k->is_instance_klass(), "cast to InstanceKlass");
 922     return static_cast<const InstanceKlass*>(k);
 923   }
 924 
 925   InstanceKlass* java_super() const {
 926     return (super() == NULL) ? NULL : cast(super());
 927   }
 928 
 929   // Sizing (in words)
 930   static int header_size()            { return sizeof(InstanceKlass)/wordSize; }
 931 
 932   static int size(int vtable_length, int itable_length,
 933                   int nonstatic_oop_map_size,
 934                   bool is_interface, bool is_anonymous) {
 935     return align_metadata_size(header_size() +
 936            vtable_length +
 937            itable_length +
 938            nonstatic_oop_map_size +
 939            (is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
 940            (is_anonymous ? (int)sizeof(Klass*)/wordSize : 0));
 941   }
 942   int size() const                    { return size(vtable_length(),
 943                                                itable_length(),
 944                                                nonstatic_oop_map_size(),
 945                                                is_interface(),
 946                                                is_anonymous());
 947   }
 948 #if INCLUDE_SERVICES
 949   virtual void collect_statistics(KlassSizeStats *sz) const;
 950 #endif
 951 
 952   static ByteSize vtable_start_offset()    { return in_ByteSize(header_size() * wordSize); }
 953   static ByteSize vtable_length_offset()   { return byte_offset_of(InstanceKlass, _vtable_len); }
 954 
 955   intptr_t* start_of_vtable() const        { return (intptr_t*) ((address)this + in_bytes(vtable_start_offset())); }
 956   intptr_t* start_of_itable() const        { return start_of_vtable() + vtable_length(); }
 957   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
 958 
 959   intptr_t* end_of_itable() const          { return start_of_itable() + itable_length(); }
 960 


< prev index next >