Search in sources :

Example 61 with UDATA

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

the class GCObjectHeapIteratorSegregated_V1 method hasNext.

public boolean hasNext() {
    try {
        if (null != currentObject) {
            return true;
        }
        while (scanPtr.lt(scanPtrTop)) {
            while (scanPtr.gt(allocationCacheRanges[currentAllocationCacheRange][1])) {
                currentAllocationCacheRange++;
            }
            if (scanPtr.gte(allocationCacheRanges[currentAllocationCacheRange][0])) {
                // We're in an unused region.
                // TODO : this should report as a hole
                scanPtr = U8Pointer.cast(allocationCacheRanges[currentAllocationCacheRange][1]);
                currentAllocationCacheRange++;
                continue;
            }
            currentObject = J9ObjectPointer.cast(scanPtr);
            if (MM_HeapRegionDescriptor$RegionType.SEGREGATED_SMALL == type) {
                if (!ObjectModel.isDeadObject(currentObject)) {
                    UDATA sizeInBytes = ObjectModel.getConsumedSizeInBytesWithHeader(currentObject);
                    if (sizeInBytes.gt(cellSize)) {
                        /* The size of an object should never be greater than the size of its containing cell. */
                        currentObject = null;
                        throw new CorruptDataException("Allocated object at " + scanPtr.getHexAddress() + " has an invalid size of " + sizeInBytes.getHexValue());
                    }
                    scanPtr = scanPtr.add(cellSize);
                    if (includeLiveObjects) {
                        return true;
                    }
                } else {
                    UDATA sizeInBytes = ObjectModel.getSizeInBytesDeadObject(currentObject);
                    if (sizeInBytes.lt(cellSize)) {
                        /* The size of a hole should always be at least the size of a cell. */
                        currentObject = null;
                        throw new CorruptDataException("GCHeapLinkedFreeHeader at " + scanPtr.getHexAddress() + " has an invalid size of " + sizeInBytes.getHexValue());
                    }
                    scanPtr = scanPtr.addOffset(sizeInBytes);
                    if (includeDeadObjects) {
                        return true;
                    }
                }
            } else if (MM_HeapRegionDescriptor$RegionType.SEGREGATED_LARGE == type) {
                scanPtr = U8Pointer.cast(scanPtrTop);
                if (includeLiveObjects) {
                    return true;
                }
            } else {
                throw new CorruptDataException("Invalid region type");
            }
        }
        return false;
    } catch (CorruptDataException e) {
        // can try to recover from this
        raiseCorruptDataEvent("Error getting next item", e, false);
        return false;
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 62 with UDATA

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

the class MMObjectAccessBarrier_V1 method getOwnableSynchronizerLink.

@Override
public J9ObjectPointer getOwnableSynchronizerLink(J9ObjectPointer object) throws CorruptDataException {
    UDATA fieldOffset = getExtensions().accessBarrier()._ownableSynchronizerLinkOffset();
    J9ObjectPointer next = ObjectReferencePointer.cast(object.addOffset(fieldOffset)).at(0);
    if (object.equals(next)) {
        return J9ObjectPointer.NULL;
    }
    return next;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 63 with UDATA

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

the class MMObjectAccessBarrier_V1 method convertPointerFromToken.

/**
 * @see MMObjectAccessBarrier
 */
@Override
public J9ObjectPointer convertPointerFromToken(long token) {
    if (token == 0) {
        return J9ObjectPointer.NULL;
    }
    if (J9BuildFlags.gc_compressedPointers) {
        UDATA ref = new UDATA(token);
        ref = ref.leftShift(shift);
        return J9ObjectPointer.cast(ref);
    } else {
        return J9ObjectPointer.cast(token);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 64 with UDATA

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

the class J9ClassHelper method size.

public static UDATA size(J9ClassPointer clazz, J9JavaVMPointer vm) throws CorruptDataException {
    /*
		 * Size includes up to 7 fragments:
		 * 		0. RAM class header = J9Class struct + vTable + JIT vTable
		 * 		1. RAM methods + extended method block
		 * 		2. Superclasses
		 * 		3. Instance description
		 * 		4. iTable
		 * 		5. Static slots
		 * 		6. Constant pool
		 * 
		 * Array classes omit 1, 3, 5 and 6.
		 */
    // Fragment 0. RAM class header = J9Class struct + vTable + JIT vTable
    UDATA size = new UDATA(J9Class.SIZEOF);
    UDATA vTableSlotCount = vTable(clazz).at(0);
    size = size.add(Scalar.convertSlotsToBytes(vTableSlotCount));
    if (vm.jitConfig().notNull()) {
        UDATA jitVTableSlotCount = vTableSlotCount.sub(1);
        size = size.add(Scalar.convertSlotsToBytes(jitVTableSlotCount));
    }
    if (!J9ROMClassHelper.isArray(clazz.romClass())) {
        // Fragment 1. RAM methods + extended method block
        U32 ramMethodsSize = clazz.romClass().romMethodCount().mult((int) J9Method.SIZEOF);
        size = size.add(ramMethodsSize);
        if (vm.runtimeFlags().allBitsIn(J9Consts.J9_RUNTIME_EXTENDED_METHOD_BLOCK)) {
            UDATA extendedMethodBlockSize = Scalar.roundToSizeofUDATA(new UDATA(clazz.romClass().romMethodCount()));
            size = size.add(extendedMethodBlockSize);
        }
        // Fragment 3. Instance description
        if (!clazz.instanceDescription().anyBitsIn(1)) {
            UDATA highestBitInSlot = new UDATA(UDATA.SIZEOF * 8 - 1);
            UDATA instanceDescriptionSize = clazz.totalInstanceSize().rightShift((int) (ObjectReferencePointer.SIZEOF >> 2) + 1);
            instanceDescriptionSize = instanceDescriptionSize.add(highestBitInSlot).bitAnd(highestBitInSlot.bitNot());
            if (J9BuildFlags.gc_leafBits) {
                instanceDescriptionSize = instanceDescriptionSize.mult(2);
            }
            size = size.add(instanceDescriptionSize);
        }
        // Fragment 5. Static slots
        U32 staticSlotCount = clazz.romClass().objectStaticCount().add(clazz.romClass().singleScalarStaticCount());
        if (J9BuildFlags.env_data64) {
            staticSlotCount = staticSlotCount.add(clazz.romClass().doubleScalarStaticCount());
        } else {
            staticSlotCount = staticSlotCount.add(1).bitAnd(~1L).add(clazz.romClass().doubleScalarStaticCount().mult(2));
        }
        size = size.add(Scalar.convertSlotsToBytes(new UDATA(staticSlotCount)));
        // Fragment 6. Constant pool
        U32 constantPoolSlotCount = clazz.romClass().ramConstantPoolCount().mult(2);
        size = size.add(Scalar.convertSlotsToBytes(new UDATA(constantPoolSlotCount)));
    }
    // Fragment 2. Superclasses
    UDATA classDepth = classDepthAndFlags(clazz).bitAnd(J9JavaAccessFlags.J9AccClassDepthMask);
    if (classDepth.eq(0)) {
        // java/lang/Object has a single slot superclasses array
        size = size.add(UDATA.SIZEOF);
    } else {
        size = size.add(Scalar.convertSlotsToBytes(classDepth));
    }
    // Fragment 4. iTable
    if (clazz.iTable().notNull()) {
        J9ClassPointer superclass = J9ClassPointer.cast(clazz.superclasses().at(classDepth.sub(1)));
        if (superclass.isNull() || !superclass.iTable().eq(clazz.iTable())) {
            J9ITablePointer iTable = J9ITablePointer.cast(clazz.iTable());
            // Scan to the last iTable belonging to classPointer
            if (superclass.isNull()) {
                while (iTable.next().notNull()) {
                    iTable = iTable.next();
                }
            } else {
                while (iTable.next().notNull() && !iTable.next().eq(superclass.iTable())) {
                    iTable = iTable.next();
                }
            }
            // Find the end of the last iTable
            if (clazz.romClass().modifiers().allBitsIn(J9Consts.J9_JAVA_INTERFACE)) {
                iTable = iTable.add(1);
            } else {
                iTable = iTable.add(1).addOffset(iTable.interfaceClass().romClass().romMethodCount().mult(UDATA.SIZEOF));
            }
            size = size.add(iTable.getAddress() - clazz.iTable().getAddress());
        }
    }
    return size;
}
Also used : J9ITablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ITablePointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Example 65 with UDATA

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

the class J9MemTagHelper method ROUNDED_FOOTER_OFFSET.

public static UDATA ROUNDED_FOOTER_OFFSET(UDATA number) {
    UDATA a = (number.add(ROUNDING_GRANULARITY - 1)).add(J9MemTag.SIZEOF);
    UDATA b = new UDATA(ROUNDING_GRANULARITY - 1).bitNot();
    return a.bitAnd(b);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

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