Search in sources :

Example 11 with J9UTF8Pointer

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

the class J9BCUtil method dumpMethodParameters.

private static void dumpMethodParameters(PrintStream out, J9ROMClassPointer romclass, J9ROMMethodPointer romMethod, long flags) throws CorruptDataException {
    J9MethodParametersDataPointer methodParameters = ROMHelp.getMethodParametersFromROMMethod(romMethod);
    if (methodParameters != J9MethodParametersDataPointer.NULL) {
        J9MethodParameterPointer parameters = methodParameters.parameters();
        out.println(String.format("  Method Parameters (%d):\n", methodParameters.parameterCount().longValue()));
        for (int i = 0; i < methodParameters.parameterCount().longValue(); i++) {
            J9UTF8Pointer name = J9UTF8Pointer.cast(parameters.nameEA().get());
            long parameterFlags = parameters.flags().longValue();
            if (name.isNull()) {
                out.print("    <no name>");
            } else {
                out.print("    " + J9UTF8Helper.stringValue(name));
            }
            out.print(String.format("    0x%x ( ", parameterFlags));
            dumpModifiers(out, parameterFlags, ONLY_SPEC_MODIFIERS, MODIFIERSOURCE_METHODPARAMETER);
            out.println(" )\n");
        }
        out.println("\n");
    }
}
Also used : J9MethodParametersDataPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodParametersDataPointer) J9MethodParameterPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodParameterPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Example 12 with J9UTF8Pointer

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

the class J9BCUtil method dumpStackMapSlots.

static U8Pointer dumpStackMapSlots(PrintStream out, J9ROMClassPointer classfile, U8Pointer slotData, long slotCount) throws CorruptDataException {
    int slotType;
    String[] slotTypes = { "top", "int", "float", "double", "long", "null", "uninitialized_this" };
    String[] primitiveArrayTypes = { "I", "F", "D", "J", "S", "B", "C", "Z" };
    out.print("(");
    for (int i = 0; i < slotCount; i++) {
        slotType = slotData.at(0).intValue();
        slotData = slotData.add(1);
        if (slotType <= 0x06) /*FR_STACKMAP_TYPE_INIT_OBJECT*/
        {
            out.print(slotTypes[slotType]);
        } else if (slotType == 0x07) /* CFR_STACKMAP_TYPE_OBJECT */
        {
            long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
            J9ROMConstantPoolItemPointer constantPool = ConstantPoolHelpers.J9_ROM_CP_FROM_ROM_CLASS(classfile);
            J9ROMStringRefPointer item = J9ROMStringRefPointer.cast(constantPool.add(index));
            J9UTF8Pointer data = item.utf8Data();
            String s = J9UTF8Helper.stringValue(data);
            if (s.charAt(0) != '[') {
                out.print("L");
            }
            out.print(s);
            slotData = slotData.add(2);
        } else if (slotType == 0x08) /* CFR_STACKMAP_TYPE_NEW_OBJECT */
        {
            long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
            out.print("this pc:" + index);
            slotData = slotData.add(2);
        } else {
            /* J9-ism: primitive array types start at slotType 9 and arity is really NEXT_U16()+1*/
            StringBuffer primitiveType = new StringBuffer("[");
            long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
            while (index-- > 0) {
                primitiveType.append("[");
            }
            primitiveType.append(primitiveArrayTypes[slotType - 9]);
            out.print(primitiveType.toString());
            slotData = slotData.add(2);
        }
        if (i != (slotCount - 1)) {
            out.print(", ");
        }
    }
    out.print(")");
    return slotData;
}
Also used : J9ROMConstantPoolItemPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer) J9ROMStringRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer) U16(com.ibm.j9ddr.vm29.types.U16) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Example 13 with J9UTF8Pointer

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

the class J9BCUtil method dumpMethodAnnotations.

