Search in sources :

Example 1 with J9ExceptionInfoPointer

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

the class RomClassWalker method allSlotsInROMMethodDo.

private J9ROMMethodPointer allSlotsInROMMethodDo(J9ROMMethodPointer method) throws CorruptDataException {
    U32Pointer cursor;
    addObjectsasSlot(method);
    cursor = ROMHelp.J9_EXTENDED_MODIFIERS_ADDR_FROM_ROM_METHOD(method);
    allSlotsInBytecodesDo(method);
    if (J9ROMMethodHelper.hasExtendedModifiers(method)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "extendedModifiers");
        cursor = cursor.add(1);
    }
    if (J9ROMMethodHelper.hasGenericSignature(method)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, cursor, "methodUTF8");
        cursor = cursor.add(1);
    }
    if (J9ROMMethodHelper.hasExceptionInfo(method)) {
        J9ExceptionInfoPointer exceptionInfo = J9ExceptionInfoPointer.cast(cursor);
        long exceptionInfoSize = J9ExceptionInfo.SIZEOF + exceptionInfo.catchCount().longValue() * J9ExceptionHandler.SIZEOF + exceptionInfo.throwCount().longValue() * SelfRelativePointer.SIZEOF;
        allSlotsInExceptionInfoDo(exceptionInfo);
        cursor = cursor.addOffset(exceptionInfoSize);
    }
    if (J9ROMMethodHelper.hasMethodAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "methodAnnotation"));
    }
    if (J9ROMMethodHelper.hasParameterAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "parameterAnnotations"));
    }
    if (J9ROMMethodHelper.hasMethodTypeAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "method typeAnnotations"));
    }
    if (J9ROMMethodHelper.hasCodeTypeAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "code typeAnnotations"));
    }
    if (J9ROMMethodHelper.hasDefaultAnnotation(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "defaultAnnotation"));
    }
    if (J9ROMMethodHelper.hasDebugInfo(method)) {
        cursor = cursor.add(allSlotsInMethodDebugInfoDo(cursor));
    }
    if (J9ROMMethodHelper.hasStackMap(method)) {
        long stackMapSize = cursor.at(0).longValue();
        U8Pointer stackMap = U8Pointer.cast(cursor.add(1));
        classWalkerCallback.addSection(clazz, cursor, stackMapSize, "stackMap", true);
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "stackMapSize");
        allSlotsInStackMapDo(stackMap);
        cursor = cursor.addOffset(stackMapSize);
    }
    if (J9ROMMethodHelper.hasMethodParameters(method)) {
        cursor = cursor.add(allSlotsInMethodParametersDataDo(cursor));
    }
    return J9ROMMethodPointer.cast(cursor);
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer) J9ExceptionInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionInfoPointer)

Example 2 with J9ExceptionInfoPointer

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

the class RomClassWalker method allSlotsInExceptionInfoDo.

void allSlotsInExceptionInfoDo(J9ExceptionInfoPointer exceptionInfo) throws CorruptDataException {
    J9ExceptionHandlerPointer exceptionHandler;
    SelfRelativePointer throwNames;
    classWalkerCallback.addSlot(clazz, SlotType.J9_U16, exceptionInfo.catchCountEA(), "catchCount");
    classWalkerCallback.addSlot(clazz, SlotType.J9_U16, exceptionInfo.throwCountEA(), "throwCount");
    exceptionHandler = ROMHelp.J9EXCEPTIONINFO_HANDLERS(exceptionInfo);
    /* endian safe */
    for (int i = 0; i < exceptionInfo.catchCount().longValue(); i++) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, exceptionHandler.startPCEA(), "startPC");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, exceptionHandler.endPCEA(), "endPC");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, exceptionHandler.handlerPCEA(), "handlerPC");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, exceptionHandler.exceptionClassIndexEA(), "exceptionClassIndex");
        exceptionHandler = exceptionHandler.add(1);
    }
    /* not using J9EXCEPTIONINFO_THROWNAMES...we're already there */
    throwNames = SelfRelativePointer.cast(exceptionHandler);
    for (int i = 0; i < exceptionInfo.throwCount().intValue(); i++, throwNames = throwNames.add(1)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, throwNames, "throwNameUTF8");
    }
}
Also used : SelfRelativePointer(com.ibm.j9ddr.vm29.pointer.SelfRelativePointer) J9ExceptionHandlerPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionHandlerPointer)

Example 3 with J9ExceptionInfoPointer

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

