Search in sources :

Example 6 with IDATA

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

the class MarkMapCommand method fromBits.

protected void fromBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
    UDATAPointer markSlot = UDATAPointer.cast(address);
    UDATAPointer base = markMap.getHeapMapBits();
    UDATA maxOffset = markMap.getSlotIndexAndMask(J9ObjectPointer.cast(markMap.getHeapTop().subOffset(markMap.getObjectGrain())))[0];
    maxOffset = maxOffset.add(1);
    UDATAPointer top = base.add(maxOffset);
    if (markSlot.gte(base) && markSlot.lte(top)) {
        IDATA delta = markSlot.sub(base);
        int pageSize = markMap.getPageSize(null);
        // obviously not right for metronome
        delta = delta.mult(pageSize);
        J9ObjectPointer rangeBase = J9ObjectPointer.cast(markMap.getHeapBase().addOffset(delta));
        J9ObjectPointer rangeTop = rangeBase.addOffset(pageSize);
        out.format("Mark bits at %s corresponds to heap range %s -> %s\n", markSlot.getHexAddress(), rangeBase.getHexAddress(), rangeTop.getHexAddress());
    } else {
        out.format("Address %s is not in the mark map\n", markSlot.getHexAddress());
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) IDATA(com.ibm.j9ddr.vm29.types.IDATA) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 7 with IDATA

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

the class CheckEngine method checkJ9ClassPointer.

public int checkJ9ClassPointer(J9ClassPointer clazz, boolean allowUndead) throws CorruptDataException {
    // Java-ism. Need to check this first before doing compares etc.
    if (clazz == null || clazz.isNull()) {
        return J9MODRON_GCCHK_RC_NULL_CLASS_POINTER;
    }
    // Short circuit if we've recently checked this class.
    int cacheIndex = (int) (clazz.longValue() % CLASS_CACHE_SIZE);
    if (allowUndead && clazz.eq(_checkedClassCacheAllowUndead[cacheIndex])) {
        return J9MODRON_GCCHK_RC_OK;
    } else if (clazz.eq(_checkedClassCache[cacheIndex])) {
        return J9MODRON_GCCHK_RC_OK;
    }
    if (UDATA.cast(clazz).anyBitsIn(J9MODRON_GCCHK_J9CLASS_ALIGNMENT_MASK)) {
        return J9MODRON_GCCHK_RC_CLASS_POINTER_UNALIGNED;
    }
    J9MemorySegmentPointer segment = findSegmentForClass(clazz);
    if (segment == null) {
        return J9MODRON_GCCHK_RC_CLASS_NOT_FOUND;
    }
    if (!allowUndead) {
        if ((segment.type().longValue() & MEMORY_TYPE_UNDEAD_CLASS) != 0) {
            return J9MODRON_GCCHK_RC_CLASS_IS_UNDEAD;
        }
    }
    /* Check to ensure J9Class header has the correct eyecatcher. */
    int result = checkJ9ClassHeader(clazz);
    if (J9MODRON_GCCHK_RC_OK != result) {
        return result;
    }
    /* Check to ensure J9Class is not unloaded */
    result = checkJ9ClassIsNotUnloaded(clazz);
    if (J9MODRON_GCCHK_RC_OK != result) {
        return result;
    }
    if ((_cycle.getCheckFlags() & J9MODRON_GCCHK_VERIFY_RANGE) != 0) {
        IDATA delta = segment.heapAlloc().sub(U8Pointer.cast(clazz));
        /* Basic check that there is enough room for the class header */
        if (delta.lt(J9Class.SIZEOF)) {
            return J9MODRON_GCCHK_RC_CLASS_INVALID_RANGE;
        }
    }
    /* class checked out. Record it in the cache so we don't need to check it again. */
    if (allowUndead) {
        _checkedClassCacheAllowUndead[cacheIndex] = clazz;
    } else {
        _checkedClassCache[cacheIndex] = clazz;
    }
    return J9MODRON_GCCHK_RC_OK;
}
Also used : IDATA(com.ibm.j9ddr.vm29.types.IDATA) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)

Aggregations

IDATA (com.ibm.j9ddr.vm29.types.IDATA)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)4 U32 (com.ibm.j9ddr.vm29.types.U32)2 AddressedCorruptDataException (com.ibm.j9ddr.AddressedCorruptDataException)1 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)1 U16Pointer (com.ibm.j9ddr.vm29.pointer.U16Pointer)1 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9MemTagPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemTagPointer)1 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)1 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)1 J9ROMClassRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassRefPointer)1 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)1 J9ROMFieldRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldRefPointer)1 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)1 J9ROMMethodRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodRefPointer)1 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)1 J9ROMSingleSlotConstantRefPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMSingleSlotConstantRefPointer)1 I16 (com.ibm.j9ddr.vm29.types.I16)1