Search in sources :

Example 16 with U32Pointer

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

the class RomClassWalker method allSlotsInROMFieldDo.

private int allSlotsInROMFieldDo(J9ROMFieldShapePointer field) throws CorruptDataException {
    int fieldLength = 0;
    U32Pointer initialValue;
    U32 modifiers;
    J9ROMNameAndSignaturePointer fieldNAS = field.nameAndSignature();
    classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, fieldNAS.nameEA(), "name");
    classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, fieldNAS.signatureEA(), "signature");
    classWalkerCallback.addSlot(clazz, SlotType.J9_U32, field.modifiersEA(), "modifiers");
    modifiers = field.modifiers();
    initialValue = U32Pointer.cast(field.add(1));
    if (modifiers.anyBitsIn(J9FieldFlagConstant)) {
        if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(initialValue), "fieldInitialValue");
            initialValue = initialValue.add(2);
        } else {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I32, initialValue, "fieldInitialValue");
            initialValue = initialValue.add(1);
        }
    }
    if (modifiers.anyBitsIn(J9FieldFlagHasGenericSignature)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, initialValue, "fieldGenSigUTF8");
        initialValue = initialValue.add(1);
    }
    if (modifiers.allBitsIn(J9FieldFlagHasFieldAnnotations)) {
        initialValue = initialValue.add(allSlotsInAnnotationDo(initialValue, "fieldAnnotation"));
    }
    fieldLength = (int) (initialValue.getAddress() - field.getAddress());
    classWalkerCallback.addSection(clazz, field, fieldLength, "field", true);
    return fieldLength;
}
Also used : J9ROMNameAndSignaturePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer) U32(com.ibm.j9ddr.vm29.types.U32) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Example 17 with U32Pointer

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

the class RomClassWalker method allSlotsInConstantPoolDo.

private void allSlotsInConstantPoolDo() throws CorruptDataException {
    J9ROMConstantPoolItemPointer constantPool;
    int index;
    U32Pointer cpShapeDescription;
    int constPoolCount;
    constantPool = J9ROMClassHelper.constantPool(romClass);
    cpShapeDescription = romClass.cpShapeDescription();
    if (cpShapeDescription.isNull()) {
        return;
    }
    constPoolCount = romClass.romConstantPoolCount().intValue();
    PointerPointer cpEntry = PointerPointer.cast(J9ROMClassHelper.constantPool(romClass));
    // The spaces at the end of "Constant Pool" are important since the
    // regions are sorted
    // by address and size, but when they are equal they are sorted by
    // longest name and "Constant Pool" has to come first
    classWalkerCallback.addSection(clazz, constantPool, constPoolCount * U64.SIZEOF, "constantPool              ", true);
    for (index = 0; index < constPoolCount; index++) {
        long shapeDesc = ConstantPoolHelpers.J9_CP_TYPE(cpShapeDescription, index);
        if (shapeDesc == J9CPTYPE_CLASS) {
            J9ROMStringRefPointer ref = J9ROMStringRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, ref.utf8DataEA(), "cpFieldUtf8");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.cpTypeEA(), "cpFieldType");
        } else if ((shapeDesc == J9CPTYPE_STRING) || (shapeDesc == J9CPTYPE_ANNOTATION_UTF8)) {
            J9ROMStringRefPointer ref = J9ROMStringRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, ref.utf8DataEA(), "cpFieldUtf8");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.cpTypeEA(), "cpFieldType");
        } else if (shapeDesc == J9CPTYPE_INT) {
            J9ROMConstantPoolItemPointer ref = J9ROMConstantPoolItemPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.slot1EA(), "cpFieldInt");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.slot2EA(), "cpFieldIntUnused");
        } else if (shapeDesc == J9CPTYPE_FLOAT) {
            J9ROMConstantPoolItemPointer ref = J9ROMConstantPoolItemPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.slot1EA(), "cpFieldFloat");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.slot2EA(), "cpFieldFloatUnused");
        } else if (shapeDesc == J9CPTYPE_LONG) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(cpEntry), "cpField8");
        } else if (shapeDesc == J9CPTYPE_DOUBLE) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(cpEntry), "cpField8");
        } else if (shapeDesc == J9CPTYPE_FIELD) {
            J9ROMFieldRefPointer ref = J9ROMFieldRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_SRPNAS, ref.nameAndSignatureEA(), "cpFieldNAS");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.classRefCPIndexEA(), "cpFieldClassRef");
        } else if ((shapeDesc == J9CPTYPE_HANDLE_METHOD) || (shapeDesc == J9CPTYPE_STATIC_METHOD) || (shapeDesc == J9CPTYPE_INSTANCE_METHOD) || (shapeDesc == J9CPTYPE_INTERFACE_METHOD)) {
            J9ROMMethodRefPointer ref = J9ROMMethodRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_SRPNAS, ref.nameAndSignatureEA(), "cpFieldNAS");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.classRefCPIndexEA(), "cpFieldClassRef");
        } else if (shapeDesc == J9CPTYPE_METHOD_TYPE) {
            J9ROMMethodTypeRefPointer ref = J9ROMMethodTypeRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, ref.signatureEA(), "signature");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.cpTypeEA(), "cpType");
        } else if (shapeDesc == J9CPTYPE_METHODHANDLE) {
            J9ROMMethodHandleRefPointer ref = J9ROMMethodHandleRefPointer.cast(cpEntry);
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.methodOrFieldRefIndexEA(), "methodOrFieldRefIndex");
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, ref.handleTypeAndCpTypeEA(), "handleTypeAndCpType");
        } else if ((shapeDesc == J9CPTYPE_UNUSED) || (shapeDesc == J9CPTYPE_UNUSED8)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(cpEntry), "cpFieldUnused");
        }
        cpEntry = cpEntry.addOffset(J9ROMConstantPoolItem.SIZEOF);
    }
}
Also used : J9ROMFieldRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldRefPointer) J9ROMMethodRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodRefPointer) J9ROMConstantPoolItemPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9ROMMethodHandleRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodHandleRefPointer) J9ROMStringRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer) J9ROMMethodTypeRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodTypeRefPointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Example 18 with U32Pointer

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

