Search in sources :

Example 6 with MM_GCExtensionsPointer

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

the class HeapWalker method initializeFlatLockedMonitors.

private static void initializeFlatLockedMonitors() throws CorruptDataException {
    J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
    MM_GCExtensionsPointer gcext = GCExtensions.getGCExtensionsPointer();
    MM_HeapRegionManagerPointer hrm = gcext.heapRegionManager();
    flatLockedMonitors = new TreeSet<ObjectMonitor>();
    GCHeapRegionIterator regions = GCHeapRegionIterator.fromMMHeapRegionManager(hrm, true, true);
    while (regions.hasNext()) {
        GCHeapRegionDescriptor region = regions.next();
        if (!flatLockedMonitorsByRegion.containsKey(region)) {
            runFlatLockMonitorRegionWalk(vm, region);
        }
        /* Running the walk should have populated the flatLockedMonitors map */
        assert (flatLockedMonitorsByRegion.containsKey(region));
        flatLockedMonitors.addAll(flatLockedMonitorsByRegion.get(region));
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

Example 7 with MM_GCExtensionsPointer

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

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

the class DumpSegregatedStatsCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (!GCExtensions.isSegregatedHeap()) {
        out.append("Only valid for a segregated heap\n");
        return;
    }
    try {
        /* Get the region pool */
        MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
        MM_RealtimeGCPointer realtimeGC = MM_RealtimeGCPointer.cast(extensions._globalCollector());
        MM_RegionPoolSegregatedPointer regionPool = realtimeGC._memoryPool()._regionPool();
        /* Get the size classes */
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9VMGCSizeClassesPointer sizeClasses = vm.realtimeSizeClasses();
        long countTotal = 0;
        long countAvailableSmallTotal = 0;
        long countFullSmallTotal = 0;
        long darkMatterBytesTotal = 0;
        long allocCacheBytesTotal = 0;
        /* arrayOffset is the total offset into a two dimensional array.  Used to walk the 
			 * the array linearly */
        long arrayOffset = J9Consts.J9VMGC_SIZECLASSES_MIN_SMALL * MM_RegionPoolSegregated.NUM_DEFRAG_BUCKETS;
        out.append("sizeClass | full | available           | total | free cell count | dark | cache\n");
        out.append("===============================================================================\n");
        for (long sizeClassIndex = J9Consts.J9VMGC_SIZECLASSES_MIN_SMALL; sizeClassIndex <= J9Consts.J9VMGC_SIZECLASSES_MAX_SMALL; sizeClassIndex++) {
            /* Print the sizeclass */
            UDATA cellSize = sizeClasses.smallCellSizesEA().at(sizeClassIndex);
            out.format("%2d: %5d | ", sizeClassIndex, cellSize.longValue());
            MM_HeapRegionListPointer heapRegionQueue = MM_HeapRegionListPointer.cast(regionPool._smallFullRegionsEA().at(sizeClassIndex));
            long countSmall = getTotalRegions(heapRegionQueue);
            countFullSmallTotal += countSmall;
            /* Print the number of full regions of this size class */
            out.format("%4d | ", countSmall);
            /* The number of free cells of this sizeclass */
            long freeCellCount = 0;
            for (long i = 0; i < MM_RegionPoolSegregated.NUM_DEFRAG_BUCKETS; i++) {
                long count = 0;
                MM_LockingHeapRegionQueuePointer heapRegionList = MM_LockingHeapRegionQueuePointer.cast(regionPool._smallAvailableRegionsEA().add(arrayOffset).at(0));
                for (long j = 0; j < regionPool._splitAvailableListSplitCount().longValue(); j++) {
                    count += getTotalRegions(heapRegionList);
                    freeCellCount += getFreeCellCount(heapRegionList);
                    heapRegionList = heapRegionList.add(1);
                }
                /* increment to the next list */
                arrayOffset += 1;
                countSmall += count;
                countAvailableSmallTotal += count;
                /* Print the number of available regions in this defrag bucket */
                out.format("%4d ", count);
            }
            countTotal += countSmall;
            /* Print the total number of regions of this size class, and the number of free cells */
            out.format("| %5d | %15d |", countSmall, freeCellCount);
            /* Print the percentage of darkmatter in this region */
            long darkMatterCellCount = regionPool._darkMatterCellCountEA().at(sizeClassIndex).longValue();
            darkMatterBytesTotal += darkMatterCellCount * cellSize.longValue();
            out.format("%%%3d | ", countSmall == 0 ? 0 : darkMatterCellCount / (countSmall * cellSize.longValue()));
            /* Calculate the number of bytes in allocation caches */
            long allocCacheSize = 0;
            J9VMThreadPointer mainThread = vm.mainThread();
            if (mainThread.notNull()) {
                J9VMThreadPointer threadCursor = vm.mainThread();
                do {
                    J9VMGCSegregatedAllocationCacheEntryPointer cache = threadCursor.segregatedAllocationCache();
                    cache = cache.add(sizeClassIndex);
                    allocCacheSize += cache.top().longValue() - cache.current().longValue();
                    threadCursor = threadCursor.linkNext();
                } while (!threadCursor.eq(mainThread));
            }
            out.format("%5d\n", allocCacheSize);
            allocCacheBytesTotal += allocCacheSize;
        }
        long regionSize = extensions.heap()._heapRegionManager()._regionSize().longValue();
        out.format("region size %d\n", regionSize);
        long arrayletLeafSize = extensions._omrVM()._arrayletLeafSize().longValue();
        out.format("arraylet leaf size %d\n", arrayletLeafSize);
        out.format("small total (full, available) region count %d (%d, %d)\n", countTotal, countFullSmallTotal, countAvailableSmallTotal);
        long countFullArraylet = getTotalRegions(regionPool._arrayletFullRegions());
        long countAvailArraylet = getTotalRegions(regionPool._arrayletAvailableRegions());
        long countTotalArraylet = countFullArraylet + countAvailArraylet;
        countTotal += countTotalArraylet;
        out.format("arraylet total (full, available) region count %d (%d %d)\n", countTotalArraylet, countFullArraylet, countAvailArraylet);
        long countLarge = getTotalRegions(regionPool._largeFullRegions());
        countTotal += countLarge;
        out.format("large full region count %d\n", countLarge);
        long countFree = getTotalRegions(regionPool._singleFreeList());
        countTotal += countFree;
        out.format("free region count %d\n", countFree);
        long countMultiFree = getTotalRegions(regionPool._multiFreeList());
        countTotal += countMultiFree;
        out.format("multiFree region count %d\n", countMultiFree);
        long countCoalesce = getTotalRegions(regionPool._coalesceFreeList());
        countTotal += countCoalesce;
        out.format("coalesce region count %d\n", countCoalesce);
        long heapSize = countTotal * regionSize;
        out.format("total region count %d, total heap size %d \n", countTotal, heapSize);
        out.format("dark matter total bytes %d (%2.2f%% of heap)\n", darkMatterBytesTotal, 100.0 * darkMatterBytesTotal / heapSize);
        out.format("allocation cache total bytes %d (%2.2f%% of heap)\n", allocCacheBytesTotal, 100.0 * allocCacheBytesTotal / heapSize);
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
}
Also used : MM_HeapRegionListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionListPointer) MM_LockingHeapRegionQueuePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer) MM_RegionPoolSegregatedPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_RegionPoolSegregatedPointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9VMGCSegregatedAllocationCacheEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSegregatedAllocationCacheEntryPointer) J9VMGCSizeClassesPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSizeClassesPointer) MM_RealtimeGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_RealtimeGCPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 9 with MM_GCExtensionsPointer

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