private static void dumpMethodAnnotations(PrintStream out, J9ROMMethodPointer romMethod) throws CorruptDataException {
    U32Pointer methodAnnotationData = ROMHelp.getMethodAnnotationsDataFromROMMethod(romMethod);
    U32Pointer parametersAnnotationData = ROMHelp.getParameterAnnotationsDataFromROMMethod(romMethod);
    U32Pointer defaultAnnotationData = ROMHelp.getDefaultAnnotationDataFromROMMethod(romMethod);
    U32Pointer methodTypeAnnotations = ROMHelp.getMethodTypeAnnotationDataFromROMMethod(romMethod);
    U32Pointer codeTypeAnnotations = ROMHelp.getCodeTypeAnnotationDataFromROMMethod(romMethod);
    if ((!methodAnnotationData.isNull()) || (!parametersAnnotationData.isNull()) || (!defaultAnnotationData.isNull())) {
        J9ROMNameAndSignaturePointer nameAndSignature = romMethod.nameAndSignature();
        J9UTF8Pointer name = nameAndSignature.name();
        J9UTF8Pointer signature = nameAndSignature.signature();
        out.append("      Name: " + J9UTF8Helper.stringValue(name) + nl);
        out.append("      Signature: " + J9UTF8Helper.stringValue(signature) + nl);
    }
    if (!methodAnnotationData.isNull()) {
        U32 length = methodAnnotationData.at(0);
        U32Pointer data = methodAnnotationData.add(1);
        out.append(String.format("      Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
    }
    if (!parametersAnnotationData.isNull()) {
        U32 length = parametersAnnotationData.at(0);
        U32Pointer data = parametersAnnotationData.add(1);
        out.append(String.format("      Parameters Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
    }
    if (!defaultAnnotationData.isNull()) {
        U32 length = defaultAnnotationData.at(0);
        U32Pointer data = defaultAnnotationData.add(1);
        out.append(String.format("      Default Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
    }
    if (!methodTypeAnnotations.isNull()) {
        U32 length = methodTypeAnnotations.at(0);
        U32Pointer data = methodTypeAnnotations.add(1);
        out.append(String.format("      Method Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
    }
    if (!codeTypeAnnotations.isNull()) {
        U32 length = codeTypeAnnotations.at(0);
        U32Pointer data = codeTypeAnnotations.add(1);
        out.append(String.format("      Code Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
    }
}
Also used : J9ROMNameAndSignaturePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer) U32(com.ibm.j9ddr.vm29.types.U32) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Example 14 with J9UTF8Pointer

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

the class J9ObjectStructureFormatter method printJ9ObjectFields.

private void printJ9ObjectFields(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, J9ObjectPointer localObject) throws CorruptDataException {
    J9ClassPointer instanceClass = localClazz;
    long superclassIndex;
    long depth;
    J9ClassPointer previousSuperclass = J9ClassPointer.NULL;
    boolean lockwordPrinted = false;
    if (J9BuildFlags.thr_lockNursery) {
        lockwordPrinted = false;
    }
    /* print individual fields */
    J9UTF8Pointer classNameUTF = instanceClass.romClass().className();
    padding(out, tabLevel);
    out.println(String.format("struct J9Class* clazz = !j9class 0x%X   // %s", localClazz.getAddress(), J9UTF8Helper.stringValue(classNameUTF)));
    padding(out, tabLevel);
    out.println(String.format("Object flags = %s;", J9ObjectHelper.flags(localObject).getHexValue()));
    if (!J9BuildFlags.thr_lockNursery) {
        UDATA lockword = J9ObjectHelper.monitor(localObject);
        if (lockword != null) {
            padding(out, tabLevel);
            out.println(String.format("j9objectmonitor_t monitor = %s;", lockword.getHexValue()));
        }
    }
    depth = J9ClassHelper.classDepth(instanceClass).longValue();
    for (superclassIndex = 0; superclassIndex <= depth; superclassIndex++) {
        J9ClassPointer superclass;
        if (superclassIndex == depth) {
            superclass = instanceClass;
        } else {
            superclass = J9ClassPointer.cast(instanceClass.superclasses().at(superclassIndex));
        }
        U32 flags = new U32(J9VM_FIELD_OFFSET_WALK_INCLUDE_INSTANCE | J9VM_FIELD_OFFSET_WALK_INCLUDE_HIDDEN);
        Iterator<J9ObjectFieldOffset> iterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(superclass.romClass(), instanceClass, previousSuperclass, flags);
        while (iterator.hasNext()) {
            J9ObjectFieldOffset result = iterator.next();
            boolean printField = true;
            boolean isHiddenField = result.isHidden();
            if (J9BuildFlags.thr_lockNursery) {
                boolean isLockword = (isHiddenField && ((result.getOffsetOrAddress().add(J9Object.SIZEOF).eq(superclass.lockOffset()))));
                if (isLockword) {
                    /* Print the lockword field if it is indeed the lockword for this instanceClass and we haven't printed it yet. */
                    printField = (!lockwordPrinted && (instanceClass.lockOffset().eq(superclass.lockOffset())));
                    if (printField) {
                        lockwordPrinted = true;
                    }
                }
            }
            if (printField) {
                printObjectField(out, tabLevel, localClazz, dataStart, superclass, result);
                out.println();
            }
        }
        previousSuperclass = superclass;
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ObjectFieldOffset(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Aggregations

J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)12 U32 (com.ibm.j9ddr.vm29.types.U32)6 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)4 CorruptDataException (com.ibm.j9ddr.CorruptDataException)3 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)3 UDATA (com.ibm.j9ddr.vm29.types.UDATA)3 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)2 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)2 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)2 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)2 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)2 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)2 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)2 J9ROMFieldShapePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer)2 J9ROMStringRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer)2 U16 (com.ibm.j9ddr.vm29.types.U16)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 PatternString (com.ibm.j9ddr.util.PatternString)1 J9ROMFieldShapeIterator (com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator)1 J9ROMClassAndMethod (com.ibm.j9ddr.vm29.j9.walkers.J9ROMClassAndMethod)1