Search in sources :

Example 6 with UDATAPointer

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

the class RamClassWalker method allSlotsInRAMStaticsDo.

private void allSlotsInRAMStaticsDo() throws CorruptDataException {
    if (ramClass.ramStatics().isNull()) {
        return;
    }
    Iterator<?> ofoIterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(ramClass, J9ClassHelper.superclass(ramClass), new U32(J9ROMFieldOffsetWalkState.J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC));
    J9ObjectFieldOffset fields = null;
    while (ofoIterator.hasNext()) {
        fields = (J9ObjectFieldOffset) ofoIterator.next();
        J9ROMFieldShapePointer field = fields.getField();
        String info = fields.getName();
        U32 modifiers = field.modifiers();
        UDATAPointer fieldAddress = ramClass.ramStatics().addOffset(fields.getOffsetOrAddress());
        String additionalInfo = modifiers.anyBitsIn(J9FieldFlagObject) ? "!j9object" : "";
        if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_I64, I64Pointer.cast(fieldAddress), info, additionalInfo);
        } else {
            classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, fieldAddress, info, additionalInfo);
        }
    }
    U32 staticSlotCount = ramClass.romClass().objectStaticCount().add(ramClass.romClass().singleScalarStaticCount());
    if (J9BuildFlags.env_data64) {
        staticSlotCount = staticSlotCount.add(ramClass.romClass().doubleScalarStaticCount());
    } else {
        staticSlotCount = staticSlotCount.add(1).bitAnd(~1L).add(ramClass.romClass().doubleScalarStaticCount().mult(2));
    }
    UDATA size = Scalar.convertSlotsToBytes(new UDATA(staticSlotCount));
    classWalkerCallback.addSection(clazz, ramClass.ramStatics(), size.longValue(), "Ram static", false);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9_CP_DESCRIPTIONS_PER_U32(com.ibm.j9ddr.vm29.structure.J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) J9ROMFieldShapePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer) J9ObjectFieldOffset(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)

Example 7 with UDATAPointer

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