the class MarkMapCommand method showMarkMap.

protected void showMarkMap(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    showActiveMarkMap(out);
    try {
        out.format("\nKnown mark maps:\n");
        MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
        if (GCExtensions.isStandardGC()) {
            MM_ParallelGlobalGCPointer pgc = MM_ParallelGlobalGCPointer.cast(extensions._globalCollector());
            MM_MarkMapPointer markMap = pgc._markingScheme()._markMap();
            out.format("\tactive: %s\n", markMap.getHexAddress());
        } else if (GCExtensions.isVLHGC()) {
            // probably needs a proper subclass
            MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
            out.format("\tprevious: %s\n", igc._markMapManager()._previousMarkMap().getHexAddress());
            out.format("\tnext: %s\n", igc._markMapManager()._nextMarkMap().getHexAddress());
        } else if (GCExtensions.isMetronomeGC()) {
            MM_HeapMapPointer markMap = extensions.realtimeGC()._markingScheme()._markMap();
            out.format("\tactive: %s\n", markMap.getHexAddress());
        } else {
            out.format("\tUnrecognized GC policy!\n");
        }
        try {
            if (extensions.referenceChainWalkerMarkMap().notNull()) {
                out.format("\treference chain walker: %s\n", extensions.referenceChainWalkerMarkMap().getHexAddress());
            }
        } catch (NoSuchFieldError nsf) {
        // guess we don't have one
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : MM_IncrementalGenerationalGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_IncrementalGenerationalGCPointer) MM_ParallelGlobalGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_ParallelGlobalGCPointer) MM_HeapMapPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapMapPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_MarkMapPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MarkMapPointer)

