Search in sources :

Example 11 with Pointer

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

the class LinearDumper method getAllRegions.

/**
 * Returns a tree of regions and slots. Each slot is under a region. The
 * root element is always null.
 * @param classWalker
 *
 * @return J9ClassRegionNode tree of J9ClassRegion
 * @throws CorruptDataException
 */
public J9ClassRegionNode getAllRegions(ClassWalker classWalker) throws CorruptDataException {
    classWalker.allSlotsInObjectDo(this);
    final StructurePointer clazz = classWalker.getClazz();
    /* Add the UTF8 region */
    if (firstJ9_ROM_UTF8 != Long.MAX_VALUE) {
        addSection(clazz, PointerPointer.cast(firstJ9_ROM_UTF8), lastJ9_ROM_UTF8 - firstJ9_ROM_UTF8, "UTF8", true);
    }
    groupSectionByName(clazz, "methodDebugInfo", false);
    groupSectionByName(clazz, "variableInfo", false);
    /*
		 * the offset is a pointer which points at the end of the current
		 * region, in the case of a region which have no real size, it points at
		 * the beginning of the region
		 */
    AbstractPointer offset = PointerPointer.NULL;
    J9ClassRegionNode currentNode = new J9ClassRegionNode(null);
    Stack<J9ClassRegionNode> parentStack = new Stack<J9ClassRegionNode>();
    J9ClassRegion previousRegion = null;
    Collections.sort(classRegions);
    for (J9ClassRegion region : classRegions) {
        if (isSameRegion(previousRegion, region)) {
            previousRegion = region;
            continue;
        }
        previousRegion = region;
        if (SlotType.J9_SECTION_START == region.getType()) {
            if (region.getComputePadding() && offset.notNull() && !offset.eq(region.getSlotPtr())) {
                currentNode.addChild(new J9ClassRegionNode(new J9ClassRegion(offset, SlotType.J9_Padding, "Padding", "", region.getSlotPtr().getAddress() - offset.getAddress(), 0, true)));
            }
            if (region.getComputePadding()) {
                offset = region.getSlotPtr();
            }
            parentStack.push(currentNode);
            J9ClassRegionNode newChild = new J9ClassRegionNode(region);
            currentNode.addChild(newChild);
            currentNode = newChild;
        } else if (SlotType.J9_SECTION_END == region.getType()) {
            if (region.getComputePadding()) {
                long paddingSize = (region.getSlotPtr().getAddress() - offset.getAddress());
                if (paddingSize != 0) {
                    currentNode.addChild(new J9ClassRegionNode(new J9ClassRegion(offset, SlotType.J9_Padding, "Padding", "", paddingSize, 0, true)));
                }
                offset = region.getSlotPtr();
            }
            currentNode = parentStack.pop();
        } else {
            boolean computePadding = false;
            if (currentNode.getNodeValue() != null) {
                computePadding = currentNode.getNodeValue().getComputePadding();
            }
            if (computePadding && offset.notNull() && !offset.eq(region.getSlotPtr())) {
                currentNode.addChild(new J9ClassRegionNode(new J9ClassRegion(offset, SlotType.J9_Padding, "Padding", "", region.getSlotPtr().getAddress() - offset.getAddress(), 0, true)));
            }
            if (computePadding) {
                offset = region.getSlotPtr().addOffset(region.length);
            }
            currentNode.addChild(new J9ClassRegionNode(region));
        }
    }
    // Padding after the class and inside the romSize.
    if (clazz instanceof J9ROMClassPointer) {
        long size = J9ROMClassPointer.cast(clazz).romSize().longValue();
        long paddingSize = (clazz.longValue() + size) - offset.longValue();
        if (paddingSize != 0) {
            currentNode.addChild(new J9ClassRegionNode(new J9ClassRegion(offset, SlotType.J9_Padding, "Padding", "", paddingSize, 0, true)));
            // The class padding might be inserted out of order
            Collections.sort(currentNode.getChildren());
        }
    }
    return currentNode;
}
Also used : AbstractPointer(com.ibm.j9ddr.vm29.pointer.AbstractPointer) StructurePointer(com.ibm.j9ddr.vm29.pointer.StructurePointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) Stack(java.util.Stack)

Example 12 with Pointer

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

the class RamClassWalker method allSlotsInJitVTablesDo.

