Search in sources :

Example 51 with UDATA

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

the class ObjectHash method getSalt.

private static U32 getSalt(J9JavaVMPointer vm, UDATA objectPointer) throws CorruptDataException {
    /* set up the default salt */
    U32 salt = (new U32(1421595292)).bitXor(new U32(UDATA.cast(vm)));
    J9IdentityHashDataPointer hashData = vm.identityHashData();
    UDATA saltPolicy = hashData.hashSaltPolicy();
    /* Replacing case statement in C with an if-else if statements since case expressions must use constant */
    if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_STANDARD)) {
        /* Gencon/optavgpause/optthruput use the default salt for non heap and
			 * tenure space but they use a table salt for the nursery.
			 *
			 * hashData->hashData1 is nursery base
			 * hashData->hashData2 is nursery top
			 */
        if (objectPointer.gte(hashData.hashData1())) {
            if (objectPointer.lt(hashData.hashData2())) {
                /* Object is in the nursery */
                salt = hashData.hashSaltTableEA().at(0);
            } else {
            /* not in the heap so use default salt */
            }
        } else {
        /* not in the nursery so use default salt */
        }
    } else if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_REGION)) {
        if (objectPointer.gte(hashData.hashData1())) {
            if (objectPointer.lt(hashData.hashData2())) {
                UDATA heapDelta = objectPointer.sub(hashData.hashData1());
                UDATA index = heapDelta.rightShift(hashData.hashData3());
                salt = hashData.hashSaltTableEA().at(index);
            } else {
            /* not in the heap so use default salt */
            }
        } else {
        /* not in the heap so use default salt */
        }
    } else if (saltPolicy.eq(J9IdentityHashData.J9_IDENTITY_HASH_SALT_POLICY_NONE)) {
    /* Use default salt */
    } else {
        /* Unrecognized salt policy.  Should assert but we are in util */
        throw new CorruptDataException("Invalid salt policy");
    }
    return salt;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9IdentityHashDataPointer(com.ibm.j9ddr.vm29.pointer.generated.J9IdentityHashDataPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 52 with UDATA

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

the class ObjectMonitor_V1 method initializeOwnerAndCount.

private void initializeOwnerAndCount() throws CorruptDataException {
    if (isInflated) {
        J9ThreadPointer osOwner = monitor.owner();
        if (osOwner.notNull()) {
            owner = J9ThreadHelper.getVMThread(osOwner);
            count = monitor.count().longValue();
            if (count == 0) {
                owner = J9VMThreadPointer.NULL;
            }
        } else {
            owner = J9VMThreadPointer.NULL;
        }
    } else {
        owner = J9VMThreadPointer.cast(lockword.untag(OBJECT_HEADER_LOCK_BITS_MASK));
        if (owner.notNull()) {
            UDATA base = UDATA.cast(lockword).bitAnd(OBJECT_HEADER_LOCK_BITS_MASK).rightShift((int) OBJECT_HEADER_LOCK_RECURSION_OFFSET);
            if (J9BuildFlags.thr_lockReservation) {
                if (!lockword.allBitsIn(OBJECT_HEADER_LOCK_RESERVED)) {
                    base = base.add(1);
                }
                count = base.longValue();
            } else {
                count = base.add(1).longValue();
            }
            if (count == 0) {
                /* this can happen if the lock is reserved but unowned */
                owner = J9VMThreadPointer.NULL;
            }
        }
    }
    ownerAndCountInitialized = true;
}
Also used : J9ThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer) UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 53 with UDATA

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

the class StringTable method cacheIterator.

public SlotIterator<J9ObjectPointer> cacheIterator() {
    return new SlotIterator<J9ObjectPointer>() {

        private UDATA cacheTableIndex;

        private UDATA cacheSize;

        private PointerPointer cache;

        {
            // Instance initialiser
            cacheTableIndex = new UDATA(0);
            try {
                cacheSize = getCacheSize();
                cache = _stringTable._cacheEA();
            } catch (CorruptDataException e) {
                raiseCorruptDataEvent("Error getting next item", e, false);
                cacheSize = new UDATA(0);
            }
        }

        public boolean hasNext() {
            while (cacheTableIndex.lt(cacheSize)) {
                try {
                    if (cache.at(cacheTableIndex).notNull()) {
                        return true;
                    }
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                }
                cacheTableIndex = cacheTableIndex.add(1);
            }
            return false;
        }

        public J9ObjectPointer next() {
            if (hasNext()) {
                try {
                    J9ObjectPointer cachedString = J9ObjectPointer.cast(cache.at(cacheTableIndex));
                    cacheTableIndex = cacheTableIndex.add(1);
                    return cachedString;
                } catch (CorruptDataException e) {
                    raiseCorruptDataEvent("Error getting next item", e, false);
                    return null;
                }
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public VoidPointer nextAddress() {
            if (hasNext()) {
                VoidPointer address = VoidPointer.cast(cache.add(cacheTableIndex));
                cacheTableIndex = cacheTableIndex.add(1);
                return address;
            } else {
                throw new NoSuchElementException("There are no more items available through this iterator");
            }
        }

        public void remove() {
            throw new UnsupportedOperationException("The image is read only and cannot be modified.");
        }
    };
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 54 with UDATA

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

the class GCArrayletObjectModel_V1 method getTotalFootprintInBytesWithHeader.

@Override
public UDATA getTotalFootprintInBytesWithHeader(J9IndexableObjectPointer arrayPtr) throws CorruptDataException {
    UDATA spineSize = getSizeInBytesWithHeader(arrayPtr);
    UDATA externalArrayletSize = externalArrayletsSize(arrayPtr);
    UDATA totalFootprint = spineSize.add(externalArrayletSize);
    return totalFootprint;
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA)

Example 55 with UDATA

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

the class GCCardTable method cardAddrToHeapAddr.

public VoidPointer cardAddrToHeapAddr(U8Pointer cardAddr) {
    /* Check passed card address is within the card table  */
    // Assert_MM_true((void *)cardAddr >= getCardTableStart());
    // Assert_MM_true((void *)cardAddr < _cardTableMemory->getHeapTop());
    UDATA index = UDATA.cast(cardAddr).sub(UDATA.cast(_cardTableStart));
    UDATA delta = index.leftShift(CARD_SIZE_SHIFT);
    return _heapBase.addOffset(delta);
}
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