< prev index next >

src/share/vm/oops/instanceKlass.hpp

Print this page




  52 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)
  53 //      indicating where oops are located in instances of this klass.
  54 //    [EMBEDDED implementor of the interface] only exist for interface
  55 //    [EMBEDDED host klass        ] only exist for an anonymous class (JSR 292 enabled)
  56 //    [EMBEDDED fingerprint       ] only if should_store_fingerprint()==true
  57 
  58 
  59 // forward declaration for class -- see below for definition
  60 #if INCLUDE_JVMTI
  61 class BreakpointInfo;
  62 #endif
  63 class ClassFileParser;
  64 class KlassDepChange;
  65 class DependencyContext;
  66 class fieldDescriptor;
  67 class jniIdMapBase;
  68 class JNIid;
  69 class JvmtiCachedClassFieldMap;
  70 class MemberNameTable;
  71 class SuperTypeClosure;

  72 
  73 // This is used in iterators below.
  74 class FieldClosure: public StackObj {
  75 public:
  76   virtual void do_field(fieldDescriptor* fd) = 0;
  77 };
  78 
  79 #ifndef PRODUCT
  80 // Print fields.
  81 // If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.
  82 class FieldPrinter: public FieldClosure {
  83    oop _obj;
  84    outputStream* _st;
  85  public:
  86    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
  87    void do_field(fieldDescriptor* fd);
  88 };
  89 #endif  // !PRODUCT
  90 
  91 // ValueObjs embedded in klass. Describes where oops are located in instances of


