Search in sources :

Example 6 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA 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 7 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class GCArrayletObjectModelBase_V1 method getSpineSizeWithoutHeader.

/**
 * Get the spine size without header for an arraylet with these properties
 * @param layout The layout of the indexable object
 * @param numberArraylets Number of arraylets for this indexable object
 * @param dataSize How many elements are in the indexable object
 * @param alignData Should the data section be aligned
 * @return spineSize The actual size in byte of the spine
 */
protected UDATA getSpineSizeWithoutHeader(long layout, UDATA numberArraylets, UDATA dataSize, boolean alignData) throws CorruptDataException {
    UDATA spineArrayoidSize;
    UDATA spinePaddingSize;
    /* The spine consists of three (possibly empty) sections, not including the header:
		 * 1. the alignment word - padding between arrayoid and inline-data
		 * 2. the arrayoid - an array of pointers to the leaves
		 * 3. in-line data
		 * In hybrid specs, the spine may also include padding for a secondary size field in empty arrays 
		 */
    if (J9BuildFlags.gc_hybridArraylets) {
        spineArrayoidSize = new UDATA(0);
        spinePaddingSize = new UDATA(0);
        if (GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous != layout) {
            if (!dataSize.eq(0)) {
                /* not in-line, so there in an arrayoid */
                spinePaddingSize = alignData ? new UDATA(ObjectModel.getObjectAlignmentInBytes() - ObjectReferencePointer.SIZEOF) : new UDATA(0);
                spineArrayoidSize = numberArraylets.mult(ObjectReferencePointer.SIZEOF);
            }
        }
    } else {
        spinePaddingSize = alignData ? new UDATA(ObjectReferencePointer.SIZEOF) : new UDATA(0);
        spineArrayoidSize = numberArraylets.mult(ObjectReferencePointer.SIZEOF);
    }
    UDATA spineDataSize = new UDATA(0);
    if (GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous == layout) {
        // All data in spine
        spineDataSize = dataSize;
    } else if (GC_ArrayletObjectModelBase$ArrayLayout.Hybrid == layout) {
        // TODO: lpnguyen put this pattern that appears everywhere into UDATA and think up a name, or just use mod?00
        // Last arraylet in spine.
        spineDataSize = dataSize.bitAnd(arrayletLeafSizeMask);
    }
    return spinePaddingSize.add(spineArrayoidSize).add(spineDataSize);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 8 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA 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 9 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class GCArrayletObjectModelBase_V1 method numArraylets.

/**
 * Return the total number of arraylets for an indexable object with a size of dataInSizeByte, including a (possibly empty) leaf in the spine.
 * @param dataSizeInBytes size of an array in bytes (not elements)
 * @return the number of arraylets used for an array of dataSizeInBytes bytes
 */
protected UDATA numArraylets(UDATA unadjustedDataSizeInBytes) throws CorruptDataException {
    UDATA numberOfArraylets = new UDATA(1);
    if (!UDATA.MAX.eq(arrayletLeafSize)) {
        /* We add one to unadjustedDataSizeInBytes to ensure that it's always possible to determine the address 
			 * of the after-last element without crashing. Handle the case of UDATA_MAX specially, since we use that
			 * for any object whose size overflows the address space.
			 */
        UDATA dataSizeInBytes = UDATA.MAX.eq(unadjustedDataSizeInBytes) ? UDATA.MAX : unadjustedDataSizeInBytes.add(1);
        /* CMVC 135307 : following logic for calculating the leaf count would not overflow dataSizeInBytes.
			 * the assumption is leaf size is order of 2. It's identical to:
			 * if (dataSizeInBytes % leafSize) is 0
			 * 	leaf count = dataSizeInBytes >> leafLogSize
			 * else
			 * 	leaf count = (dataSizeInBytes >> leafLogSize) + 1
			 */
        numberOfArraylets = (dataSizeInBytes.rightShift(arrayletLeafLogSize)).add(((dataSizeInBytes.bitAnd(arrayletLeafSizeMask)).add(arrayletLeafSizeMask)).rightShift(arrayletLeafLogSize));
    }
    return numberOfArraylets;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 10 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA 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)

Aggregations

UDATA (com.ibm.j9ddr.vm29.types.UDATA)86 CorruptDataException (com.ibm.j9ddr.CorruptDataException)22 U32 (com.ibm.j9ddr.vm29.types.U32)16 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)14 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)10 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)10 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)8 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)8 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)7 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)6 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)5 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)4 U16 (com.ibm.j9ddr.vm29.types.U16)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)3 J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)3 J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)3 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)3 IDATA (com.ibm.j9ddr.vm29.types.IDATA)3