< prev index next >

src/hotspot/share/oops/arrayOop.hpp

Print this page
*** 80,12 ***
  
    // The _length field is not declared in C++.  It is allocated after the
    // declared nonstatic fields in arrayOopDesc if not compressed, otherwise
    // it occupies the second half of the _klass field in oopDesc.
    static int length_offset_in_bytes() {
!     return UseCompressedClassPointers ? klass_gap_offset_in_bytes() :
!                                sizeof(arrayOopDesc);
    }
  
    // Returns the offset of the first element.
    static int base_offset_in_bytes(BasicType type) {
      size_t hs = header_size_in_bytes();
--- 80,17 ---
  
    // The _length field is not declared in C++.  It is allocated after the
    // declared nonstatic fields in arrayOopDesc if not compressed, otherwise
    // it occupies the second half of the _klass field in oopDesc.
    static int length_offset_in_bytes() {
!     if (UseCompactObjectHeaders) {
!       return oopDesc::base_offset_in_bytes();
+     } else if (UseCompressedClassPointers) {
+       return klass_gap_offset_in_bytes();
+     } else {
+       return sizeof(arrayOopDesc);
+     }
    }
  
    // Returns the offset of the first element.
    static int base_offset_in_bytes(BasicType type) {
      size_t hs = header_size_in_bytes();
< prev index next >