Search in sources :

Example 1 with U16

use of com.ibm.j9ddr.vm29.types.U16 in project openj9 by eclipse.

the class RomClassWalker method allSlotsInMethodDebugInfoDo.

long allSlotsInMethodDebugInfoDo(U32Pointer cursor) throws CorruptDataException {
    J9MethodDebugInfoPointer methodDebugInfo;
    U8Pointer currentLineNumberPtr;
    /* if data is out of line, then the size of the data inline in the method is a single SRP in sizeof(U_32 increments), currently assuming J9SRP is U_32 aligned*/
    long inlineSize = SelfRelativePointer.SIZEOF / U32.SIZEOF;
    long sectionSizeBytes = 0;
    boolean inlineDebugExtension = (1 == (cursor.at(0).intValue() & 1));
    /* check for low tag to indicate inline or out of line debug information */
    if (inlineDebugExtension) {
        methodDebugInfo = J9MethodDebugInfoPointer.cast(cursor);
        /* set the inline size to stored size in terms of U_32
			 * NOTE: stored size is aligned on a U32
			 * tag bit will be dropped by the '/' operation */
        inlineSize = cursor.at(0).intValue() / U32.SIZEOF;
        sectionSizeBytes = inlineSize * U32.SIZEOF;
    } else {
        methodDebugInfo = J9MethodDebugInfoPointer.cast(SelfRelativePointer.cast(cursor).get());
        if (AlgorithmVersion.getVersionOf("VM_LINE_NUMBER_TABLE_VERSION").getAlgorithmVersion() < 1) {
            sectionSizeBytes = J9MethodDebugInfo.SIZEOF + (J9MethodDebugInfoHelper.getLineNumberCount(methodDebugInfo).intValue() * U32.SIZEOF);
        } else {
            sectionSizeBytes = J9MethodDebugInfo.SIZEOF + J9MethodDebugInfoHelper.getLineNumberCompressedSize(methodDebugInfo).intValue();
            /* When out of line debug information, align on U_16 */
            sectionSizeBytes = (sectionSizeBytes + U16.SIZEOF - 1) & ~(U16.SIZEOF - 1);
        }
    }
    if (!inlineDebugExtension) {
        if (inlineSize == 1) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, cursor, "SRP to DebugInfo");
            classWalkerCallback.addSection(clazz, cursor, inlineSize * U32.SIZEOF, "methodDebugInfo out of line", true);
        }
    }
    classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, methodDebugInfo.srpToVarInfoEA(), "SizeOfDebugInfo(low tagged)");
    if (AlgorithmVersion.getVersionOf("VM_LINE_NUMBER_TABLE_VERSION").getAlgorithmVersion() < 1) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.lineNumberCountEA(), "lineNumberCount");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.varInfoCountEA(), "varInfoCount");
        J9LineNumberPointer lineNumberPtr = J9MethodDebugInfoHelper.getLineNumberTableForROMClass(methodDebugInfo);
        if (lineNumberPtr.notNull()) {
            for (int j = 0; j < methodDebugInfo.lineNumberCount().intValue(); j++, lineNumberPtr = lineNumberPtr.add(1)) {
                // FIXME : Silo
                // classWalkerCallback.addSlot(clazz, SlotType.J9_U16, lineNumberPtr.offsetLocationEA(), "offsetLocation");
                classWalkerCallback.addSlot(clazz, SlotType.J9_U16, lineNumberPtr.lineNumberEA(), "lineNumber");
            }
        }
    } else {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.lineNumberCountEA(), "lineNumberCount(encoded)");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.varInfoCountEA(), "varInfoCount");
        if (methodDebugInfo.lineNumberCount().allBitsIn(1)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, U32Pointer.cast(methodDebugInfo.add(1)), "compressed line number size");
        }
        currentLineNumberPtr = J9MethodDebugInfoHelper.getCompressedLineNumberTableForROMClassV1(methodDebugInfo);
        if (currentLineNumberPtr.notNull()) {
            for (int j = 0; j < J9MethodDebugInfoHelper.getLineNumberCompressedSize(methodDebugInfo).intValue(); j++) {
                classWalkerCallback.addSlot(clazz, SlotType.J9_U8, currentLineNumberPtr, "pc, lineNumber compressed");
                currentLineNumberPtr = currentLineNumberPtr.add(1);
            }
        }
    }
    U8Pointer variableTable = OptInfo.getV1VariableTableForMethodDebugInfo(methodDebugInfo);
    if (variableTable.notNull()) {
        LocalVariableTableIterator variableInfoValuesIterator = LocalVariableTableIterator.localVariableTableIteratorFor(methodDebugInfo);
        U8Pointer start = variableInfoValuesIterator.getLocalVariableTablePtr();
        while (variableInfoValuesIterator.hasNext()) {
            LocalVariableTable values = variableInfoValuesIterator.next();
            // Need to walk the name and signature to add them to the UTF8 section
            classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getName(), "name");
            classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getSignature(), "getSignature");
            if (values.getGenericSignature().notNull()) {
                classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getGenericSignature(), "getGenericSignature");
            }
        }
        U8Pointer end = variableInfoValuesIterator.getLocalVariableTablePtr();
        int localVariableSectionSize = end.sub(start).intValue();
        for (int j = 0; j < localVariableSectionSize; j++) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_U8, start, "variableInfo compressed");
            start = start.add(1);
        }
        classWalkerCallback.addSection(clazz, variableTable, localVariableSectionSize, "variableInfo" + (inlineDebugExtension ? " Inline" : ""), inlineDebugExtension);
    }
    classWalkerCallback.addSection(clazz, methodDebugInfo, sectionSizeBytes, "methodDebugInfo" + (inlineDebugExtension ? " Inline" : ""), inlineDebugExtension);
    return inlineSize;
}
Also used : LocalVariableTable(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable) J9MethodDebugInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodDebugInfoPointer) LocalVariableTableIterator(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) J9LineNumberPointer(com.ibm.j9ddr.vm29.pointer.generated.J9LineNumberPointer)

