Search in sources :

Example 1 with J9IndexableObjectPointer

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);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 2 with J9IndexableObjectPointer

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;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 3 with J9IndexableObjectPointer

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);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 4 with J9IndexableObjectPointer

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);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) ObjectReferencePointer(com.ibm.j9ddr.vm29.pointer.ObjectReferencePointer) NoSuchElementException(java.util.NoSuchElementException)

Example 5 with J9IndexableObjectPointer

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;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Aggregations

UDATA (com.ibm.j9ddr.vm29.types.UDATA)9 U32 (com.ibm.j9ddr.vm29.types.U32)4 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)3 J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)3 J9IndexableObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer)2 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)2 NoSuchElementException (java.util.NoSuchElementException)2 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)1 JavaObject (com.ibm.dtfj.java.JavaObject)1 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 InvalidDataTypeException (com.ibm.j9ddr.InvalidDataTypeException)1 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)1 AlgorithmVersion (com.ibm.j9ddr.vm29.j9.AlgorithmVersion)1 GCScavengerForwardedHeader (com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader)1 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)1 ObjectReferencePointer (com.ibm.j9ddr.vm29.pointer.ObjectReferencePointer)1 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)1 J9ROMArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMArrayClassPointer)1 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)1 J9Object (com.ibm.j9ddr.vm29.structure.J9Object)1