use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getDataSizeInBytes.
/**
* Returns the size of data in an indexable object, in bytes, including leaves, excluding the header.
* @param arrayPtr Pointer to the indexable object whose size is required
* @return Size of object in bytes excluding the header
*/
public UDATA getDataSizeInBytes(J9IndexableObjectPointer array) throws CorruptDataException {
J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
U32 arrayShape = J9ROMArrayClassPointer.cast(clazz.romClass()).arrayShape();
UDATA numberOfElements = getSizeInElements(array);
UDATA size = numberOfElements.leftShift(arrayShape.bitAnd(0x0000FFFF).intValue());
return UDATA.roundToSizeofUDATA(size);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getArrayLayout.
/**
* Get the layout for the given indexable object
* @param objPtr Pointer to a array object
* @return the ArrayLayout for objectPtr
*/
protected long getArrayLayout(J9IndexableObjectPointer array) throws CorruptDataException {
if (J9BuildFlags.gc_hybridArraylets) {
/* Trivial check for InlineContiguous. */
if (!J9IndexableObjectContiguousPointer.cast(array).size().eq(0)) {
return GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous;
}
}
/* Check if the objPtr is in the allowed arraylet range. */
if ((array.gte(arrayletRangeBase)) && (array.lt(arrayletRangeTop))) {
UDATA dataSizeInBytes = getDataSizeInBytes(array);
long layout = getArrayLayout(J9IndexableObjectHelper.clazz(array), dataSizeInBytes);
return layout;
}
return GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getSpineSize.
/**
* Get the spine size for the given indexable object
* @param objPtr Pointer to an array object
* @return The total size in bytes of objPtr's array spine;
* includes header, arraylet ptrs, and (if present) padding & inline data
*/
protected UDATA getSpineSize(J9IndexableObjectPointer array) throws CorruptDataException {
long layout = getArrayLayout(array);
boolean alignData = shouldAlignSpineDataSection(J9IndexableObjectHelper.clazz(array));
UDATA dataSize = getDataSizeInBytes(array);
UDATA numberArraylets = numArraylets(dataSize);
return getSpineSize(layout, numberArraylets, dataSize, alignData);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getElementAddress.
@Override
public VoidPointer getElementAddress(J9IndexableObjectPointer array, int elementIndex, int elementSize) throws CorruptDataException {
boolean isInlineContiguous = isInlineContiguousArraylet(array);
UDATA byteOffsetIntoData = new UDATA(elementIndex * (long) elementSize);
if (isInlineContiguous) {
return VoidPointer.cast(getDataPointerForContiguous(array).addOffset(byteOffsetIntoData));
} else {
ObjectReferencePointer arrayoid = getArrayoidPointer(array);
UDATA arrayletIndex = byteOffsetIntoData.rightShift(arrayletLeafLogSize);
VoidPointer arrayletLeafBaseAddress = VoidPointer.cast(arrayoid.at(arrayletIndex));
if (arrayletLeafBaseAddress.isNull()) {
/* this can happen if the arraylet wasn't fully initialized */
throw new NoSuchElementException("Arraylet leaf not yet initialized");
}
UDATA indexIntoArraylet = byteOffsetIntoData.bitAnd(arrayletLeafSizeMask);
return arrayletLeafBaseAddress.addOffset(indexIntoArraylet);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method numExternalArraylets.
/**
* Return the total number of arraylets for an indexable object, not including the arraylet in the spine.
* Note that discontiugous arrays always have an empty leaf contained in the spine.
* @param array pointer to array
* @return the number of leaf arraylets
*/
protected UDATA numExternalArraylets(J9IndexableObjectPointer array) throws CorruptDataException {
UDATA numberOfArraylets = new UDATA(0);
if ((getArrayLayout(array) != GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous)) {
numberOfArraylets = numArraylets(getDataSizeInBytes(array));
numberOfArraylets = numberOfArraylets.sub(1);
}
return numberOfArraylets;
}
Aggregations