Search in sources :

Example 1 with GCHeapRegionIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.

the class RootScanner method scanNonCollectableObjectsInternal.

private void scanNonCollectableObjectsInternal(long memoryType) throws CorruptDataException {
    GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
    while (regionIterator.hasNext()) {
        GCHeapRegionDescriptor region = regionIterator.next();
        if (new UDATA(region.getTypeFlags()).allBitsIn(memoryType)) {
            GCObjectHeapIterator objectIterator = GCObjectHeapIterator.fromHeapRegionDescriptor(region, true, false);
            while (objectIterator.hasNext()) {
                J9ObjectPointer object = objectIterator.next();
                doClassSlot(J9ObjectHelper.clazz(object));
                GCObjectIterator fieldIterator = GCObjectIterator.fromJ9Object(object, true);
                GCObjectIterator fieldAddressIterator = GCObjectIterator.fromJ9Object(object, true);
                while (fieldIterator.hasNext()) {
                    doNonCollectableObjectSlot(fieldIterator.next(), fieldAddressIterator.nextAddress());
                }
            }
        }
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) UDATA(com.ibm.j9ddr.vm29.types.UDATA) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) GCObjectHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator) GCObjectIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 2 with GCHeapRegionIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.

the class GCHeapRegionIterator method from.

public static GCHeapRegionIterator from() throws CorruptDataException {
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    MM_GCExtensionsPointer gcext = GCExtensions.getGCExtensionsPointer();
    MM_HeapRegionManagerPointer hrm = gcext.heapRegionManager();
    return fromMMHeapRegionManager(hrm, true, true);
}
Also used : MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)

Example 3 with GCHeapRegionIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.

the class ACCommand method dumpOwnedRegions.

private void dumpOwnedRegions(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
    if (GCExtensions.isVLHGC()) {
        Table table = new Table("Regions Owned by AC " + allocationContext.getHexAddress());
        table.row("Region", "containsObjects");
        GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
        while (regionIterator.hasNext()) {
            GCHeapRegionDescriptor region = regionIterator.next();
            MM_HeapRegionDescriptorVLHGCPointer vlhgcRegion = MM_HeapRegionDescriptorVLHGCPointer.cast(region.getHeapRegionDescriptorPointer());
            MM_AllocationContextTarokPointer currentAllocationContextTarok = vlhgcRegion._allocateData()._owningContext();
            if (currentAllocationContextTarok.eq(allocationContext)) {
                table.row("!mm_heapregiondescriptorvlhgc " + vlhgcRegion.getHexAddress(), Boolean.toString(region.containsObjects()));
            }
        }
        table.render(out);
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) Table(com.ibm.j9ddr.tools.ddrinteractive.Table) MM_HeapRegionDescriptorVLHGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorVLHGCPointer) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) MM_AllocationContextTarokPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextTarokPointer)

Example 4 with GCHeapRegionIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.

the class DumpAllRegionsCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    boolean statsRequested = false;
    boolean skipReport = false;
    if (0 != args.length) {
        String argument = args[0];
        if (argument.equalsIgnoreCase("help")) {
            help(out);
            return;
        }
        statsRequested = argument.equalsIgnoreCase("stats");
        skipReport = statsRequested;
    }
    try {
        GCHeapRegionIterator gcHeapRegionIterator = GCHeapRegionIterator.from();
        int[] stats = new int[regionTypesString.length];
        int total = 0;
        String header1, header2, header3;
        String footer;
        String formatString;
        String regionType;
        initializeStats(stats);
        if (J9BuildFlags.env_data64) {
            header1 = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
            header2 = "|    region      |     start      |      end       |    subspace    | flags  |      size      |      region type     \n";
            header3 = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
            formatString = " %016x %016x %016x %016x %08x %16x %s\n";
            footer = "+----------------+----------------+----------------+----------------+--------+----------------+----------------------\n";
        } else {
            header1 = "+--------+--------+--------+--------+--------+--------+----------------------\n";
            header2 = "| region | start  |  end   |subspace| flags  |  size  |      region type     \n";
            header3 = "+--------+--------+--------+--------+--------+--------+----------------------\n";
            formatString = " %08x %08x %08x %08x %08x %8x %s\n";
            footer = "+--------+--------+--------+--------+--------+--------+----------------------\n";
        }
        if (!skipReport) {
            out.append(header1);
            out.append(header2);
            out.append(header3);
        }
        while (gcHeapRegionIterator.hasNext()) {
            GCHeapRegionDescriptor heapRegionDescriptor = gcHeapRegionIterator.next();
            int index = (int) heapRegionDescriptor.getRegionType();
            total += 1;
            if (index < regionTypesString.length) {
                regionType = regionTypesString[index];
                stats[index] += 1;
            } else {
                regionType = "Unknown";
            }
            if (!skipReport) {
                out.append(String.format(formatString, heapRegionDescriptor.getHeapRegionDescriptorPointer().getAddress(), heapRegionDescriptor.getLowAddress().getAddress(), heapRegionDescriptor.getHighAddress().getAddress(), heapRegionDescriptor.getSubSpace().getAddress(), heapRegionDescriptor.getTypeFlags().longValue(), heapRegionDescriptor.getSize().longValue(), regionType));
            }
        }
        if (!skipReport) {
            out.append(footer);
        }
        if (statsRequested) {
            String formatStringStats = " \t%s: %d\n";
            for (int i = 0; i < regionTypesString.length; i++) {
                if (0 != stats[i]) {
                    out.append(String.format(formatStringStats, regionTypesString[i], stats[i]));
                }
            }
            out.append(String.format(formatStringStats, "++++ TOTAL", total));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 5 with GCHeapRegionIterator

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator in project openj9 by eclipse.

the class ObjectSizeInfo method scanHeap.

private void scanHeap() {
    try {
        GCHeapRegionIterator regions = GCHeapRegionIterator.from();
        while (regions.hasNext()) {
            GCHeapRegionDescriptor region = regions.next();
            scanObjects(region);
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)8 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)8 CorruptDataException (com.ibm.j9ddr.CorruptDataException)4 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)3 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)3 Table (com.ibm.j9ddr.tools.ddrinteractive.Table)2 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)2 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)2 MM_AllocationContextTarokPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextTarokPointer)2 MM_GCExtensionsPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)2 MM_HeapRegionDescriptorVLHGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorVLHGCPointer)2 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)2 UDATA (com.ibm.j9ddr.vm29.types.UDATA)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)1 GCScavengerForwardedHeader (com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader)1 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)1