< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Array.java

Print this page

 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();







107     s = Oop.alignObjectSize(s);
108     return s;
109   }
110 
111   public static long baseOffsetInBytes(BasicType type) {
112     long typeSizeInBytes = headerSizeInBytes();
113     if (elementTypeShouldBeAligned(type)) {
114       VM vm = VM.getVM();
115       return vm.alignUp(typeSizeInBytes, vm.getVM().getHeapWordSize());
116     } else {
117       return typeSizeInBytes;
118     }
119   }
120 
121   public boolean isArray()             { return true; }
122 
123   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
124     super.iterateFields(visitor, doVMFields);
125   }
126 }

 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();
107     if (VM.getVM().isCompactObjectHeadersEnabled()) {
108       Mark mark = getMark();
109       if (mark.isExpanded()) {
110         // Needs extra 4 bytes for identity hash-code.
111         s += 4;
112       }
113     }
114     s = Oop.alignObjectSize(s);
115     return s;
116   }
117 
118   public static long baseOffsetInBytes(BasicType type) {
119     long typeSizeInBytes = headerSizeInBytes();
120     if (elementTypeShouldBeAligned(type)) {
121       VM vm = VM.getVM();
122       return vm.alignUp(typeSizeInBytes, vm.getVM().getHeapWordSize());
123     } else {
124       return typeSizeInBytes;
125     }
126   }
127 
128   public boolean isArray()             { return true; }
129 
130   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
131     super.iterateFields(visitor, doVMFields);
132   }
133 }
< prev index next >