Search in sources :

Example 11 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer 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 12 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer 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 13 with J9ObjectPointer

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

the class GCObjectModel_V1 method getScanType.

@Override
public long getScanType(J9ObjectPointer object) throws CorruptDataException {
    long result;
    J9ClassPointer clazz = J9ObjectHelper.clazz(object);
    return getScanType(clazz);
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Example 14 with J9ObjectPointer

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

the class GCObjectHeapIteratorAddressOrderedList_V1 method next.

@Override
public J9ObjectPointer next() {
    if (hasNext()) {
        J9ObjectPointer next = currentObject;
        advanceScanPointer();
        return next;
    } else {
        throw new NoSuchElementException("There are no more items available through this iterator");
    }
}
Also used : J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 15 with J9ObjectPointer

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

the class GCPointerArrayletIterator_V1 method next.

@Override
public J9ObjectPointer next() {
    J9ObjectPointer next = null;
    try {
        if (hasNext()) {
            if (includeClassSlot) {
                includeClassSlot = false;
                next = J9ObjectHelper.clazz(object).classObject();
            } else {
                VoidPointer elementAddress = indexableObjectModel.getElementAddress(J9IndexableObjectPointer.cast(object), scanIndex, (int) ObjectReferencePointer.SIZEOF);
                next = ObjectReferencePointer.cast(elementAddress).at(0);
                scanIndex++;
            }
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException e) {
        // can try to recover from this
        raiseCorruptDataEvent("Error getting next item", e, false);
    }
    return next;
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)76 CorruptDataException (com.ibm.j9ddr.CorruptDataException)48 UDATA (com.ibm.j9ddr.vm29.types.UDATA)22 NoSuchElementException (java.util.NoSuchElementException)18 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)17 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)12 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)7 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)6 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)5 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)5 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)4 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)4 ArrayList (java.util.ArrayList)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)3 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)3