Search in sources :

Example 16 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA 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 17 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA 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 18 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class GCHeapRegionDescriptor_V1 method init.

protected void init() throws CorruptDataException {
    lowAddress = heapRegionDescriptor._lowAddress();
    regionsInSpan = heapRegionDescriptor._regionsInSpan();
    regionType = heapRegionDescriptor._regionType();
    MM_MemorySubSpacePointer subSpace = heapRegionDescriptor._memorySubSpace();
    if (subSpace.notNull()) {
        typeFlags = subSpace._memoryType().bitOr(J9MemorySegment.MEMORY_TYPE_RAM);
    } else {
        typeFlags = new UDATA(0);
    }
    memorySubSpace = heapRegionDescriptor._memorySubSpace();
    memoryPool = heapRegionDescriptor._memoryPool();
    if (regionsInSpan.eq(0)) {
        highAddress = heapRegionDescriptor._highAddress();
    } else {
        UDATA delta = UDATA.cast(heapRegionDescriptor._highAddress()).sub(UDATA.cast(lowAddress));
        highAddress = lowAddress.addOffset(regionsInSpan.mult(delta));
    }
    MM_HeapRegionDescriptorPointer head = heapRegionDescriptor._headOfSpan();
    if (head.isNull() || head.eq(heapRegionDescriptor)) {
        headOfSpan = this;
    } else {
        headOfSpan = GCHeapRegionDescriptor.fromHeapRegionDescriptor(head);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) MM_HeapRegionDescriptorPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorPointer) MM_MemorySubSpacePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MemorySubSpacePointer)

Example 19 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class GCMarkMapStandard method getPageSize.

@Override
public int getPageSize(J9ObjectPointer object) {
    int result = super.getPageSize(object);
    try {
        if ((object != null) && object.gte(_heapBase) && object.lt(_heapTop)) {
            UDATA heapBaseOffset = UDATA.cast(object).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);
            if (compactTableEntry_addr.allBitsIn(3)) {
                result = (int) MM_CompactScheme.sizeof_page;
            }
        }
    } catch (CorruptDataException cde) {
    // Ignore this particular error -- surely the calling code will hit it
    }
    return result;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 20 with UDATA

use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.

the class GCObjectHeapIteratorAddressOrderedList_V1 method advance.

@Override
public void advance(UDATA size) {
    U8Pointer newAddress = scanPtr.addOffset(size);
    if (newAddress.gte(scanPtr) && newAddress.lt(scanPtrTop)) {
        scanPtr = newAddress;
        currentObject = null;
    } else {
        throw new NoSuchElementException("An address to advance is out of range");
    }
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

UDATA (com.ibm.j9ddr.vm29.types.UDATA)86 CorruptDataException (com.ibm.j9ddr.CorruptDataException)22 U32 (com.ibm.j9ddr.vm29.types.U32)16 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)14 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)10 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)10 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)8 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)8 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)7 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)6 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)5 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)4 U16 (com.ibm.j9ddr.vm29.types.U16)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)3 J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)3 J9JITExceptionTablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9JITExceptionTablePointer)3 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)3 IDATA (com.ibm.j9ddr.vm29.types.IDATA)3