the class J9StaticsCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        if (args.length != 1) {
            CommandUtils.dbgPrint(out, "Usage: !j9statics <classAddress>\n");
            return;
        }
        long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
        J9ClassPointer ramClass = J9ClassPointer.cast(address);
        J9ROMClassPointer romClass = ramClass.romClass();
        J9UTF8Pointer className = romClass.className();
        CommandUtils.dbgPrint(out, "Static fields in %s:\n", J9UTF8Helper.stringValue(className));
        Iterator<J9ObjectFieldOffset> ofoIterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(ramClass, J9ClassHelper.superclass(ramClass), new U32(J9ROMFieldOffsetWalkState.J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC));
        while (ofoIterator.hasNext()) {
            J9ObjectFieldOffset fieldOffset = ofoIterator.next();
            J9ROMFieldShapePointer field = fieldOffset.getField();
            String name = J9ROMFieldShapeHelper.getName(field);
            String sig = J9ROMFieldShapeHelper.getSignature(field);
            UDATAPointer fieldAddress = ramClass.ramStatics().addOffset(fieldOffset.getOffsetOrAddress());
            switch(sig.charAt(0)) {
                case 'L':
                case '[':
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticstringfieldshape %s) = !j9object %s\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), fieldAddress.at(0).getHexValue());
                    break;
                case 'D':
                    DoublePointer doublePointer = DoublePointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticdoublefieldshape %s) = %s (%s)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), doublePointer.getHexValue(), new Double(doublePointer.doubleAt(0)).toString());
                    break;
                case 'F':
                    FloatPointer floatPointer = FloatPointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s (%s)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), floatPointer.getHexValue(), new Float(floatPointer.floatAt(0)).toString());
                    break;
                case 'J':
                    I64Pointer longPointer = I64Pointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticdoublefieldshape %s) = %s (%d)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), longPointer.getHexValue(), longPointer.at(0).longValue());
                    break;
                case 'I':
                    I32Pointer intPointer = I32Pointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s (%d)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), intPointer.getHexValue(), intPointer.at(0).intValue());
                    break;
                case 'B':
                    I8Pointer bytePointer = I8Pointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s (%s)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), bytePointer.getHexValue(), bytePointer.at(0).byteValue());
                    break;
                case 'S':
                    I16Pointer shortPointer = I16Pointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s (%d)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), shortPointer.getHexValue(), shortPointer.at(0).shortValue());
                    break;
                case 'Z':
                    BoolPointer booleanPointer = BoolPointer.cast(fieldAddress);
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s (%s)\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), booleanPointer.getHexValue(), booleanPointer.boolAt(0) ? "true" : "false");
                    break;
                default:
                    CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticsinglefieldshape %s) = %s\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), fieldAddress.at(0).getHexValue());
                    break;
            }
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : BoolPointer(com.ibm.j9ddr.vm29.pointer.BoolPointer) I64Pointer(com.ibm.j9ddr.vm29.pointer.I64Pointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) DoublePointer(com.ibm.j9ddr.vm29.pointer.DoublePointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ObjectFieldOffset(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset) CorruptDataException(com.ibm.j9ddr.CorruptDataException) I16Pointer(com.ibm.j9ddr.vm29.pointer.I16Pointer) I32Pointer(com.ibm.j9ddr.vm29.pointer.I32Pointer) I8Pointer(com.ibm.j9ddr.vm29.pointer.I8Pointer) U32(com.ibm.j9ddr.vm29.types.U32) FloatPointer(com.ibm.j9ddr.vm29.pointer.FloatPointer) J9ROMFieldShapePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Example 8 with UDATAPointer

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

the class J9VTablesCommand method run.

public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
    try {
        final J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9ClassPointer ramClass;
        UDATA vTableSlotCount;
        // UDATA  jitVTableSlotCount;
        UDATAPointer jitVTable = UDATAPointer.NULL;
        UDATAPointer vTable;
        long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
        ramClass = J9ClassPointer.cast(address);
        vTable = J9ClassHelper.vTable(ramClass);
        vTableSlotCount = vTable.at(0);
        if (J9BuildFlags.interp_nativeSupport) {
            if (!vm.jitConfig().isNull()) {
                jitVTable = UDATAPointer.cast(U8Pointer.cast(ramClass).sub((vTableSlotCount.longValue() + 1) * UDATA.SIZEOF));
            // jitVTableSlotCount = vTableSlotCount.sub(1);
            }
        }
        CommandUtils.dbgPrint(out, String.format("VTable for j9class %s  (size=%d - 1 for skipped resolve method)\n", ramClass.getHexAddress(), vTableSlotCount.longValue()));
        CommandUtils.dbgPrint(out, String.format("\tInterpreted%s\n", (!jitVTable.isNull()) ? "\t\tJitted\n" : ""));
        /*	First entry in vtable is the vtable count.
			 * 	Second entry is the magic method reference.
			 *  Skip both and start from the third element in vTable which is the first virtual method reference.
			 **/
        for (long i = 2; i < vTableSlotCount.longValue() + 1; i++) {
            String name = J9MethodHelper.getName(J9MethodPointer.cast(vTable.at(i)));
            String intAddr = U8Pointer.cast(vTable.at(i)).getHexAddress();
            if (!jitVTable.isNull()) {
                String jitAddr = U8Pointer.cast(jitVTable.at(vTableSlotCount.sub(i))).getHexAddress();
                CommandUtils.dbgPrint(out, String.format(" %d\t!j9method %s\t%s\t%s\n", i - 1, intAddr, jitAddr, name));
            } else {
                CommandUtils.dbgPrint(out, String.format(" %d\t!j9method %s\t%s\t\n", i - 1, intAddr, name));
            }
        }
        return;
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 9 with UDATAPointer

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

the class VmCheckCommand method findMethodInVTable.

private boolean findMethodInVTable(J9MethodPointer method, J9ClassPointer classPointer) throws CorruptDataException {
    UDATAPointer vTable = J9ClassHelper.vTable(classPointer);
    long vTableSize = vTable.at(0).longValue();
    /* skip magic first entry */
    for (long vTableIndex = 2; vTableIndex <= vTableSize + 1; vTableIndex++) {
        // System.out.printf("%d COMP 0x%s vs. 0x%s\n", (int)vTableIndex, Long.toHexString(method.getAddress()), Long.toHexString(vTable.at(vTableIndex).longValue()));
        if (method.eq(J9MethodPointer.cast(vTable.at(vTableIndex)))) {
            return true;
        }
    }
    return false;
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Example 10 with UDATAPointer

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

the class Pool_29_V0 method pool_nextDo.

// re-uses the existing state
private VoidPointer pool_nextDo() throws CorruptDataException {
    slot = 1 + state.lastSlot;
    UDATAPointer currAddr = null;
    if (state.leftToDo == 0) {
        if ((state.currentPuddle != null) && (state.currentPuddle.notNull())) {
            return poolPuddle_startDo(state.currentPuddle, true);
        } else {
            return null;
        }
    }
    while (isPuddleSlotFree(state.currentPuddle)) {
        slot++;
    }
    currAddr = UDATAPointer.cast(state.currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
    state.lastSlot = slot;
    state.leftToDo--;
    if (state.leftToDo == 0) {
        if ((state.flags & POOLSTATE_FOLLOW_NEXT_POINTERS) == POOLSTATE_FOLLOW_NEXT_POINTERS) {
            state.currentPuddle = state.currentPuddle.nextPuddle();
            state.lastSlot = -1;
        } else {
            state.currentPuddle = null;
        }
    }
    logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
    if (logger.isLoggable(Level.FINER)) {
        logger.finer(state.toString());
    }
    return VoidPointer.cast(currAddr);
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Aggregations

UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)16 UDATA (com.ibm.j9ddr.vm29.types.UDATA)8 CorruptDataException (com.ibm.j9ddr.CorruptDataException)7 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)6 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)3 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)2 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)2 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)2 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)2 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)2 J9ROMFieldShapePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer)2 J9VMEntryLocalStoragePointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMEntryLocalStoragePointer)2 U32 (com.ibm.j9ddr.vm29.types.U32)2 ArrayList (java.util.ArrayList)2 J9JavaStackIterator (com.ibm.j9ddr.vm29.j9.J9JavaStackIterator)1 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)1 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)1