Search in sources :

Example 1 with UDATAPointer

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

the class Pool_29_V0 method poolPuddle_startDo.

private VoidPointer poolPuddle_startDo(J9PoolPuddlePointer currentPuddle, boolean followNextPointers) throws CorruptDataException {
    UDATAPointer currAddr = null;
    if (pool.isNull() || currentPuddle.isNull()) {
        return null;
    }
    if (currentPuddle.usedElements().longValue() == 0) {
        if ((currentPuddle.nextPuddle().notNull()) && followNextPointers) {
            return poolPuddle_startDo(currentPuddle.nextPuddle(), followNextPointers);
        } else {
            return null;
        }
    }
    while (isPuddleSlotFree(currentPuddle)) {
        slot++;
    }
    currAddr = UDATAPointer.cast(currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
    state.currentPuddle = currentPuddle;
    state.lastSlot = slot;
    state.leftToDo = currentPuddle.usedElements().intValue() - 1;
    state.flags = 0;
    if (followNextPointers) {
        // TODO find out where this is set
        state.flags |= POOLSTATE_FOLLOW_NEXT_POINTERS;
    }
    if (state.leftToDo == 0) {
        if (followNextPointers) {
            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 2 with UDATAPointer

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

the class GCMixedObjectIterator_V1 method initializeDescriptionArray.

protected void initializeDescriptionArray(J9ClassPointer clazz) throws CorruptDataException {
    UDATAPointer descriptionPtr = clazz.instanceDescription();
    long tempDescription;
    if (descriptionPtr.anyBitsIn(1)) {
        // Immediate
        tempDescription = descriptionPtr.getAddress() >>> 1;
        initializeDescriptionArray(tempDescription, 0);
    } else {
        int descriptionSlot = 0;
        int descriptionIndex = 0;
        while (descriptionIndex < scanLimit) {
            tempDescription = descriptionPtr.at(descriptionSlot++).longValue();
            initializeDescriptionArray(tempDescription, descriptionIndex);
            descriptionIndex += objectsInDescriptionSlot;
        }
    }
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Example 3 with UDATAPointer

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

the class GCHeapMap method queryRange.

/**
 * Query the mark map to see what objects are marked within the specified range.
 * Return an array of MarkedObject records describing each entry found.
 * @param base Bottom of the range to query (inclusive)
 * @param top Top of the range to query (exclusive)
 * @return A MarkedObject[] containing the results
 * @throws CorruptDataException
 */
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
    /* Naive implementation; should work but slow */
    ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
    if (base.lt(_heapBase)) {
        base = J9ObjectPointer.cast(_heapBase);
    }
    if (top.gt(_heapTop)) {
        top = J9ObjectPointer.cast(_heapTop);
    }
    if (base.gt(top)) {
        base = top;
    }
    J9ObjectPointer cursor = base;
    while (cursor.lt(top)) {
        UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
        UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
        if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
            results.add(new MarkedObject(cursor, slot));
        }
        cursor = cursor.addOffset(getObjectGrain());
    }
    return results.toArray(new MarkedObject[results.size()]);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) ArrayList(java.util.ArrayList) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 4 with UDATAPointer

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

the class GCMarkMapStandard method queryRange.

@Override
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
    /* Naive implementation; should work but slow -- ever more than the super.
		  * Add handling for compacted records in the mark map. */
    ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
    if (base.lt(_heapBase)) {
        base = J9ObjectPointer.cast(_heapBase);
    }
    if (top.gt(_heapTop)) {
        top = J9ObjectPointer.cast(_heapTop);
    }
    if (base.gt(top)) {
        base = top;
    }
    J9ObjectPointer cursor = base;
    while (cursor.lt(top)) {
        UDATA heapBaseOffset = UDATA.cast(cursor).sub(UDATA.cast(_heapBase));
        // pairs of UDATA, so *2
        UDATA pageIndex = heapBaseOffset.div(MM_CompactScheme.sizeof_page).mult(2);
        UDATA compactTableEntry_addr = _heapMapBits.at(pageIndex);
        UDATA compactTableEntry_bits = _heapMapBits.at(pageIndex.add(1));
        // Horribly inefficient -- recomputing relocations every single time!
        if (compactTableEntry_addr.allBitsIn(3)) {
            // Object has been compacted -- assuming that the pointer was the pre-compacted one
            J9ObjectPointer newObject = J9ObjectPointer.cast(compactTableEntry_addr.bitAnd(~3));
            UDATA bits = compactTableEntry_bits;
            UDATA offset = heapBaseOffset.mod(MM_CompactScheme.sizeof_page).div(2 * MM_HeapMap.J9MODRON_HEAP_SLOTS_PER_HEAPMAP_BIT * UDATA.SIZEOF);
            UDATA bitMask = new UDATA(1).leftShift(offset);
            if (bits.bitAnd(bitMask).eq(bitMask)) {
                long mask = 1;
                int ordinal = 0;
                for (int i = offset.intValue(); i > 0; i--) {
                    if (bits.allBitsIn(mask)) {
                        ordinal += 1;
                    }
                    mask <<= 1;
                }
                for (int i = 0; i < ordinal; i++) {
                    UDATA objectSize = ObjectModel.getConsumedSizeInBytesWithHeader(newObject);
                    newObject = newObject.addOffset(objectSize);
                }
                results.add(new MarkedObject(cursor, _heapMapBits.add(pageIndex), newObject));
            }
            cursor = cursor.addOffset(getObjectGrain() * 2);
        } else {
            /* Same as super */
            UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
            UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
            if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
                results.add(new MarkedObject(cursor, slot));
            }
            cursor = cursor.addOffset(getObjectGrain());
        }
    }
    return results.toArray(new MarkedObject[results.size()]);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) ArrayList(java.util.ArrayList) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 5 with UDATAPointer

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

the class RamClassWalker method allSlotsInVTableDo.

private void allSlotsInVTableDo() throws CorruptDataException {
    UDATAPointer vTable = J9ClassHelper.vTable(ramClass);
    final long vTableSlots = Math.max(1, vTable.at(0).longValue());
    classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, vTable, "VTable size");
    for (int i = 1; i < vTableSlots; i++) {
        /*
			 * The first method is a magic method. It's enough of a j9method to
			 * be able to run the resolve code for unresolved virtual references
			 * it doesn't have a rom method associated with it, so there's no
			 * name, etc. The only information about that method is the methodRunAddress.
			 */
        classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, vTable.add(i), ((i == 1) ? "magic " : "") + "method", "!j9method");
    }
    classWalkerCallback.addSection(clazz, ramClass.add(1), vTableSlots * UDATA.SIZEOF, "vTable", true);
}
Also used : UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer)

Aggregations

UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)16 UDATA (com.ibm.j9ddr.vm29.types.UDATA)8 CorruptDataException (com.ibm.j9ddr.CorruptDataException)7 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)6 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)3 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)2 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)2 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)2 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)2 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)2 J9ROMFieldShapePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer)2 J9VMEntryLocalStoragePointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMEntryLocalStoragePointer)2 U32 (com.ibm.j9ddr.vm29.types.U32)2 ArrayList (java.util.ArrayList)2 J9JavaStackIterator (com.ibm.j9ddr.vm29.j9.J9JavaStackIterator)1 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)1 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)1