Search in sources :

Example 1 with J9ExceptionHandlerPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionHandlerPointer 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 2 with J9ExceptionHandlerPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionHandlerPointer 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)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