hotspot/src/share/vm/oops/typeArrayKlass.hpp
changeset 13952 e3cf184080bc
parent 13728 882756847a04
child 17826 9ad5cd464a75
equal deleted inserted replaced
13918:b01a48301e67 13952:e3cf184080bc
    26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
    26 #define SHARE_VM_OOPS_TYPEARRAYKLASS_HPP
    27 
    27 
    28 #include "classfile/classLoaderData.hpp"
    28 #include "classfile/classLoaderData.hpp"
    29 #include "oops/arrayKlass.hpp"
    29 #include "oops/arrayKlass.hpp"
    30 
    30 
    31 // A typeArrayKlass is the klass of a typeArray
    31 // A TypeArrayKlass is the klass of a typeArray
    32 // It contains the type and size of the elements
    32 // It contains the type and size of the elements
    33 
    33 
    34 class typeArrayKlass : public arrayKlass {
    34 class TypeArrayKlass : public ArrayKlass {
    35   friend class VMStructs;
    35   friend class VMStructs;
    36  private:
    36  private:
    37   jint _max_length;            // maximum number of elements allowed in an array
    37   jint _max_length;            // maximum number of elements allowed in an array
    38 
    38 
    39   // Constructor
    39   // Constructor
    40   typeArrayKlass(BasicType type, Symbol* name);
    40   TypeArrayKlass(BasicType type, Symbol* name);
    41   static typeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS);
    41   static TypeArrayKlass* allocate(ClassLoaderData* loader_data, BasicType type, Symbol* name, TRAPS);
    42  public:
    42  public:
    43   typeArrayKlass() {} // For dummy objects.
    43   TypeArrayKlass() {} // For dummy objects.
    44 
    44 
    45   // instance variables
    45   // instance variables
    46   jint max_length()                     { return _max_length; }
    46   jint max_length()                     { return _max_length; }
    47   void set_max_length(jint m)           { _max_length = m;    }
    47   void set_max_length(jint m)           { _max_length = m;    }
    48 
    48 
    49   // testers
    49   // testers
    50   bool oop_is_typeArray_slow() const    { return true; }
    50   bool oop_is_typeArray_slow() const    { return true; }
    51 
    51 
    52   // klass allocation
    52   // klass allocation
    53   static typeArrayKlass* create_klass(BasicType type, const char* name_str,
    53   static TypeArrayKlass* create_klass(BasicType type, const char* name_str,
    54                                TRAPS);
    54                                TRAPS);
    55   static inline Klass* create_klass(BasicType type, int scale, TRAPS) {
    55   static inline Klass* create_klass(BasicType type, int scale, TRAPS) {
    56     typeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL);
    56     TypeArrayKlass* tak = create_klass(type, external_name(type), CHECK_NULL);
    57     assert(scale == (1 << tak->log2_element_size()), "scale must check out");
    57     assert(scale == (1 << tak->log2_element_size()), "scale must check out");
    58     return tak;
    58     return tak;
    59   }
    59   }
    60 
    60 
    61   int oop_size(oop obj) const;
    61   int oop_size(oop obj) const;
    88   // Returns the array class with this class as element type
    88   // Returns the array class with this class as element type
    89   virtual Klass* array_klass_impl(bool or_null, TRAPS);
    89   virtual Klass* array_klass_impl(bool or_null, TRAPS);
    90 
    90 
    91  public:
    91  public:
    92   // Casting from Klass*
    92   // Casting from Klass*
    93   static typeArrayKlass* cast(Klass* k) {
    93   static TypeArrayKlass* cast(Klass* k) {
    94     assert(k->oop_is_typeArray(), "cast to typeArrayKlass");
    94     assert(k->oop_is_typeArray(), "cast to TypeArrayKlass");
    95     return (typeArrayKlass*) k;
    95     return (TypeArrayKlass*) k;
    96   }
    96   }
    97 
    97 
    98   // Naming
    98   // Naming
    99   static const char* external_name(BasicType type);
    99   static const char* external_name(BasicType type);
   100 
   100 
   101   // Sizing
   101   // Sizing
   102   static int header_size()  { return sizeof(typeArrayKlass)/HeapWordSize; }
   102   static int header_size()  { return sizeof(TypeArrayKlass)/HeapWordSize; }
   103   int size() const          { return arrayKlass::static_size(header_size()); }
   103   int size() const          { return ArrayKlass::static_size(header_size()); }
   104 
   104 
   105   // Initialization (virtual from Klass)
   105   // Initialization (virtual from Klass)
   106   void initialize(TRAPS);
   106   void initialize(TRAPS);
   107 
   107 
   108  public:
   108  public: