Search in sources :

Example 11 with Pool

use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.

the class ConstantPoolHelpers method J9_CP_TYPE.

/**
 * This method is Java implementation of the define J9_CP_TYPE in j9cp.h in VM.
 * It basically find out the type of the constant pool entry at the given index.
 *
 * #define J9_CP_TYPE(cpShapeDescription, index) \
 *	(((cpShapeDescription)[(index) / J9_CP_DESCRIPTIONS_PER_U32] >> \
 *	(((index) % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)) & J9_CP_DESCRIPTION_MASK)
 *
 * @param cpShapeDescription Description of the constantPool
 * @param index Type index
 * @return Type
 * @throws CorruptDataException
 */
public static long J9_CP_TYPE(U32Pointer cpShapeDescription, int index) throws CorruptDataException {
    U32 cpDescription = cpShapeDescription.at(index / J9_CP_DESCRIPTIONS_PER_U32);
    long shapeDesc = cpDescription.rightShift((int) ((index % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)).bitAnd(J9_CP_DESCRIPTION_MASK).longValue();
    return shapeDesc;
}
Also used : J9_CP_DESCRIPTIONS_PER_U32(com.ibm.j9ddr.vm29.structure.J9ConstantPool.J9_CP_DESCRIPTIONS_PER_U32) U32(com.ibm.j9ddr.vm29.types.U32)

Example 12 with Pool

use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.

the class Pool_29_V0 method pool_nextDo.

// re-uses the existing state
private VoidPointer pool_nextDo() throws CorruptDataException {
    slot = 1 + state.lastSlot;
    UDATAPointer currAddr = null;
    if (state.leftToDo == 0) {
        if ((state.currentPuddle != null) && (state.currentPuddle.notNull())) {
            return poolPuddle_startDo(state.currentPuddle, true);
        } else {
            return null;
        }
    }
    while (isPuddleSlotFree(state.currentPuddle)) {
        slot++;
    }
    currAddr = UDATAPointer.cast(state.currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
    state.lastSlot = slot;
    state.leftToDo--;
    if (state.leftToDo == 0) {
        if ((state.flags & POOLSTATE_FOLLOW_NEXT_POINTERS) == POOLSTATE_FOLLOW_NEXT_POINTERS) {
            state.currentPuddle = state.currentPuddle.nextPuddle();
            state.lastSlot = -1;
        } else {
            state.currentPuddle = null;
        }
    }
    logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
    if (logger.isLoggable(Level.FINER)) {
        logger.finer(state.toString());
    }
    return VoidPointer.cast(currAddr);
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Example 13 with Pool

use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.

the class Pool_29_V0 method hasNext.

@SuppressWarnings("unchecked")
public boolean hasNext() {
    // prevents multiple calls to hasNext() walking the pool further.
    if (nextStruct != null) {
        return true;
    }
    try {
        // any handlers are likely to have been installed.
        if (!inited) {
            // start the pool walk
            nextItem = pool_startDo();
        } else {
            // continue the pool walk
            nextItem = pool_nextDo();
        }
    } catch (CorruptDataException e) {
        // cannot try to recover from this
        raiseCorruptDataEvent("Error creating iterator", e, true);
        // make the pool look empty
        nextItem = null;
    } finally {
        // make sure we don't do this again
        inited = true;
    }
    while ((nextItem != null) && nextItem.notNull()) {
        try {
            if (!isInline) {
                PointerPointer ptr = PointerPointer.cast(nextItem);
                nextItem = ptr.at(0);
            }
            nextStruct = (StructType) DataType.getStructure(structType, nextItem.getAddress());
        } catch (CorruptDataException e) {
            // may be able to recover from this
            raiseCorruptDataEvent("Error getting next pool item", e, false);
        }
        if (nextStruct != null) {
            // Found an item, move on.
            break;
        } else {
            // the next item in the pool.
            try {
                // continue the pool walk
                nextItem = pool_nextDo();
            } catch (CorruptDataException e) {
                // cannot try to recover from this
                raiseCorruptDataEvent("Error creating iterator", e, true);
                // make the pool look empty
                nextItem = null;
            }
        }
    }
    return nextStruct != null;
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 14 with Pool

use of com.ibm.j9ddr.vm29.j9.Pool 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)

Example 15 with Pool

use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.

the class MonitorIterator method threadPoolHasNext.

private boolean threadPoolHasNext() throws CorruptDataException {
    while ((current == null) && pool.notNull()) {
        while (index < poolSize) {
            J9ThreadMonitorPointer monitor = J9ThreadMonitorPointer.cast(poolEntries.add(index));
            index++;
            if (freeTag != monitor.count().longValue()) {
                J9ThreadAbstractMonitorPointer lock = J9ThreadAbstractMonitorPointer.cast(monitor);
                if (lock.flags().allBitsIn(J9ThreadAbstractMonitor.J9THREAD_MONITOR_OBJECT)) {
                    if (!lock.userData().eq(0)) {
                        // this is an object monitor in the system monitor table
                        J9ObjectPointer obj = J9ObjectPointer.cast(lock.userData());
                        ObjectMonitor objmon = ObjectAccessBarrier.getMonitor(obj);
                        // This check is to exclude flat object monitors. Flat object monitors are accounted for during the heap walk
                        if ((objmon == null) || !objmon.isInflated()) {
                            continue;
                        }
                        // return an object monitor
                        current = objmon;
                    }
                } else {
                    // return a system monitor
                    current = monitor;
                }
                if (log.isLoggable(Level.FINE)) {
                    log.fine(String.format("Found monitor @ 0x%016x : %s", monitor.getAddress(), monitor.name().getCStringAtOffset(0)));
                }
                return true;
            }
        }
        pool = pool.next();
        if (pool.notNull()) {
            index = 0;
            poolEntries = pool.entriesEA();
        }
    }
    return pool.notNull();
}
Also used : J9ThreadMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)13 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)6 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)6 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)5 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 J9ThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer)4 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)3 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)3 J9ThreadLibraryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadLibraryPointer)3 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)2 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)2 J9ConstantPoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ConstantPoolPointer)2 J9HashTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer)2 U32 (com.ibm.j9ddr.vm29.types.U32)2 UDATA (com.ibm.j9ddr.vm29.types.UDATA)2 CorruptData (com.ibm.dtfj.image.CorruptData)1 JavaClass (com.ibm.dtfj.java.JavaClass)1 JavaObject (com.ibm.dtfj.java.JavaObject)1