Example 10 with MM_GCExtensionsPointer

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

the class MarkMapCommand method setMarkMap.

protected void setMarkMap(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    GCHeapMap newMap = null;
    try {
        if (args[1].equalsIgnoreCase("active") || args[1].equalsIgnoreCase("default")) {
            newMap = GCHeapMap.from();
        } else if (args[1].equalsIgnoreCase("previous")) {
            if (GCExtensions.isVLHGC()) {
                MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
                MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
                newMap = GCHeapMap.fromHeapMap(igc._markMapManager()._previousMarkMap());
            } else {
                throw new DDRInteractiveCommandException("Only valid when running balanced!");
            }
        } else if (args[1].equalsIgnoreCase("next")) {
            if (GCExtensions.isVLHGC()) {
                MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
                MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
                newMap = GCHeapMap.fromHeapMap(igc._markMapManager()._nextMarkMap());
            } else {
                throw new DDRInteractiveCommandException("Only valid when running balanced!");
            }
        } else {
            long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
            MM_HeapMapPointer heapMap = MM_HeapMapPointer.cast(address);
            newMap = GCHeapMap.fromHeapMap(heapMap);
        }
        /* Quick test for validity */
        newMap.queryObject(J9ObjectPointer.cast(newMap.getHeapBase()));
        newMap.queryObject(J9ObjectPointer.cast(newMap.getHeapTop().subOffset(newMap.getObjectGrain())));
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
    /* If we got here, the new map must be ok */
    if (newMap != null) {
        markMap = newMap;
        showActiveMarkMap(out);
    }
}
Also used : MM_IncrementalGenerationalGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_IncrementalGenerationalGCPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MM_HeapMapPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapMapPointer) GCHeapMap(com.ibm.j9ddr.vm29.j9.gc.GCHeapMap) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

MM_GCExtensionsPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)10 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)5 CorruptDataException (com.ibm.j9ddr.CorruptDataException)4 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)4 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)3 MM_IncrementalGenerationalGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_IncrementalGenerationalGCPointer)3 MM_HeapMapPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapMapPointer)2 MM_MarkMapPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_MarkMapPointer)2 MM_ParallelGlobalGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_ParallelGlobalGCPointer)2 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)1 GCHeapMap (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap)1 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)1 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 J9VMGCSegregatedAllocationCacheEntryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSegregatedAllocationCacheEntryPointer)1 J9VMGCSizeClassesPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMGCSizeClassesPointer)1 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)1 MM_AllocationContextPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextPointer)1 MM_CardTablePointer (com.ibm.j9ddr.vm29.pointer.generated.MM_CardTablePointer)1 MM_HeapRegionListPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionListPointer)1