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;
}
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;
}
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.");
}
};
}
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;
}
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);
}
Aggregations