< prev index next >

src/hotspot/share/oops/objArrayKlass.hpp

Print this page

 25 #ifndef SHARE_OOPS_OBJARRAYKLASS_HPP
 26 #define SHARE_OOPS_OBJARRAYKLASS_HPP
 27 
 28 #include "oops/arrayKlass.hpp"
 29 #include "utilities/macros.hpp"
 30 
 31 class ClassLoaderData;
 32 
 33 // ObjArrayKlass is the klass for objArrays
 34 
 35 class ObjArrayKlass : public ArrayKlass {
 36   friend class VMStructs;
 37   friend class JVMCIVMStructs;
 38 
 39  public:
 40   static const KlassID ID = ObjArrayKlassID;
 41 
 42  private:
 43   // If you add a new field that points to any metaspace object, you
 44   // must add this field to ObjArrayKlass::metaspace_pointers_do().
 45   Klass* _element_klass;            // The klass of the elements of this array type
 46   Klass* _bottom_klass;             // The one-dimensional type (InstanceKlass or TypeArrayKlass)
 47 
 48   // Constructor
 49   ObjArrayKlass(int n, Klass* element_klass, Symbol* name);
 50   static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, Klass* k, Symbol* name, TRAPS);
 51  public:
 52   // For dummy objects
 53   ObjArrayKlass() {}
 54 
 55   // Instance variables
 56   Klass* element_klass() const      { return _element_klass; }
 57   void set_element_klass(Klass* k)  { _element_klass = k; }
 58   Klass** element_klass_addr()      { return &_element_klass; }
 59 
 60   Klass* bottom_klass() const       { return _bottom_klass; }
 61   void set_bottom_klass(Klass* k)   { _bottom_klass = k; }
 62   Klass** bottom_klass_addr()       { return &_bottom_klass; }
 63 
 64   ModuleEntry* module() const;
 65   PackageEntry* package() const;
 66 
 67   // Compiler/Interpreter offset
 68   static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); }
 69 
 70   // Dispatched operation
 71   bool can_be_primary_super_slow() const;
 72   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
 73                                                   Array<InstanceKlass*>* transitive_interfaces);
 74   DEBUG_ONLY(bool is_objArray_klass_slow()  const  { return true; })
 75   int oop_size(oop obj) const;
 76 
 77   // Allocation
 78   static ObjArrayKlass* allocate_objArray_klass(ClassLoaderData* loader_data,
 79                                                 int n, Klass* element_klass, TRAPS);

 80 
 81   objArrayOop allocate(int length, TRAPS);
 82   oop multi_allocate(int rank, jint* sizes, TRAPS);
 83 
 84   // Copying
 85   void  copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
 86 
 87   // Compute protection domain
 88   oop protection_domain() const { return bottom_klass()->protection_domain(); }
 89 
 90   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
 91 
 92  private:
 93   // Either oop or narrowOop depending on UseCompressedOops.
 94   // must be called from within ObjArrayKlass.cpp
 95   void do_copy(arrayOop s, size_t src_offset,
 96                arrayOop d, size_t dst_offset,
 97                int length, TRAPS);
 98  public:
 99   // Returns the ObjArrayKlass for n'th dimension.

 25 #ifndef SHARE_OOPS_OBJARRAYKLASS_HPP
 26 #define SHARE_OOPS_OBJARRAYKLASS_HPP
 27 
 28 #include "oops/arrayKlass.hpp"
 29 #include "utilities/macros.hpp"
 30 
 31 class ClassLoaderData;
 32 
 33 // ObjArrayKlass is the klass for objArrays
 34 
 35 class ObjArrayKlass : public ArrayKlass {
 36   friend class VMStructs;
 37   friend class JVMCIVMStructs;
 38 
 39  public:
 40   static const KlassID ID = ObjArrayKlassID;
 41 
 42  private:
 43   // If you add a new field that points to any metaspace object, you
 44   // must add this field to ObjArrayKlass::metaspace_pointers_do().

 45   Klass* _bottom_klass;             // The one-dimensional type (InstanceKlass or TypeArrayKlass)
 46 
 47   // Constructor
 48   ObjArrayKlass(int n, Klass* element_klass, Symbol* name, bool null_free);
 49   static ObjArrayKlass* allocate(ClassLoaderData* loader_data, int n, Klass* k, Symbol* name, bool null_free, TRAPS);
 50  public:
 51   // For dummy objects
 52   ObjArrayKlass() {}
 53 





 54   Klass* bottom_klass() const       { return _bottom_klass; }
 55   void set_bottom_klass(Klass* k)   { _bottom_klass = k; }
 56   Klass** bottom_klass_addr()       { return &_bottom_klass; }
 57 
 58   ModuleEntry* module() const;
 59   PackageEntry* package() const;
 60 



 61   // Dispatched operation
 62   bool can_be_primary_super_slow() const;
 63   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
 64                                                   Array<InstanceKlass*>* transitive_interfaces);
 65   DEBUG_ONLY(bool is_objArray_klass_slow()  const  { return true; })
 66   int oop_size(oop obj) const;
 67 
 68   // Allocation
 69   static ObjArrayKlass* allocate_objArray_klass(ClassLoaderData* loader_data,
 70                                                 int n, Klass* element_klass,
 71                                                 bool null_free, bool qdesc, TRAPS);
 72 
 73   objArrayOop allocate(int length, TRAPS);
 74   oop multi_allocate(int rank, jint* sizes, TRAPS);
 75 
 76   // Copying
 77   void  copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
 78 
 79   // Compute protection domain
 80   oop protection_domain() const { return bottom_klass()->protection_domain(); }
 81 
 82   virtual void metaspace_pointers_do(MetaspaceClosure* iter);
 83 
 84  private:
 85   // Either oop or narrowOop depending on UseCompressedOops.
 86   // must be called from within ObjArrayKlass.cpp
 87   void do_copy(arrayOop s, size_t src_offset,
 88                arrayOop d, size_t dst_offset,
 89                int length, TRAPS);
 90  public:
 91   // Returns the ObjArrayKlass for n'th dimension.
< prev index next >