Search in sources :

Example 1 with MM_AllocationContextPointer

use of com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextPointer 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 2 with MM_AllocationContextPointer

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

the class ACCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        if (command.equalsIgnoreCase("!acforobject")) {
            if (null == heapRegionManager) {
                MM_HeapRegionManagerPointer hrmPointer;
                hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
                heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
            }
            if (args.length < 1) {
                throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
            }
            long addr = Long.decode(args[0]);
            J9ObjectPointer objectPointer = J9ObjectPointer.cast(addr);
            dumpACForObject(vm, objectPointer, out);
        } else {
            MM_GCExtensionsPointer gcExtensions = MM_GCExtensionsPointer.cast(vm.gcExtensions());
            if (args.length < 1) {
                throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
            }
            boolean dumpACExternalReferences = false;
            boolean dumpOwnedRegions = false;
            for (int i = 1; i < args.length; i++) {
                String arg = args[i];
                if (arg.equalsIgnoreCase("xrefs")) {
                    dumpACExternalReferences = true;
                } else if (arg.equalsIgnoreCase("ownedRegions")) {
                    dumpOwnedRegions = true;
                } else {
                    throw new DDRInteractiveCommandException("Unrecognized acforobject subcommand -->" + arg);
                }
            }
            long addr = Long.decode(args[0]);
            MM_AllocationContextPointer ac = MM_AllocationContextPointer.cast(addr);
            if (dumpACExternalReferences) {
                // TODO: handle other AC types
                if (GCExtensions.isVLHGC()) {
                    context.execute("!mm_allocationcontexttarok", new String[] { args[0] }, out);
                }
                dumpLiveReferences(vm, ac, out);
            }
            if (dumpOwnedRegions) {
                dumpOwnedRegions(vm, ac, out);
            }
        }
    } catch (DDRInteractiveCommandException e) {
        throw e;
    } catch (Throwable e) {
        e.printStackTrace(out);
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : MM_AllocationContextPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextPointer) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 3 with MM_AllocationContextPointer

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

the class ACCommand method dumpLiveReferences.

private void dumpLiveReferences(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
    if (GCExtensions.isVLHGC()) {
        MM_AllocationContextTarokPointer act = MM_AllocationContextTarokPointer.cast(allocationContext);
        MM_HeapRegionManagerPointer hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
        GCHeapRegionManager heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
        Table table = new Table("Live References into AC " + allocationContext.getHexAddress());
        table.row("Object", "Field");
        out.println("Walking live set in search of external references into ac: " + allocationContext.getHexAddress());
        long totalMillis = System.currentTimeMillis();
        LiveReferenceVisitor visitor = new LiveReferenceVisitor(heapRegionManager, act, table);
        LiveSetWalker.walkLiveSet(visitor, RootSetType.ALL);
        totalMillis = System.currentTimeMillis() - totalMillis;
        table.render(out);
        out.println("\nFinished live reference walk in " + totalMillis + "ms");
        out.println("Found " + visitor.getNumExternalReferencesFound() + " external references.");
    }
}
Also used : Table(com.ibm.j9ddr.tools.ddrinteractive.Table) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) MM_AllocationContextTarokPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextTarokPointer) GCHeapRegionManager(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionManager)

Aggregations

Table (com.ibm.j9ddr.tools.ddrinteractive.Table)2 MM_AllocationContextTarokPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextTarokPointer)2 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)1 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)1 GCHeapRegionManager (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionManager)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 MM_AllocationContextPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextPointer)1 MM_GCExtensionsPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)1 MM_HeapRegionDescriptorVLHGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorVLHGCPointer)1