64 if (VM.getVM().isLP64()) {
65 if (type == BasicType.T_OBJECT || type == BasicType.T_ARRAY) {
66 return !VM.getVM().isCompressedOopsEnabled();
67 }
68 }
69 return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
70 }
71
72 private static long headerSizeInBytes() {
73 if (headerSize != 0) {
74 return headerSize;
75 }
76 headerSize = lengthOffsetInBytes() + VM.getVM().getIntSize();
77 return headerSize;
78 }
79
80 private static long lengthOffsetInBytes() {
81 if (lengthOffsetInBytes != 0) {
82 return lengthOffsetInBytes;
83 }
84 if (VM.getVM().isCompressedKlassPointersEnabled()) {
85 lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
86 } else {
87 lengthOffsetInBytes = typeSize;
88 }
89 return lengthOffsetInBytes;
90 }
91
92 // Accessors for declared fields
93 public long getLength() {
94 boolean isUnsigned = true;
95 return this.getHandle().getCIntegerAt(lengthOffsetInBytes(), VM.getVM().getIntSize(), isUnsigned);
96 }
97
98 public long getObjectSize() {
99 ArrayKlass klass = (ArrayKlass) getKlass();
100 // We have to fetch the length of the array, shift (multiply) it
101 // appropriately, up to wordSize, add the header, and align to
102 // object size.
103 long s = getLength() << klass.getLog2ElementSize();
104 s += klass.getArrayHeaderInBytes();
|
64 if (VM.getVM().isLP64()) {
65 if (type == BasicType.T_OBJECT || type == BasicType.T_ARRAY) {
66 return !VM.getVM().isCompressedOopsEnabled();
67 }
68 }
69 return type == BasicType.T_DOUBLE || type == BasicType.T_LONG;
70 }
71
72 private static long headerSizeInBytes() {
73 if (headerSize != 0) {
74 return headerSize;
75 }
76 headerSize = lengthOffsetInBytes() + VM.getVM().getIntSize();
77 return headerSize;
78 }
79
80 private static long lengthOffsetInBytes() {
81 if (lengthOffsetInBytes != 0) {
82 return lengthOffsetInBytes;
83 }
84 if (VM.getVM().isCompactObjectHeadersEnabled()) {
85 lengthOffsetInBytes = Oop.getHeaderSize();
86 } else if (VM.getVM().isCompressedKlassPointersEnabled()) {
87 lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
88 } else {
89 lengthOffsetInBytes = typeSize;
90 }
91 return lengthOffsetInBytes;
92 }
93
94 // Accessors for declared fields
95 public long getLength() {
96 boolean isUnsigned = true;
97 return this.getHandle().getCIntegerAt(lengthOffsetInBytes(), VM.getVM().getIntSize(), isUnsigned);
98 }
99
100 public long getObjectSize() {
101 ArrayKlass klass = (ArrayKlass) getKlass();
102 // We have to fetch the length of the array, shift (multiply) it
103 // appropriately, up to wordSize, add the header, and align to
104 // object size.
105 long s = getLength() << klass.getLog2ElementSize();
106 s += klass.getArrayHeaderInBytes();
|