Search in sources :

Example 56 with UDATA

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

the class GCArrayletObjectModelBase_V1 method getHashcodeOffset.

@Override
public UDATA getHashcodeOffset(J9IndexableObjectPointer array) throws CorruptDataException {
    // Don't call getDataSizeInBytes() since that rounds up to UDATA.
    long layout = getArrayLayout(array);
    J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
    U32 arrayShape = J9ROMArrayClassPointer.cast(clazz.romClass()).arrayShape();
    UDATA numberOfElements = getSizeInElements(array);
    UDATA dataSize = numberOfElements.leftShift(arrayShape.bitAnd(0x0000FFFF).intValue());
    UDATA numberArraylets = numArraylets(dataSize);
    boolean alignData = shouldAlignSpineDataSection(clazz);
    UDATA spineSize = getSpineSize(layout, numberArraylets, dataSize, alignData);
    return U32.roundToSizeofU32(spineSize);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 57 with UDATA

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

the class GCArrayletObjectModelBase_V1 method getArrayLayout.

/**
 * Get the layout of an indexable object given it's class, data size in bytes and the subspace's largestDesirableSpine.
 * @param clazz The class of the object stored in the array.
 * @param dataSizeInBytes the size in bytes of the data of the array.
 * @param largestDesirableSpine The largest desirable spine of the arraylet.
 */
protected long getArrayLayout(J9ArrayClassPointer clazz, UDATA dataSizeInBytes) throws CorruptDataException {
    long layout = GC_ArrayletObjectModelBase$ArrayLayout.Illegal;
    UDATA minimumSpineSize;
    if (J9BuildFlags.gc_hybridArraylets) {
        minimumSpineSize = new UDATA(0);
    } else {
        minimumSpineSize = new UDATA(ObjectReferencePointer.SIZEOF);
    }
    UDATA minimumSpineSizeAfterGrowing = minimumSpineSize;
    if (GCExtensions.isVLHGC()) {
        /* CMVC 170688:  Ensure that we don't try to allocate an inline contiguous array of a size which will overflow the region if it ever grows
			 * (easier to handle this case in the allocator than to special-case the collectors to know how to avoid this case)
			 * (currently, we only grow by a hashcode slot which is 4-bytes but will increase our size by the granule of alignment)
			 */
        minimumSpineSize = minimumSpineSize.add(ObjectModel.getObjectAlignmentInBytes());
    }
    /* CMVC 135307 : when checking for InlineContiguous layout, perform subtraction as adding to dataSizeInBytes could trigger overflow. */
    if (largestDesirableArraySpineSize.eq(UDATA.MAX) || dataSizeInBytes.lte(largestDesirableArraySpineSize.sub(minimumSpineSizeAfterGrowing).sub(J9IndexableObjectContiguous.SIZEOF))) {
        layout = GC_ArrayletObjectModelBase$ArrayLayout.InlineContiguous;
        if (J9BuildFlags.gc_hybridArraylets) {
            if (dataSizeInBytes.eq(0)) {
                /* Zero sized NUA uses the discontiguous shape */
                layout = GC_ArrayletObjectModelBase$ArrayLayout.Discontiguous;
            }
        }
    } else {
        UDATA lastArrayletBytes = dataSizeInBytes.bitAnd(arrayletLeafSizeMask);
        /* determine how large the spine would be if this were a hybrid array */
        UDATA numberArraylets = numArraylets(dataSizeInBytes);
        boolean align = shouldAlignSpineDataSection(clazz);
        UDATA hybridSpineBytes = getSpineSize(GC_ArrayletObjectModelBase$ArrayLayout.Hybrid, numberArraylets, dataSizeInBytes, align);
        UDATA adjustedHybridSpineBytes = ObjectModel.adjustSizeInBytes(hybridSpineBytes);
        UDATA adjustedHybridSpineBytesAfterMove = adjustedHybridSpineBytes;
        if (GCExtensions.isVLHGC()) {
            adjustedHybridSpineBytesAfterMove.add(ObjectModel.getObjectAlignmentInBytes());
        }
        if (lastArrayletBytes.gt(0) && adjustedHybridSpineBytesAfterMove.lte(largestDesirableArraySpineSize)) {
            layout = GC_ArrayletObjectModelBase$ArrayLayout.Hybrid;
        } else {
            layout = GC_ArrayletObjectModelBase$ArrayLayout.Discontiguous;
        }
    }
    return layout;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 58 with UDATA

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

the class GCMemoryPool method freeEntryCheckGeneric.

/**
 * Check individual entries. This check is the same for ALL collectors
 * @param freeListEntry A structure to a free entry for all collectors (except Balanced)
 * @throws CorruptFreeEntryException This needs to be caught by a listener to be of any use
 * @return None. This function throws exceptions which are caught by the listener in checkFreeLists()
 */
protected void freeEntryCheckGeneric(GCHeapLinkedFreeHeader freeListEntry) throws CorruptDataException, CorruptFreeEntryException {
    MM_HeapLinkedFreeHeaderPointer freeListEntryAddress = freeListEntry.getHeader();
    UDATA size = freeListEntry.getSize();
    GCHeapRegionDescriptor region = getRegion();
    U8Pointer entryEndingAddressInclusive = U8Pointer.cast(freeListEntry.getHeader()).add(size.sub(1));
    if (freeListEntry.getHeader().isNull()) {
        throw new CorruptFreeEntryException("freeEntryCorrupt", freeListEntryAddress);
    }
    /* Make sure its a multi-slot dead object */
    if (!(ObjectModel.isDeadObject(freeListEntry.getObject()) && !ObjectModel.isSingleSlotDeadObject(freeListEntry.getObject()))) {
        throw new CorruptFreeEntryException("freeEntryCorrupt", freeListEntryAddress);
    }
    /* Self checks */
    if (!region.isAddressInRegion(VoidPointer.cast(freeListEntryAddress))) {
        throw new CorruptFreeEntryException("freeEntryCorrupt", freeListEntryAddress);
    }
    if (!region.isAddressInRegion(VoidPointer.cast(entryEndingAddressInclusive))) {
        throw new CorruptFreeEntryException("sizeFieldInvalid", freeListEntryAddress);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) MM_HeapLinkedFreeHeaderPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapLinkedFreeHeaderPointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 59 with UDATA

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

the class GCContiguousArrayObjectModel_V1 method getHashcodeOffset.

public UDATA getHashcodeOffset(J9IndexableObjectPointer array) throws CorruptDataException {
    J9ArrayClassPointer clazz = J9IndexableObjectHelper.clazz(array);
    UDATA numberOfElements = getSizeInElements(array);
    J9ROMArrayClassPointer romArrayClass = J9ROMArrayClassPointer.cast(clazz.romClass());
    UDATA size = numberOfElements.leftShift(romArrayClass.arrayShape().bitAnd(0xFFFF).intValue());
    size = size.add(J9IndexableObjectContiguous.SIZEOF);
    return UDATA.roundToSizeofU32(size);
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) J9ROMArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMArrayClassPointer) J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 60 with UDATA

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

the class GCHeapMap method getSlotIndexAndMask.

/**
 * Return the index into the heap map bits array and the bitmask to use.
 * @param object
 * @return an array containing the slot index and bit mask
 */
public UDATA[] getSlotIndexAndMask(J9ObjectPointer object) {
    UDATA heapBaseOffset = UDATA.cast(object).sub(UDATA.cast(_heapBase));
    if (heapBaseOffset.gte(_maxOffset)) {
        throw new IllegalArgumentException("Object is not in heap: " + object);
    }
    UDATA bitIndex = heapBaseOffset.bitAnd(_heapMapBitMask);
    bitIndex = bitIndex.rightShift(_heapMapBitShift);
    UDATA bitMask = new UDATA(1).leftShift(bitIndex);
    UDATA slotIndex = heapBaseOffset.rightShift(new UDATA(_heapMapIndexShift));
    UDATA[] result = new UDATA[2];
    result[0] = slotIndex;
    result[1] = bitMask;
    return result;
}
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