24 25 #ifndef SHARE_VM_OOPS_ARRAYKLASS_HPP 26 #define SHARE_VM_OOPS_ARRAYKLASS_HPP 27 28 #include "memory/universe.hpp" 29 #include "oops/klass.hpp" 30 31 class fieldDescriptor; 32 class klassVtable; 33 34 // ArrayKlass is the abstract baseclass for all array classes 35 36 class ArrayKlass: public Klass { 37 friend class VMStructs; 38 private: 39 int _dimension; // This is n'th-dimensional array. 40 Klass* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). 41 Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). 42 43 protected: 44 // Constructors 45 // The constructor with the Symbol argument does the real array 46 // initialization, the other is a dummy 47 ArrayKlass(Symbol* name); 48 ArrayKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); } 49 50 // Create array_name for element klass, creates a permanent symbol, returns result 51 static Symbol* create_element_klass_array_name(Klass* element_klass, TRAPS); 52 53 public: 54 // Testing operation 55 DEBUG_ONLY(bool is_array_klass_slow() const { return true; }) 56 57 // Instance variables 58 int dimension() const { return _dimension; } 59 void set_dimension(int dimension) { _dimension = dimension; } 60 61 Klass* higher_dimension() const { return _higher_dimension; } 62 inline Klass* higher_dimension_acquire() const; // load with acquire semantics 63 void set_higher_dimension(Klass* k) { _higher_dimension = k; } 64 inline void release_set_higher_dimension(Klass* k); // store with release semantics 65 Klass** adr_higher_dimension() { return (Klass**)&this->_higher_dimension;} 66 67 Klass* lower_dimension() const { return _lower_dimension; } 68 void set_lower_dimension(Klass* k) { _lower_dimension = k; } 69 Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;} 70 71 // offset of first element, including any padding for the sake of alignment 72 int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } 73 int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); } | 24 25 #ifndef SHARE_VM_OOPS_ARRAYKLASS_HPP 26 #define SHARE_VM_OOPS_ARRAYKLASS_HPP 27 28 #include "memory/universe.hpp" 29 #include "oops/klass.hpp" 30 31 class fieldDescriptor; 32 class klassVtable; 33 34 // ArrayKlass is the abstract baseclass for all array classes 35 36 class ArrayKlass: public Klass { 37 friend class VMStructs; 38 private: 39 int _dimension; // This is n'th-dimensional array. 40 Klass* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). 41 Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). 42 43 protected: 44 Klass* _element_klass; // The klass of the elements of this array type 45 // The element type must be registered for both object arrays 46 // (incl. object arrays with value type elements) and value type 47 // arrays containing flattened value types. However, the element 48 // type must not be registered for arrays of primitive types. 49 // TODO: Update the class hierarchy so that element klass appears 50 // only in array that contain non-primitive types. 51 // Constructors 52 // The constructor with the Symbol argument does the real array 53 // initialization, the other is a dummy 54 ArrayKlass(Symbol* name); 55 ArrayKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); } 56 57 // Create array_name for element klass, creates a permanent symbol, returns result 58 static Symbol* create_element_klass_array_name(Klass* element_klass, TRAPS); 59 60 public: 61 // Instance variables 62 virtual Klass* element_klass() const { return _element_klass; } 63 virtual void set_element_klass(Klass* k) { _element_klass = k; } 64 65 // Compiler/Interpreter offset 66 static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ArrayKlass, _element_klass)); } 67 68 // Testing operation 69 DEBUG_ONLY(bool is_array_klass_slow() const { return true; }) 70 71 // Instance variables 72 int dimension() const { return _dimension; } 73 void set_dimension(int dimension) { _dimension = dimension; } 74 75 Klass* higher_dimension() const { return _higher_dimension; } 76 inline Klass* higher_dimension_acquire() const; // load with acquire semantics 77 void set_higher_dimension(Klass* k) { _higher_dimension = k; } 78 inline void release_set_higher_dimension(Klass* k); // store with release semantics 79 Klass** adr_higher_dimension() { return (Klass**)&this->_higher_dimension;} 80 81 Klass* lower_dimension() const { return _lower_dimension; } 82 void set_lower_dimension(Klass* k) { _lower_dimension = k; } 83 Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;} 84 85 // offset of first element, including any padding for the sake of alignment 86 int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } 87 int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); } |