Search in sources :

Example 6 with OMRMemCategoryPointer

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

the class OMRMemCategoryHelper method visitMemoryCategoryChildren.

/**
 * Performs a depth-first walk of all the children of startNode, starting with startNode itself
 * @param startNode Node to start walking from
 * @param visitor Visitor object
 */
public static void visitMemoryCategoryChildren(OMRMemCategoryPointer startNode, IOMRMemCategoryVisitor visitor) throws CorruptDataException {
    visitor.visit(startNode);
    final int numberOfChildren = startNode.numberOfChildren().intValue();
    for (int i = 0; i < numberOfChildren; i++) {
        U32 childCode = startNode.children().at(i);
        OMRMemCategoryPointer child = getMemoryCategory(childCode);
        /* getMemoryCategory will map codes to the unknown code if necessary. If we've mapped to another category code,
			 * we don't want to iterate to it
			 */
        if (child.categoryCode().eq(childCode)) {
            visitMemoryCategoryChildren(child, visitor);
        } else {
            U32 thisCategoryCode = null;
            try {
                thisCategoryCode = startNode.categoryCode();
            } catch (CorruptDataException ex) {
            }
            if (thisCategoryCode == null) {
                throw new CorruptDataException("Bad memory category child relationship. Memory Category at " + startNode.getHexAddress() + " references unknown memory category code " + childCode);
            } else {
                throw new CorruptDataException("Bad memory category child relationship. Memory Category at " + startNode.getHexAddress() + " code " + thisCategoryCode + " references unknown memory category code " + childCode);
            }
        }
    }
}
Also used : OMRMemCategoryPointer(com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer) U32(com.ibm.j9ddr.vm29.types.U32) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

OMRMemCategoryPointer (com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer)5 U32 (com.ibm.j9ddr.vm29.types.U32)4 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 OMRMemCategorySetPointer (com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategorySetPointer)1 HashMap (java.util.HashMap)1