Search in sources :

Example 1 with MM_MemorySubSpaceGenericPointer

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

the class GCStandardMemoryPoolIterator method advancePool.

/* Analog to the HeapMemoryPoolIterator.cpp:nextPool() */
private void advancePool() {
    try {
        boolean poolFound = false;
        MM_MemoryPoolPointer memoryPool = null;
        while (!poolFound && _regionIterator.hasNext()) {
            switch(_state) {
                case mm_heapmp_iterator_next_region:
                    _region = _regionIterator.next();
                    /* Based on current Modron architecture, the leafs of the sub spaces in standard collectors
						 * are of type SubSpaceGeneric. This might change in the future */
                    MM_MemorySubSpaceGenericPointer subSpaceGeneric = MM_MemorySubSpaceGenericPointer.cast(_region.getSubSpace());
                    if (subSpaceGeneric.notNull()) {
                        memoryPool = subSpaceGeneric._memoryPool();
                        if (memoryPool.notNull()) {
                            /* Does this Memory pool have children ? */
                            if (memoryPool._children().notNull()) {
                                /* Yes ..So we only return details of its children */
                                memoryPool = memoryPool._children();
                            }
                            _state = IteratorState.mm_heapmp_iterator_next_memory_pool;
                            poolFound = true;
                        }
                    }
                    break;
                case mm_heapmp_iterator_next_memory_pool:
                    /* Any more children ? */
                    memoryPool = _currentMemoryPool._next();
                    if (memoryPool.isNull()) {
                        _state = IteratorState.mm_heapmp_iterator_next_region;
                    } else {
                        poolFound = true;
                    }
                    break;
            }
        }
        if (poolFound) {
            /* Set currentMemoryPool to null to indicate we can't find any more pools */
            _currentMemoryPool = memoryPool;
        } else {
            _currentMemoryPool = null;
        }
    } catch (CorruptDataException e) {
        raiseCorruptDataEvent("Memory Pool corruption detected", e, false);
        _currentMemoryPool = null;
    }
}
Also used : MM_MemorySubSpaceGenericPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MemorySubSpaceGenericPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MM_MemoryPoolPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MemoryPoolPointer)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 MM_MemoryPoolPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_MemoryPoolPointer)1 MM_MemorySubSpaceGenericPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_MemorySubSpaceGenericPointer)1