Example 2 with U16

use of com.ibm.j9ddr.vm29.types.U16 in project openj9 by eclipse.

the class RomClassWalker method allSlotsInStaticSplitMethodRefIndexesDo.

void allSlotsInStaticSplitMethodRefIndexesDo() throws CorruptDataException {
    int count = romClass.staticSplitMethodRefCount().intValue();
    U16Pointer cursor = romClass.staticSplitMethodRefIndexes();
    if (count > 0) {
        classWalkerCallback.addSection(clazz, cursor, count * U16.SIZEOF, "staticSplitMethodRefIndexes", true);
        for (int i = 0; i < count; i++) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_U16, cursor.add(i), "cpIndex");
        }
    }
}
Also used : U16Pointer(com.ibm.j9ddr.vm29.pointer.U16Pointer)

Example 3 with U16

use of com.ibm.j9ddr.vm29.types.U16 in project openj9 by eclipse.

the class ByteCodeDumper method _NEXT_BE_U16.

private static U16 _NEXT_BE_U16() throws CorruptDataException {
    U16 a = new U16(bcIndex.at(0)).leftShift(8);
    U16 b = new U16(bcIndex.at(1));
    U16 value = a.bitOr(b);
    bcIndex = bcIndex.add(2);
    return value;
}
Also used : U16(com.ibm.j9ddr.vm29.types.U16)

Example 4 with U16

use of com.ibm.j9ddr.vm29.types.U16 in project openj9 by eclipse.

the class ByteCodeDumper method _NEXT_LE_U16.

private static U16 _NEXT_LE_U16() throws CorruptDataException {
    U16 a = new U16(bcIndex.at(0));
    U16 b = new U16(bcIndex.at(1)).leftShift(8);
    U16 value = a.bitOr(b);
    bcIndex = bcIndex.add(2);
    return value;
}
Also used : U16(com.ibm.j9ddr.vm29.types.U16)

Example 5 with U16

use of com.ibm.j9ddr.vm29.types.U16 in project openj9 by eclipse.

the class J9BCUtil method dumpStackMapTable.

private static void dumpStackMapTable(PrintStream out, J9ROMClassPointer romclass, J9ROMMethodPointer romMethod, long flags) throws CorruptDataException {
    U32Pointer stackMapMethod = ROMHelp.getStackMapFromROMMethod(romMethod);
    U16 stackMapCount;
    U8Pointer stackMapData;
    long mapPC = -1;
    long mapType;
    if (stackMapMethod.notNull()) {
        stackMapData = U8Pointer.cast(stackMapMethod.add(1));
        stackMapCount = new U16(stackMapData.at(0)).leftShift(8).bitOr(stackMapData.at(1));
        stackMapData = stackMapData.add(2);
        out.println("\n  StackMapTable\n    Stackmaps(" + stackMapCount.intValue() + "):");
        for (int i = 0; i < stackMapCount.intValue(); i++) {
            mapPC++;
            mapType = stackMapData.at(0).longValue();
            stackMapData = stackMapData.add(1);
            if (mapType < 64) {
                mapPC += mapType;
                out.println("      pc: " + mapPC + " same");
            } else if (mapType < 128) {
                mapPC += (mapType - 64);
                out.print("      pc: " + mapPC + " same_locals_1_stack_item: ");
                stackMapData = dumpStackMapSlots(out, romclass, stackMapData, 1);
                out.println();
            } else if (mapType < 247) {
                out.println("      UNKNOWN FRAME TAG: (" + mapType + ")\n");
            } else if (mapType == 247) {
                long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                mapPC += offset;
                out.print("      pc: " + mapPC + " same_locals_1_stack_item_extended: ");
                stackMapData = dumpStackMapSlots(out, romclass, stackMapData, 1);
                out.println();
            } else if (mapType < 251) {
                long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                mapPC += offset;
                out.println("      pc: " + mapPC + " chop " + (251 - mapType));
            } else if (mapType == 251) {
                long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                mapPC += offset;
                out.println("      pc: " + mapPC + " same_extended\n");
            } else if (mapType < 255) {
                long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                mapPC += offset;
                out.print("      pc: " + mapPC + " append: ");
                stackMapData = dumpStackMapSlots(out, romclass, stackMapData, (mapType - 251));
                out.println();
            } else if (mapType == 255) {
                long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                mapPC += offset;
                out.print("      pc: " + mapPC + " full, local(s): ");
                offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                stackMapData = dumpStackMapSlots(out, romclass, stackMapData, offset);
                out.print(", stack: ");
                offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
                stackMapData = stackMapData.add(2);
                stackMapData = dumpStackMapSlots(out, romclass, stackMapData, offset);
                out.println();
            }
        }
    }
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) U16(com.ibm.j9ddr.vm29.types.U16) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer)

Aggregations

U16 (com.ibm.j9ddr.vm29.types.U16)8 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)3 U16Pointer (com.ibm.j9ddr.vm29.pointer.U16Pointer)2 U32 (com.ibm.j9ddr.vm29.types.U32)2 U8 (com.ibm.j9ddr.vm29.types.U8)2 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 LocalVariableTable (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable)1 LocalVariableTableIterator (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator)1 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)1 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9LineNumberPointer (com.ibm.j9ddr.vm29.pointer.generated.J9LineNumberPointer)1 J9MethodDebugInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodDebugInfoPointer)1 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)1 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)1 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)1 J9ROMStringRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMStringRefPointer)1 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)1