Search in sources :

Example 6 with StructurePointer

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

the class LinearDumper method groupSectionByName.

/**
 * Find the first and the last section and group them in another section with the same name ending with a "s".
 * For example, it will group all of the methodDebugInfo in a section named methodDebugInfos
 * It is important to note that the function does not check if the sections grouped are contiguous, it will
 * group all sections between the first and the last section even if their names doesn't match.
 *
 * @param clazz
 * @param name name of sections to group
 * @param computePadding
 * @throws CorruptDataException
 */
private void groupSectionByName(final StructurePointer clazz, String name, boolean computePadding) throws CorruptDataException {
    AbstractPointer firstMethodDebugInfo = null;
    AbstractPointer lastMethodDebugInfo = null;
    for (J9ClassRegion region : classRegions) {
        if (SlotType.J9_SECTION_START == region.getType() && region.getName().equals(name)) {
            if (firstMethodDebugInfo == null || region.getSlotPtr().lt(firstMethodDebugInfo)) {
                firstMethodDebugInfo = region.getSlotPtr();
            }
            if (lastMethodDebugInfo == null || region.getSlotPtr().add(region.getLength()).gt(lastMethodDebugInfo)) {
                lastMethodDebugInfo = region.getSlotPtr().addOffset(region.getLength());
            }
        }
    }
    if (firstMethodDebugInfo != null && lastMethodDebugInfo != null) {
        UDATA length = UDATA.cast(lastMethodDebugInfo).sub(UDATA.cast(firstMethodDebugInfo));
        addSection(clazz, PointerPointer.cast(firstMethodDebugInfo), length.longValue(), name + "s", computePadding);
    }
}
Also used : AbstractPointer(com.ibm.j9ddr.vm29.pointer.AbstractPointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 7 with StructurePointer

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

the class DumpSegregatedStatsCommand method getTotalRegions.

/**
 * Based off of MM_HeapRegionQueue::getTotalRegions. Returns the number of regions.
 * This function will calculate the number of regions differently according to the type of
 * the actual subclass.
 * @throws CorruptDataException
 */
public long getTotalRegions(MM_HeapRegionListPointer heapRegionList) throws CorruptDataException {
    long count = 0;
    StructurePointer heapRegionQueue = heapRegionList.getAsRuntimeType();
    if (heapRegionQueue instanceof MM_LockingHeapRegionQueuePointer) {
        MM_LockingHeapRegionQueuePointer lockingHeapRegionQueue = (MM_LockingHeapRegionQueuePointer) heapRegionQueue;
        if (lockingHeapRegionQueue._singleRegionsOnly()) {
            count = lockingHeapRegionQueue._length().longValue();
        } else {
            MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingHeapRegionQueue._head();
            while (heapRegionDescriptorSegregated.notNull()) {
                count += heapRegionDescriptorSegregated._regionsInSpan().longValue();
                heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
            }
        }
    } else if (heapRegionQueue instanceof MM_LockingFreeHeapRegionListPointer) {
        MM_LockingFreeHeapRegionListPointer lockingFreeHeapRegionQueue = (MM_LockingFreeHeapRegionListPointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingFreeHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            count += heapRegionDescriptorSegregated._regionsInSpan().longValue();
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else {
        throw new CorruptDataException("Bad HeapRegionList type");
    }
    return count;
}
Also used : MM_LockingHeapRegionQueuePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer) MM_HeapRegionDescriptorSegregatedPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer) StructurePointer(com.ibm.j9ddr.vm29.pointer.StructurePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_LockingFreeHeapRegionListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)

Example 8 with StructurePointer

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

the class DumpSegregatedStatsCommand method getFreeCellCount.

/**
 * Count the number of free cells in the entire MM_HeapRegionList
 * @throws CorruptDataException
 */
public long getFreeCellCount(MM_HeapRegionListPointer heapRegionList) throws CorruptDataException {
    StructurePointer heapRegionQueue = heapRegionList.getAsRuntimeType();
    long freeCellCount = 0;
    if (heapRegionQueue instanceof MM_LockingHeapRegionQueuePointer) {
        MM_LockingHeapRegionQueuePointer lockingHeapRegionQueue = (MM_LockingHeapRegionQueuePointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            freeCellCount += getFreeCellCount(heapRegionDescriptorSegregated);
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else if (heapRegionQueue instanceof MM_LockingFreeHeapRegionListPointer) {
        MM_LockingFreeHeapRegionListPointer lockingFreeHeapRegionQueue = (MM_LockingFreeHeapRegionListPointer) heapRegionQueue;
        MM_HeapRegionDescriptorSegregatedPointer heapRegionDescriptorSegregated = lockingFreeHeapRegionQueue._head();
        while (heapRegionDescriptorSegregated.notNull()) {
            freeCellCount += getFreeCellCount(heapRegionDescriptorSegregated);
            heapRegionDescriptorSegregated = heapRegionDescriptorSegregated._next();
        }
    } else {
        throw new CorruptDataException("Bad HeapRegionList type");
    }
    return freeCellCount;
}
Also used : MM_LockingHeapRegionQueuePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer) MM_HeapRegionDescriptorSegregatedPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer) StructurePointer(com.ibm.j9ddr.vm29.pointer.StructurePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_LockingFreeHeapRegionListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)5 StructurePointer (com.ibm.j9ddr.vm29.pointer.StructurePointer)5 AbstractPointer (com.ibm.j9ddr.vm29.pointer.AbstractPointer)4 MM_HeapRegionDescriptorSegregatedPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorSegregatedPointer)2 MM_LockingFreeHeapRegionListPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_LockingFreeHeapRegionListPointer)2 MM_LockingHeapRegionQueuePointer (com.ibm.j9ddr.vm29.pointer.generated.MM_LockingHeapRegionQueuePointer)2 FieldDescriptor (com.ibm.j9ddr.StructureReader.FieldDescriptor)1 StructureDescriptor (com.ibm.j9ddr.StructureReader.StructureDescriptor)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)1 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)1 MM_HeapRegionDescriptorVLHGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorVLHGCPointer)1 SlotType (com.ibm.j9ddr.vm29.tools.ddrinteractive.IClassWalkCallbacks.SlotType)1 Scalar (com.ibm.j9ddr.vm29.types.Scalar)1 UDATA (com.ibm.j9ddr.vm29.types.UDATA)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashSet (java.util.HashSet)1 Stack (java.util.Stack)1