the class J9BCUtil method j9bcutil_dumpRomMethod.

/*
	 * Dump a printed representation of the specified @romMethod.
	 */
/* note that methodIndex was not used and was removed */
public static void j9bcutil_dumpRomMethod(PrintStream out, J9ROMMethodPointer romMethod, J9ROMClassPointer romClass, long flags, int options) throws CorruptDataException {
    J9ROMNameAndSignaturePointer nameAndSignature = romMethod.nameAndSignature();
    J9UTF8Pointer name = nameAndSignature.name();
    J9UTF8Pointer signature = nameAndSignature.signature();
    J9ROMConstantPoolItemPointer constantPool = J9ROMClassHelper.constantPool(romClass);
    out.append("  Name: " + J9UTF8Helper.stringValue(name) + nl);
    out.append("  Signature: " + J9UTF8Helper.stringValue(signature) + nl);
    out.append(String.format("  Access Flags (%s): ", Long.toHexString(romMethod.modifiers().longValue())));
    dumpModifiers(out, romMethod.modifiers().longValue(), MODIFIERSOURCE_METHOD, INCLUDE_INTERNAL_MODIFIERS);
    out.append(nl);
    out.append("  Max Stack: " + romMethod.maxStack().longValue() + nl);
    if (J9ROMMethodHelper.hasExceptionInfo(romMethod)) {
        J9ExceptionInfoPointer exceptionData = ROMHelp.J9_EXCEPTION_DATA_FROM_ROM_METHOD(romMethod);
        long catchCount = exceptionData.catchCount().longValue();
        if (catchCount > 0) {
            J9ExceptionHandlerPointer handler = ROMHelp.J9EXCEPTIONINFO_HANDLERS(exceptionData);
            out.append(String.format("  Caught Exceptions (%d):", catchCount));
            out.append(nl);
            out.append("     start   end   handler   catch type" + nl);
            out.append("     -----   ---   -------   ----------" + nl);
            for (int i = 0; i < catchCount; i++) {
                out.append(String.format("     %d  %d  %d   ", handler.startPC().longValue(), handler.endPC().longValue(), handler.handlerPC().longValue()));
                long exceptionClassIndex = handler.exceptionClassIndex().longValue();
                if (exceptionClassIndex != 0) {
                    J9ROMConstantPoolItemPointer addOffset = constantPool.add(exceptionClassIndex);
                    J9ROMStringRefPointer romStringRefPointer = J9ROMStringRefPointer.cast(addOffset.longValue());
                    out.append(J9UTF8Helper.stringValue(romStringRefPointer.utf8Data()));
                } else {
                    out.append("(any)");
                }
                out.append(nl);
                handler = handler.add(1);
            }
        }
        long throwCount = exceptionData.throwCount().longValue();
        if (throwCount > 0) {
            out.append(String.format("  Thrown Exceptions (%d):", throwCount));
            out.append(nl);
            SelfRelativePointer currentThrowName = ROMHelp.J9EXCEPTIONINFO_THROWNAMES(exceptionData);
            for (long i = 0; i < throwCount; i++) {
                J9UTF8Pointer currentName = J9UTF8Pointer.cast(currentThrowName.get());
                out.append(J9UTF8Helper.stringValue(currentName));
            }
        }
    }
    if (romMethod.modifiers().anyBitsIn(J9CfrClassFile.CFR_ACC_NATIVE)) {
        dumpNative(out, romMethod, flags);
    } else {
        dumpBytecodes(out, romClass, romMethod, flags);
    }
    dumpMethodDebugInfo(out, romClass, romMethod, flags);
    dumpStackMapTable(out, romClass, romMethod, flags);
    dumpMethodParameters(out, romClass, romMethod, flags);
    if (0 != (BCUtil_DumpAnnotations & options)) {
        dumpMethodAnnotations(out, romMethod);
    }
    out.append(nl);
}
Also used : J9ROMNameAndSignaturePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer) J9ROMConstantPoolItemPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer) SelfRelativePointer(com.ibm.j9ddr.vm29.pointer.SelfRelativePointer) J9ROMStringRefPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) J9ExceptionHandlerPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionHandlerPointer) J9ExceptionInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionInfoPointer)

Aggregations

SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)2 J9ExceptionHandlerPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionHandlerPointer)2 J9ExceptionInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionInfoPointer)2 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)1 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)1 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)1 J9ROMStringRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer)1 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)1