1074   }
1075 
1076   static const InstanceKlass* cast(const Klass* k) {
1077     assert(k != NULL, "k should not be null");
1078     assert(k->is_instance_klass(), "cast to InstanceKlass");
1079     return static_cast<const InstanceKlass*>(k);
1080   }
1081 
1082   InstanceKlass* java_super() const {
1083     return (super() == NULL) ? NULL : cast(super());
1084   }
1085 
1086   // Sizing (in words)
1087   static int header_size()            { return sizeof(InstanceKlass)/wordSize; }
1088 
1089   static int size(int vtable_length, int itable_length,
1090                   int nonstatic_oop_map_size,
1091                   bool is_interface, bool is_anonymous, bool has_stored_fingerprint,
1092                   int java_fields, bool is_value_type) {
1093     return align_metadata_size(header_size() +


1094            vtable_length +
1095            itable_length +
1096            nonstatic_oop_map_size +
1097            (is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
1098            (is_anonymous ? (int)sizeof(Klass*)/wordSize : 0) +
1099            (has_stored_fingerprint ? (int)sizeof(uint64_t*)/wordSize : 0) +
1100            (java_fields * (int)sizeof(Klass*)/wordSize) +
1101            (is_value_type ? (int)sizeof(Klass*) : 0) +
1102            (is_value_type ? (int)sizeof(intptr_t)*2 : 0));
1103   }
1104   int size() const                    { return size(vtable_length(),
1105                                                itable_length(),
1106                                                nonstatic_oop_map_size(),
1107                                                is_interface(),
1108                                                is_anonymous(),
1109                                                has_stored_fingerprint(),
1110                                                has_value_fields() ? java_fields_count() : 0,
1111                                                is_value());
1112   }
1113 #if INCLUDE_SERVICES
1114   virtual void collect_statistics(KlassSizeStats *sz) const;
1115 #endif
1116 
1117   intptr_t* start_of_itable()   const { return (intptr_t*)start_of_vtable() + vtable_length(); }
1118   intptr_t* end_of_itable()     const { return start_of_itable() + itable_length(); }
1119 
1120   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
1121 
1122   address static_field_addr(int offset);
1123 
1124   bool bounds_check(address addr, bool edge_ok = false, intptr_t size_in_bytes = -1) const PRODUCT_RETURN0;
1125 
1126   OopMapBlock* start_of_nonstatic_oop_maps() const {
1127     return (OopMapBlock*)(start_of_itable() + itable_length());
1128   }
1129 
1130   Klass** end_of_nonstatic_oop_maps() const {
1131     return (Klass**)(start_of_nonstatic_oop_maps() +
1132                      nonstatic_oop_map_count());
1133   }
1134 
1135   Klass** adr_implementor() const {
1136     if (is_interface()) {
1137       return (Klass**)end_of_nonstatic_oop_maps();




  52 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)
  53 //      indicating where oops are located in instances of this klass.
  54 //    [EMBEDDED implementor of the interface] only exist for interface
  55 //    [EMBEDDED host klass        ] only exist for an anonymous class (JSR 292 enabled)
  56 //    [EMBEDDED fingerprint       ] only if should_store_fingerprint()==true
  57 
  58 
  59 // forward declaration for class -- see below for definition
  60 #if INCLUDE_JVMTI
  61 class BreakpointInfo;
  62 #endif
  63 class ClassFileParser;
  64 class KlassDepChange;
  65 class DependencyContext;
  66 class fieldDescriptor;
  67 class jniIdMapBase;
  68 class JNIid;
  69 class JvmtiCachedClassFieldMap;
  70 class MemberNameTable;
  71 class SuperTypeClosure;
  72 class BufferedValueTypeBlob;
  73 
  74 // This is used in iterators below.
  75 class FieldClosure: public StackObj {
  76 public:
  77   virtual void do_field(fieldDescriptor* fd) = 0;
  78 };
  79 
  80 #ifndef PRODUCT
  81 // Print fields.
  82 // If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.
  83 class FieldPrinter: public FieldClosure {
  84    oop _obj;
  85    outputStream* _st;
  86  public:
  87    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
  88    void do_field(fieldDescriptor* fd);
  89 };
  90 #endif  // !PRODUCT
  91 
  92 // ValueObjs embedded in klass. Describes where oops are located in instances of


1075   }
1076 
1077   static const InstanceKlass* cast(const Klass* k) {
1078     assert(k != NULL, "k should not be null");
1079     assert(k->is_instance_klass(), "cast to InstanceKlass");
1080     return static_cast<const InstanceKlass*>(k);
1081   }
1082 
1083   InstanceKlass* java_super() const {
1084     return (super() == NULL) ? NULL : cast(super());
1085   }
1086 
1087   // Sizing (in words)
1088   static int header_size()            { return sizeof(InstanceKlass)/wordSize; }
1089 
1090   static int size(int vtable_length, int itable_length,
1091                   int nonstatic_oop_map_size,
1092                   bool is_interface, bool is_anonymous, bool has_stored_fingerprint,
1093                   int java_fields, bool is_value_type) {
1094     return align_metadata_size(header_size() +
1095            (is_value_type ? (int)sizeof(address) : 0) +
1096            (is_value_type ? (int)sizeof(address) : 0) +
1097            vtable_length +
1098            itable_length +
1099            nonstatic_oop_map_size +
1100            (is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
1101            (is_anonymous ? (int)sizeof(Klass*)/wordSize : 0) +
1102            (has_stored_fingerprint ? (int)sizeof(uint64_t*)/wordSize : 0) +
1103            (java_fields * (int)sizeof(Klass*)/wordSize) +
1104            (is_value_type ? (int)sizeof(Klass*) : 0) +
1105            (is_value_type ? (int)sizeof(intptr_t)*2 : 0));
1106   }
1107   int size() const                    { return size(vtable_length(),
1108                                                itable_length(),
1109                                                nonstatic_oop_map_size(),
1110                                                is_interface(),
1111                                                is_anonymous(),
1112                                                has_stored_fingerprint(),
1113                                                has_value_fields() ? java_fields_count() : 0,
1114                                                is_value());
1115   }
1116 #if INCLUDE_SERVICES
1117   virtual void collect_statistics(KlassSizeStats *sz) const;
1118 #endif
1119 
1120   intptr_t* start_of_itable()   const { return (intptr_t*)start_of_vtable() + (is_value() ? 2 : 0 ) + vtable_length(); }
1121   intptr_t* end_of_itable()     const { return start_of_itable() + itable_length(); }
1122 
1123   int  itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
1124 
1125   address static_field_addr(int offset);
1126 
1127   bool bounds_check(address addr, bool edge_ok = false, intptr_t size_in_bytes = -1) const PRODUCT_RETURN0;
1128 
1129   OopMapBlock* start_of_nonstatic_oop_maps() const {
1130     return (OopMapBlock*)(start_of_itable() + itable_length());
1131   }
1132 
1133   Klass** end_of_nonstatic_oop_maps() const {
1134     return (Klass**)(start_of_nonstatic_oop_maps() +
1135                      nonstatic_oop_map_count());
1136   }
1137 
1138   Klass** adr_implementor() const {
1139     if (is_interface()) {
1140       return (Klass**)end_of_nonstatic_oop_maps();


< prev index next >