the class RomClassWalker method allSlotsInMethodParametersDataDo.

private long allSlotsInMethodParametersDataDo(U32Pointer cursor) throws CorruptDataException {
    J9MethodParametersDataPointer methodParametersData = J9MethodParametersDataPointer.cast(cursor);
    J9MethodParameterPointer parameters = methodParametersData.parameters();
    long methodParametersSize = ROMHelp.J9_METHOD_PARAMS_SIZE_FROM_NUMBER_OF_PARAMS(methodParametersData.parameterCount().longValue());
    long padding = U32.SIZEOF - (methodParametersSize % U32.SIZEOF);
    long size = 0;
    if (padding == U32.SIZEOF) {
        padding = 0;
    }
    size = methodParametersSize + padding;
    classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, methodParametersData.parameterCountEA(), "parameterCount");
    for (int i = 0; i < methodParametersData.parameterCount().longValue(); i++) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, parameters.nameEA(), "methodParameterName");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U16, parameters.flagsEA(), "methodParameterFlag");
    }
    cursor = cursor.addOffset(methodParametersSize);
    for (; padding > 0; padding--) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U8, cursor, "MethodParameters padding");
        cursor.addOffset(1);
    }
    classWalkerCallback.addSection(clazz, methodParametersData, size, "Method Parameters", true);
    return size / U32.SIZEOF;
}
Also used : J9MethodParametersDataPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodParametersDataPointer) J9MethodParameterPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodParameterPointer)

Example 19 with U32Pointer

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

the class RomClassWalker method allSlotsInAnnotationDo.

int allSlotsInAnnotationDo(U32Pointer annotation, String annotationSectionName) throws CorruptDataException {
    int increment = 0;
    int annotationLength = annotation.at(0).intValue();
    /* determine how many U_32 sized chunks to increment initialValue by
		 * NOTE: annotation length is U_32 and does not include the length field itself
		 * annotations are padded to U_32 which is also not included in the length field*/
    int padding = U32.SIZEOF - (annotationLength % U32.SIZEOF);
    increment = annotationLength / U32.SIZEOF;
    if (U32.SIZEOF == padding) {
        padding = 0;
    }
    if (padding > 0) {
        increment++;
    }
    classWalkerCallback.addSlot(clazz, SlotType.J9_U32, annotation, "annotation length");
    int count = annotationLength;
    U8Pointer cursor = U8Pointer.cast(annotation.add(1));
    for (; count > 0; count--) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U8, cursor, "annotation data");
        cursor = cursor.add(1);
    }
    count = padding;
    for (; count > 0; count--) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U8, cursor, "annotation padding");
        cursor = cursor.add(1);
    }
    /* move past the annotation length */
    increment += 1;
    classWalkerCallback.addSection(clazz, annotation, increment * U32.SIZEOF, annotationSectionName, true);
    return increment;
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 20 with U32Pointer

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

the class J9BCUtil method dumpCPShapeDescription.

private static void dumpCPShapeDescription(PrintStream out, J9ROMClassPointer romClass, long flags) throws CorruptDataException {
    U32Pointer cpDescription = romClass.cpShapeDescription();
    long descriptionLong;
    long i, j, k, numberOfLongs;
    char[] symbols = new char[] { '.', 'C', 'S', 'I', 'F', 'J', 'D', 'i', 's', 'v', 'x', 'y', 'z', 'T', 'H', 'A', 'x', 'v' };
    symbols[(int) J9CPTYPE_UNUSED8] = '.';
    numberOfLongs = (romClass.romConstantPoolCount().longValue() + J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32 - 1) / J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32;
    out.append("CP Shape Description:" + nl);
    k = romClass.romConstantPoolCount().longValue();
    for (i = 0; i < numberOfLongs; i++) {
        out.append("  ");
        descriptionLong = cpDescription.at(i).longValue();
        for (j = 0; j < J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32; j++, k--) {
            if (k == 0)
                break;
            out.append(String.format("%c ", symbols[(int) (descriptionLong & J9ConstantPool.J9_CP_DESCRIPTION_MASK)]));
            descriptionLong >>= J9ConstantPool.J9_CP_BITS_PER_DESCRIPTION;
        }
        out.append(nl);
    }
    out.append(nl);
}
Also used : U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Aggregations

U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)19 U32 (com.ibm.j9ddr.vm29.types.U32)7 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)4 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)2 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)2 J9ConstantPoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ConstantPoolPointer)2 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)2 J9RAMClassRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMClassRefPointer)2 J9RAMMethodHandleRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodHandleRefPointer)2 J9RAMMethodTypeRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMMethodTypeRefPointer)2 J9RAMStringRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RAMStringRefPointer)2 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)2 J9ROMFieldRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldRefPointer)2 J9ROMMethodHandleRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodHandleRefPointer)2 J9ROMMethodRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodRefPointer)2 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1