src/share/vm/oops/arrayOop.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6703888 Sdiff src/share/vm/oops

src/share/vm/oops/arrayOop.hpp

Print this page




  24 
  25 // arrayOopDesc is the abstract baseclass for all arrays.  It doesn't
  26 // declare pure virtual to enforce this because that would allocate a vtbl
  27 // in each instance, which we don't want.
  28 
  29 // The layout of array Oops is:
  30 //
  31 //  markOop
  32 //  klassOop  // 32 bits if compressed but declared 64 in LP64.
  33 //  length    // shares klass memory or allocated after declared fields.
  34 
  35 
  36 class arrayOopDesc : public oopDesc {
  37   friend class VMStructs;
  38 
  39   // Interpreter/Compiler offsets
  40 
  41   // Header size computation.
  42   // The header is considered the oop part of this type plus the length.
  43   // Returns the aligned header_size_in_bytes.  This is not equivalent to
  44   // sizeof(arrayOopDesc) which should not appear in the code, except here.
  45   static int header_size_in_bytes() {
  46     size_t hs = UseCompressedOops ?
  47             sizeof(arrayOopDesc) :
  48             align_size_up(sizeof(arrayOopDesc) + sizeof(int), HeapWordSize);
  49 #ifdef ASSERT
  50     // make sure it isn't called before UseCompressedOops is initialized.
  51     static size_t arrayoopdesc_hs = 0;
  52     if (arrayoopdesc_hs == 0) arrayoopdesc_hs = hs;
  53     assert(arrayoopdesc_hs == hs, "header size can't change");
  54 #endif // ASSERT
  55     return (int)hs;
  56   }
  57 
  58  public:
  59   // The _length field is not declared in C++.  It is allocated after the
  60   // declared nonstatic fields in arrayOopDesc if not compressed, otherwise
  61   // it occupies the second half of the _klass field in oopDesc.
  62   static int length_offset_in_bytes() {
  63     return UseCompressedOops ? klass_gap_offset_in_bytes() :
  64                                sizeof(arrayOopDesc);
  65   }
  66 
  67   // Returns the offset of the first element.
  68   static int base_offset_in_bytes(BasicType type) {




  24 
  25 // arrayOopDesc is the abstract baseclass for all arrays.  It doesn't
  26 // declare pure virtual to enforce this because that would allocate a vtbl
  27 // in each instance, which we don't want.
  28 
  29 // The layout of array Oops is:
  30 //
  31 //  markOop
  32 //  klassOop  // 32 bits if compressed but declared 64 in LP64.
  33 //  length    // shares klass memory or allocated after declared fields.
  34 
  35 
  36 class arrayOopDesc : public oopDesc {
  37   friend class VMStructs;
  38 
  39   // Interpreter/Compiler offsets
  40 
  41   // Header size computation.
  42   // The header is considered the oop part of this type plus the length.
  43   // Returns the aligned header_size_in_bytes.  This is not equivalent to
  44   // sizeof(arrayOopDesc) which should not appear in the code.
  45   static int header_size_in_bytes() {
  46     size_t hs = align_size_up(length_offset_in_bytes() + sizeof(int),
  47                               HeapWordSize);

  48 #ifdef ASSERT
  49     // make sure it isn't called before UseCompressedOops is initialized.
  50     static size_t arrayoopdesc_hs = 0;
  51     if (arrayoopdesc_hs == 0) arrayoopdesc_hs = hs;
  52     assert(arrayoopdesc_hs == hs, "header size can't change");
  53 #endif // ASSERT
  54     return (int)hs;
  55   }
  56 
  57  public:
  58   // The _length field is not declared in C++.  It is allocated after the
  59   // declared nonstatic fields in arrayOopDesc if not compressed, otherwise
  60   // it occupies the second half of the _klass field in oopDesc.
  61   static int length_offset_in_bytes() {
  62     return UseCompressedOops ? klass_gap_offset_in_bytes() :
  63                                sizeof(arrayOopDesc);
  64   }
  65 
  66   // Returns the offset of the first element.
  67   static int base_offset_in_bytes(BasicType type) {


src/share/vm/oops/arrayOop.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File