hotspot/src/share/vm/oops/instanceKlass.hpp
changeset 15601 df8faef6efaf
parent 15484 7395ace8a11a
child 15873 5ce4f526e0ba
child 15928 f9d5c6e4107f
equal deleted inserted replaced
15600:753e5733b5c9 15601:df8faef6efaf
   153                                           int static_field_size,
   153                                           int static_field_size,
   154                                           int nonstatic_oop_map_size,
   154                                           int nonstatic_oop_map_size,
   155                                           ReferenceType rt,
   155                                           ReferenceType rt,
   156                                           AccessFlags access_flags,
   156                                           AccessFlags access_flags,
   157                                           Symbol* name,
   157                                           Symbol* name,
   158                                         Klass* super_klass,
   158                                           Klass* super_klass,
   159                                           KlassHandle host_klass,
   159                                           bool is_anonymous,
   160                                           TRAPS);
   160                                           TRAPS);
   161 
   161 
   162   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
   162   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
   163 
   163 
   164   // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
   164   // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
   677   int cached_itable_index(size_t idnum);
   677   int cached_itable_index(size_t idnum);
   678 
   678 
   679   // annotations support
   679   // annotations support
   680   Annotations* annotations() const          { return _annotations; }
   680   Annotations* annotations() const          { return _annotations; }
   681   void set_annotations(Annotations* anno)   { _annotations = anno; }
   681   void set_annotations(Annotations* anno)   { _annotations = anno; }
       
   682 
   682   AnnotationArray* class_annotations() const {
   683   AnnotationArray* class_annotations() const {
   683     if (annotations() == NULL) return NULL;
   684     return (_annotations != NULL) ? _annotations->class_annotations() : NULL;
   684     return annotations()->class_annotations();
       
   685   }
   685   }
   686   Array<AnnotationArray*>* fields_annotations() const {
   686   Array<AnnotationArray*>* fields_annotations() const {
   687     if (annotations() == NULL) return NULL;
   687     return (_annotations != NULL) ? _annotations->fields_annotations() : NULL;
   688     return annotations()->fields_annotations();
   688   }
   689   }
   689   AnnotationArray* class_type_annotations() const {
   690   Annotations* type_annotations() const {
   690     return (_annotations != NULL) ? _annotations->class_type_annotations() : NULL;
   691     if (annotations() == NULL) return NULL;
   691   }
   692     return annotations()->type_annotations();
   692   Array<AnnotationArray*>* fields_type_annotations() const {
   693   }
   693     return (_annotations != NULL) ? _annotations->fields_type_annotations() : NULL;
   694 
   694   }
   695   // allocation
   695   // allocation
   696   instanceOop allocate_instance(TRAPS);
   696   instanceOop allocate_instance(TRAPS);
   697 
   697 
   698   // additional member function to return a handle
   698   // additional member function to return a handle
   699   instanceHandle allocate_instance_handle(TRAPS)      { return instanceHandle(THREAD, allocate_instance(THREAD)); }
   699   instanceHandle allocate_instance_handle(TRAPS)      { return instanceHandle(THREAD, allocate_instance(THREAD)); }
   808     return (super() == NULL) ? NULL : cast(super());
   808     return (super() == NULL) ? NULL : cast(super());
   809   }
   809   }
   810 
   810 
   811   // Sizing (in words)
   811   // Sizing (in words)
   812   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
   812   static int header_size()            { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
       
   813 
   813   static int size(int vtable_length, int itable_length,
   814   static int size(int vtable_length, int itable_length,
   814                   int nonstatic_oop_map_size,
   815                   int nonstatic_oop_map_size,
   815                   bool is_interface, bool is_anonymous) {
   816                   bool is_interface, bool is_anonymous) {
   816     return align_object_size(header_size() +
   817     return align_object_size(header_size() +
   817            align_object_offset(vtable_length) +
   818            align_object_offset(vtable_length) +
   845 
   846 
   846   OopMapBlock* start_of_nonstatic_oop_maps() const {
   847   OopMapBlock* start_of_nonstatic_oop_maps() const {
   847     return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
   848     return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
   848   }
   849   }
   849 
   850 
       
   851   Klass** end_of_nonstatic_oop_maps() const {
       
   852     return (Klass**)(start_of_nonstatic_oop_maps() +
       
   853                      nonstatic_oop_map_count());
       
   854   }
       
   855 
   850   Klass** adr_implementor() const {
   856   Klass** adr_implementor() const {
   851     if (is_interface()) {
   857     if (is_interface()) {
   852       return (Klass**)(start_of_nonstatic_oop_maps() +
   858       return (Klass**)end_of_nonstatic_oop_maps();
   853                     nonstatic_oop_map_count());
       
   854     } else {
   859     } else {
   855       return NULL;
   860       return NULL;
   856     }
   861     }
   857   };
   862   };
   858 
   863 
   860     if (is_anonymous()) {
   865     if (is_anonymous()) {
   861       Klass** adr_impl = adr_implementor();
   866       Klass** adr_impl = adr_implementor();
   862       if (adr_impl != NULL) {
   867       if (adr_impl != NULL) {
   863         return adr_impl + 1;
   868         return adr_impl + 1;
   864       } else {
   869       } else {
   865         return (Klass**)(start_of_nonstatic_oop_maps() +
   870         return end_of_nonstatic_oop_maps();
   866                       nonstatic_oop_map_count());
       
   867       }
   871       }
   868     } else {
   872     } else {
   869       return NULL;
   873       return NULL;
   870     }
   874     }
   871   }
   875   }