private void allSlotsInJitVTablesDo() throws CorruptDataException {
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    if (!vm.jitConfig().isNull()) {
        final long jitvTableSlots = J9ClassHelper.vTable(ramClass).at(0).longValue();
        final long jitvTableSlotsLength = jitvTableSlots * UDATA.SIZEOF;
        for (int i = 0; i < jitvTableSlots; i++) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, UDATAPointer.cast(ramClass.subOffset(jitvTableSlotsLength)).add(i), "send target", "");
        }
        /*
			 * The vTable is before the RAMClass, to get the starting address,
			 * the length of the vTable is subtracted from the pointer of the
			 * class
			 */
        classWalkerCallback.addSection(clazz, ramClass.subOffset(jitvTableSlotsLength), jitvTableSlotsLength, "jitVTables", true);
    }
}
Also used : J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)

Example 13 with Pointer

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

the class DumpAllSegmentsCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        out.append(String.format("memorySegments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.memorySegments().getAddress())));
        SegmentsUtil.dbgDumpSegmentList(out, vm.memorySegments());
        out.append(String.format("classMemorySegments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.classMemorySegments().getAddress())));
        SegmentsUtil.dbgDumpSegmentList(out, vm.classMemorySegments());
        if (J9BuildFlags.interp_nativeSupport) {
            /* readJavaVM also reads converts the JITConfig pointer. */
            if (!vm.jitConfig().isNull()) {
                out.append(String.format("jit code segments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.jitConfig().codeCacheList().getAddress())));
                SegmentsUtil.dbgDumpJITCodeSegmentList(out, vm.jitConfig().codeCacheList());
                out.append(String.format("jit data segments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.jitConfig().dataCacheList().getAddress())));
                SegmentsUtil.dbgDumpSegmentList(out, vm.jitConfig().dataCacheList());
            } else {
                out.append("JIT not enabled\n");
            }
        }
        out.append(nl);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 14 with Pointer

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

the class TraceConfigCommand method walkTraceComponents.

/**
 * Walk the trace components and use the visitor pattern to save us writing this
 * loop several times.
 *
 * @param visitor the visitor object to run on each UtModuleInfo.
 * @param head the pointer to the first item in the list of UtComponentData
 * @param context
 * @param out
 */
private static void walkTraceComponents(final ModuleVisitor visitor, final UtComponentDataPointer head, Context context, PrintStream out) {
    UtComponentDataPointer current = head;
    try {
        while (current != null && current.notNull()) {
            UtModuleInfoPointer modInfo = current.moduleInfo();
            visitor.visit(modInfo);
            current = current.next();
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : UtModuleInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.UtModuleInfoPointer) UtComponentDataPointer(com.ibm.j9ddr.vm29.pointer.generated.UtComponentDataPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 15 with Pointer

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

the class WalkInternTableCommand method getRomClassBuilderPtr.

/**
 * This method is used to get the pointer to the RomClassBuilder
 * @param out	PrintStream
 * @return void
 * @throws CorruptDataException
 */
private J9DbgStringInternTablePointer getRomClassBuilderPtr(PrintStream out) throws CorruptDataException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        if (vm.isNull()) {
            out.append("VM can not be found " + nl);
            return null;
        }
        J9TranslationBufferSetPointer translationBufferSetPtr = vm.dynamicLoadBuffers();
        if (translationBufferSetPtr.isNull()) {
            out.append("J9TranslationBufferSet can not be found " + nl);
            return null;
        }
        J9DbgROMClassBuilderPointer romClassBuilderPtr = J9DbgROMClassBuilderPointer.cast(translationBufferSetPtr.romClassBuilder());
        if (romClassBuilderPtr.isNull()) {
            out.append("romClassBuilderPtr can not be found " + nl);
            return null;
        }
        return romClassBuilderPtr.stringInternTable();
    } catch (CorruptDataException e) {
        throw e;
    }
}
Also used : J9TranslationBufferSetPointer(com.ibm.j9ddr.vm29.pointer.generated.J9TranslationBufferSetPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9DbgROMClassBuilderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9DbgROMClassBuilderPointer)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)14 UDATA (com.ibm.j9ddr.vm29.types.UDATA)14 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)6 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)5 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)4 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)3 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)3 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)3 ImageSection (com.ibm.dtfj.image.ImageSection)2 FieldDescriptor (com.ibm.j9ddr.StructureReader.FieldDescriptor)2 StructureDescriptor (com.ibm.j9ddr.StructureReader.StructureDescriptor)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9DDRImageSection (com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)2 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)2 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)2 GCScavengerForwardedHeader (com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader)2 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)2 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)2 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)2