Search in sources :

Example 11 with J9IndexableObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.

the class GCArrayletObjectModel_V1 method getTotalFootprintInBytesWithHeader.

@Override
public UDATA getTotalFootprintInBytesWithHeader(J9IndexableObjectPointer arrayPtr) throws CorruptDataException {
    UDATA spineSize = getSizeInBytesWithHeader(arrayPtr);
    UDATA externalArrayletSize = externalArrayletsSize(arrayPtr);
    UDATA totalFootprint = spineSize.add(externalArrayletSize);
    return totalFootprint;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 12 with J9IndexableObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.

the class GCArrayletObjectModelBase_V1 method getHashcodeOffset.

@Override
public UDATA getHashcodeOffset(J9IndexableObjectPointer array) throws CorruptDataException {
    // Don't call getDataSizeInBytes() since that rounds up to UDATA.
    long layout = getArrayLayout(array);
    J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
    U32 arrayShape = J9ROMArrayClassPointer.cast(clazz.romClass()).arrayShape();
    UDATA numberOfElements = getSizeInElements(array);
    UDATA dataSize = numberOfElements.leftShift(arrayShape.bitAnd(0x0000FFFF).intValue());
    UDATA numberArraylets = numArraylets(dataSize);
    boolean alignData = shouldAlignSpineDataSection(clazz);
    UDATA spineSize = getSpineSize(layout, numberArraylets, dataSize, alignData);
    return U32.roundToSizeofU32(spineSize);
}
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 13 with J9IndexableObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.

the class GCContiguousArrayObjectModel_V1 method getHashcodeOffset.

public UDATA getHashcodeOffset(J9IndexableObjectPointer array) throws CorruptDataException {
    J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
    UDATA numberOfElements = getSizeInElements(array);
    J9ROMArrayClassPointer romArrayClass = J9ROMArrayClassPointer.cast(clazz.romClass());
    UDATA size = numberOfElements.leftShift(romArrayClass.arrayShape().bitAnd(0xFFFF).intValue());
    size = size.add(J9IndexableObjectContiguous.SIZEOF);
    return UDATA.roundToSizeofU32(size);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9ROMArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMArrayClassPointer) J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 14 with J9IndexableObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9IndexableObjectPointer in project openj9 by eclipse.

the class J9IndexableObjectHelper method getDataAsString.

public static String getDataAsString(J9IndexableObjectPointer array, int dumpLimit, int characterDumpLimit) throws CorruptDataException {
    StringWriter buf = new StringWriter();
    J9ClassPointer clazz = J9ObjectHelper.clazz(J9ObjectPointer.cast(array));
    char typeChar = J9ClassHelper.getName(clazz).charAt(1);
    int length = J9IndexableObjectHelper.size(array).intValue();
    int limit = 0;
    if (typeChar != 'C') {
        limit = dumpLimit;
    } else {
        limit = characterDumpLimit;
    }
    buf.write("{ ");
    int i;
    for (i = 0; i < Math.min(length, limit); i++) {
        Object data = J9IndexableObjectHelper.getData(array);
        switch(typeChar) {
            case 'B':
                buf.write("0x");
                buf.write(Integer.toHexString(((byte[]) data)[i]));
                break;
            case 'C':
                char ch = ((char[]) data)[i];
                if (ch > 31 && ch < 127) {
                    buf.write(ch);
                } else {
                    buf.write('?');
                }
                break;
            case 'D':
                buf.write(Double.toString(((double[]) data)[i]));
                break;
            case 'F':
                buf.write(Float.toString(((float[]) data)[i]));
                break;
            case 'I':
                buf.write("0x");
                buf.write(Integer.toHexString(((int[]) data)[i]));
                break;
            case 'J':
                buf.write("0x");
                buf.write(Long.toHexString(((long[]) data)[i]));
                break;
            case 'S':
                buf.write("0x");
                buf.write(Integer.toHexString(((short[]) data)[i]));
                break;
            case 'Z':
                buf.write(((boolean[]) data)[i] ? "true" : "false");
                break;
            case 'L':
            case '[':
                {
                    J9ObjectPointer item = ((J9ObjectPointer[]) data)[i];
                    if (null == item) {
                        buf.write("null");
                    } else {
                        buf.write("0x");
                        buf.write(Long.toHexString(item.longValue()));
                    }
                    break;
                }
            default:
                buf.write("?");
        }
        if (typeChar != 'C' && (i != length - 1)) {
            /* We aren't printing out a character and we aren't the last element */
            buf.write(", ");
        }
    }
    if (i != length) {
        /* We hit the limit */
        buf.write("... ");
    }
    buf.write(" }");
    return buf.toString();
}
Also used : StringWriter(java.io.StringWriter) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

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