< prev index next >

src/hotspot/share/oops/typeArrayOop.hpp

Print this page




  94 
  95   jushort ushort_at(int which) const;
  96   void ushort_at_put(int which, jushort contents);
  97 
  98   jlong long_at(int which) const;
  99   void long_at_put(int which, jlong contents);
 100 
 101   jfloat float_at(int which) const;
 102   void float_at_put(int which, jfloat contents);
 103 
 104   jdouble double_at(int which) const;
 105   void double_at_put(int which, jdouble contents);
 106 
 107   jbyte byte_at_acquire(int which) const;
 108   void release_byte_at_put(int which, jbyte contents);
 109 
 110   Symbol* symbol_at(int which) const;
 111   void symbol_at_put(int which, Symbol* contents);
 112 
 113   // Sizing



 114 
 115   // Returns the number of words necessary to hold an array of "len"
 116   // elements each of the given "byte_size".
 117  private:
 118   static int object_size(int lh, int length) {
 119     int instance_header_size = Klass::layout_helper_header_size(lh);
 120     int element_shift = Klass::layout_helper_log2_element_size(lh);
 121     DEBUG_ONLY(BasicType etype = Klass::layout_helper_element_type(lh));
 122     assert(length <= arrayOopDesc::max_array_length(etype), "no overflow");
 123 
 124     julong size_in_bytes = (juint)length;
 125     size_in_bytes <<= element_shift;
 126     size_in_bytes += instance_header_size;
 127     julong size_in_words = ((size_in_bytes + (HeapWordSize-1)) >> LogHeapWordSize);
 128     assert(size_in_words <= (julong)max_jint, "no overflow");
 129 
 130     return align_object_size((intptr_t)size_in_words);
 131   }
 132 
 133  public:


  94 
  95   jushort ushort_at(int which) const;
  96   void ushort_at_put(int which, jushort contents);
  97 
  98   jlong long_at(int which) const;
  99   void long_at_put(int which, jlong contents);
 100 
 101   jfloat float_at(int which) const;
 102   void float_at_put(int which, jfloat contents);
 103 
 104   jdouble double_at(int which) const;
 105   void double_at_put(int which, jdouble contents);
 106 
 107   jbyte byte_at_acquire(int which) const;
 108   void release_byte_at_put(int which, jbyte contents);
 109 
 110   Symbol* symbol_at(int which) const;
 111   void symbol_at_put(int which, Symbol* contents);
 112 
 113   // Sizing
 114   static int object_size(TypeArrayKlass* kls, int length) {
 115     return object_size(kls->layout_helper(), length);
 116   }
 117 
 118   // Returns the number of words necessary to hold an array of "len"
 119   // elements each of the given "byte_size".
 120  private:
 121   static int object_size(int lh, int length) {
 122     int instance_header_size = Klass::layout_helper_header_size(lh);
 123     int element_shift = Klass::layout_helper_log2_element_size(lh);
 124     DEBUG_ONLY(BasicType etype = Klass::layout_helper_element_type(lh));
 125     assert(length <= arrayOopDesc::max_array_length(etype), "no overflow");
 126 
 127     julong size_in_bytes = (juint)length;
 128     size_in_bytes <<= element_shift;
 129     size_in_bytes += instance_header_size;
 130     julong size_in_words = ((size_in_bytes + (HeapWordSize-1)) >> LogHeapWordSize);
 131     assert(size_in_words <= (julong)max_jint, "no overflow");
 132 
 133     return align_object_size((intptr_t)size_in_words);
 134   }
 135 
 136  public:
< prev index next >