82 }
83 if (VM.getVM().isCompressedOopsEnabled()) {
84 lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
85 } else {
86 lengthOffsetInBytes = typeSize;
87 }
88 return lengthOffsetInBytes;
89 }
90
91 // Accessors for declared fields
92 public long getLength() {
93 boolean isUnsigned = true;
94 return this.getHandle().getCIntegerAt(lengthOffsetInBytes(), VM.getVM().getIntSize(), isUnsigned);
95 }
96
97 public long getObjectSize() {
98 ArrayKlass klass = (ArrayKlass) getKlass();
99 // We have to fetch the length of the array, shift (multiply) it
100 // appropriately, up to wordSize, add the header, and align to
101 // object size.
102 long s = getLength() << klass.getLog2ElementSize();
103 s += klass.getArrayHeaderInBytes();
104 s = Oop.alignObjectSize(s);
105 return s;
106 }
107
108 public static long baseOffsetInBytes(BasicType type) {
109 return headerSize(type) * VM.getVM().getHeapWordSize();
110 }
111
112 public boolean isArray() { return true; }
113
114 public void iterateFields(OopVisitor visitor, boolean doVMFields) {
115 super.iterateFields(visitor, doVMFields);
116 }
117 }
|
82 }
83 if (VM.getVM().isCompressedOopsEnabled()) {
84 lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
85 } else {
86 lengthOffsetInBytes = typeSize;
87 }
88 return lengthOffsetInBytes;
89 }
90
91 // Accessors for declared fields
92 public long getLength() {
93 boolean isUnsigned = true;
94 return this.getHandle().getCIntegerAt(lengthOffsetInBytes(), VM.getVM().getIntSize(), isUnsigned);
95 }
96
97 public long getObjectSize() {
98 ArrayKlass klass = (ArrayKlass) getKlass();
99 // We have to fetch the length of the array, shift (multiply) it
100 // appropriately, up to wordSize, add the header, and align to
101 // object size.
102 long s = getLength() * klass.getElementSize();
103 s += klass.getArrayHeaderInBytes();
104 s = Oop.alignObjectSize(s);
105 return s;
106 }
107
108 public static long baseOffsetInBytes(BasicType type) {
109 return headerSize(type) * VM.getVM().getHeapWordSize();
110 }
111
112 public boolean isArray() { return true; }
113
114 public void iterateFields(OopVisitor visitor, boolean doVMFields) {
115 super.iterateFields(visitor, doVMFields);
116 }
117 }
|