Search in sources :

Example 46 with VoidPointer

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

the class J9MemTagHelper method j9mem_get_footer_padding.

/**
 * Given the address of the headerEyecatcher for the memory block, return
 * the address of the footer padding.
 *
 * Note that there not be any padding, in which case this returns the same
 * as @ref j9mem_get_footer_tag(), the address of the footer tag.
 *
 * @throws CorruptDataException
 */
public static VoidPointer j9mem_get_footer_padding(J9MemTagPointer headerEyeCatcherAddress) throws CorruptDataException {
    UDATA cursor = UDATA.cast(U8Pointer.cast(headerEyeCatcherAddress).add(J9MemTag.SIZEOF));
    U8Pointer padding = U8Pointer.cast(cursor.add(headerEyeCatcherAddress.allocSize()));
    return VoidPointer.cast(padding);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 47 with VoidPointer

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

the class LinearDumper method getRegionDetailString.

private static Object getRegionDetailString(J9ClassRegion region) throws CorruptDataException {
    VoidPointer srp;
    long slotAddress;
    String returnValue = "";
    switch(region.getType()) {
        case J9_SECTION_START:
            returnValue = String.format(" %5d bytes", region.getLength());
            break;
        case J9_RAM_UTF8:
            UDATAPointer slotPtr = UDATAPointer.cast(region.getSlotPtr());
            if (slotPtr.at(0).longValue() != 0) {
                returnValue = J9ObjectHelper.stringValue(J9ObjectPointer.cast(slotPtr.at(0)));
            }
            break;
        case J9_UTF8:
        case J9_ROM_UTF8:
            returnValue = J9UTF8Helper.stringValue(J9UTF8Pointer.cast(region.getSlotPtr()));
            break;
        case J9_iTableMethod:
            /*
			 * This case is special for the iTableMethod, because their pointers
			 * are related to the beginning of the class and are not absolute
			 */
            AbstractPointer classOffset = region.getSlotPtr().subOffset(region.offset);
            slotAddress = region.getSlotPtr().at(0).longValue();
            classOffset = classOffset.addOffset(slotAddress);
            returnValue = region.additionalInfo + " " + classOffset.getHexAddress();
            break;
        case J9_SRP:
            srp = SelfRelativePointer.cast(region.getSlotPtr()).get();
            if (srp.notNull()) {
                returnValue = " -> " + srp.getHexAddress();
            }
            break;
        case J9_WSRP:
            srp = WideSelfRelativePointer.cast(region.getSlotPtr()).get();
            if (srp.notNull()) {
                returnValue = " -> " + srp.getHexAddress();
            }
            break;
        case J9_SRP_TO_STRING:
            srp = SelfRelativePointer.cast(region.getSlotPtr()).get();
            if (srp.notNull()) {
                returnValue = " -> " + srp.getHexAddress();
                returnValue += " " + J9UTF8Helper.stringValue(J9UTF8Pointer.cast(srp));
            }
            break;
        case J9_Padding:
            returnValue = region.length + " byte(s)";
            break;
        case J9_IntermediateClassData:
            returnValue = region.length + " byte(s) " + region.additionalInfo;
            break;
        default:
            String detail = "";
            slotAddress = region.getSlotPtr().at(0).longValue();
            long slotAddressOriginal = slotAddress;
            if ((null != region.additionalInfo) && (region.additionalInfo.length() != 0)) {
                if ("classAndFlags".equals(region.name) && (UDATA.MASK != slotAddress)) {
                    slotAddress = slotAddress & ~J9JavaAccessFlags.J9StaticFieldRefFlagBits;
                }
                detail += region.additionalInfo + (String.format(" 0x%08X", slotAddress));
                /* For special debug extension, more information is shown */
                if ((0 != slotAddress) && (region.additionalInfo.equals("!j9class"))) {
                    try {
                        detail += " - " + J9UTF8Helper.stringValue(J9ClassPointer.cast(slotAddress).romClass().className());
                        if ("classAndFlags".equals(region.name)) {
                            String flags = "";
                            if (0 != (J9JavaAccessFlags.J9StaticFieldRefBaseType & slotAddressOriginal)) {
                                flags += "J9StaticFieldRefBaseType, ";
                            }
                            if (0 != (J9JavaAccessFlags.J9StaticFieldRefDouble & slotAddressOriginal)) {
                                flags += "J9StaticFieldRefDouble, ";
                            }
                            if (0 != (J9JavaAccessFlags.J9StaticFieldRefVolatile & slotAddressOriginal)) {
                                flags += "J9StaticFieldRefVolatile, ";
                            }
                            /* Check there is any flag or not */
                            if (0 < flags.length()) {
                                /*remove last two chars = ", " */
                                flags = flags.substring(0, flags.length() - 2);
                                detail += "\t Flag(s) = " + flags;
                            }
                        }
                    } catch (Exception e) {
                    /* This is only for information purpose, it is ok if an exception was thrown */
                    }
                }
            }
            returnValue = detail;
    }
    return returnValue;
}
Also used : AbstractPointer(com.ibm.j9ddr.vm29.pointer.AbstractPointer) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 48 with VoidPointer

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

the class MM_HeapRegionDescriptorHelper method getWalkableHighAddress.

public static VoidPointer getWalkableHighAddress(MM_HeapRegionDescriptorPointer region) throws CorruptDataException {
    VoidPointer top = null;
    long regionType = region._regionType();
    if ((MM_HeapRegionDescriptor$RegionType.BUMP_ALLOCATED == regionType) || (MM_HeapRegionDescriptor$RegionType.BUMP_ALLOCATED_MARKED == regionType)) {
        top = MM_MemoryPoolBumpPointerPointer.cast(region._memoryPool())._allocatePointer();
    } else {
        top = getHighAddress(region);
    }
    return top;
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer)

Example 49 with VoidPointer

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

the class RuntimeTypeResolutionHelper method findRuntimeType.

// Design 42819
// Discover runtime type based on identifier field.
public static String findRuntimeType(String type, Pointer ptr, Context context) {
    StructureDescriptor fieldOwner = null;
    FieldDescriptor typeIdField = null;
    String classType = null;
    // not just as the top of the hierarchy, so we have to look at each level.
    try {
        if (ptr.notNull()) {
            // Skip the "!"
            classType = StructureCommandUtil.typeToCommand(type).substring(1);
            do {
                fieldOwner = StructureCommandUtil.getStructureDescriptor(classType, context);
                if (null != fieldOwner) {
                    for (FieldDescriptor aField : fieldOwner.getFields()) {
                        if (aField.getDeclaredName().equals("_typeId")) {
                            typeIdField = aField;
                            break;
                        }
                    }
                    if (null == typeIdField) {
                        classType = fieldOwner.getSuperName();
                    }
                }
            } while ((null == typeIdField) && (null != classType) && (null != fieldOwner) && (classType.length() > 0));
        }
        if (null != typeIdField) {
            VoidPointer untypedStrPtr = PointerPointer.cast(ptr).addOffset(typeIdField.getOffset()).at(0);
            if (untypedStrPtr.notNull()) {
                U8Pointer typeStrPtr = U8Pointer.cast(untypedStrPtr);
                type = typeStrPtr.getCStringAtOffset(0).toLowerCase();
            }
        }
    } catch (CorruptDataException e) {
    // Do nothing.
    }
    return RuntimeTypeResolutionUtils.cleanTypeStr(type);
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) StructureDescriptor(com.ibm.j9ddr.StructureReader.StructureDescriptor) FieldDescriptor(com.ibm.j9ddr.StructureReader.FieldDescriptor)

Example 50 with VoidPointer

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

the class CompressedRefMappingCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (args.length == 0) {
        printHelp(out);
        return;
    }
    long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
    VoidPointer ptr = VoidPointer.cast(address);
    if (command.startsWith("!fj9object")) {
        J9ObjectPointer mappedValue;
        if (J9BuildFlags.gc_compressedPointers) {
            mappedValue = ObjectAccessBarrier.convertPointerFromToken(ptr.getAddress());
        } else {
            mappedValue = J9ObjectPointer.cast(ptr);
        }
        if (command.startsWith("!fj9objecttoj9object")) {
            out.println(String.format("!fj9object %s -> !j9object %s", ptr.getHexAddress(), mappedValue.getHexAddress()));
        } else {
            context.execute("!j9object", new String[] { mappedValue.getHexAddress() }, out);
        }
    } else {
        long tokenValue;
        if (J9BuildFlags.gc_compressedPointers) {
            tokenValue = ObjectAccessBarrier.convertTokenFromPointer(J9ObjectPointer.cast(ptr));
        } else {
            tokenValue = ptr.getAddress();
        }
        out.println(String.format("!j9object %s -> !fj9object 0x%s\n", ptr.getHexAddress(), Long.toHexString(tokenValue)));
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Aggregations

VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)48 CorruptDataException (com.ibm.j9ddr.CorruptDataException)37 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)15 NoSuchElementException (java.util.NoSuchElementException)13 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)9 UDATA (com.ibm.j9ddr.vm29.types.UDATA)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)5 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 CorruptData (com.ibm.dtfj.image.CorruptData)2 JavaObject (com.ibm.dtfj.java.JavaObject)2 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)2 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)2 GCJNIGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIGlobalReferenceIterator)2 GCJNIWeakGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIWeakGlobalReferenceIterator)2 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2