use of com.ibm.j9ddr.vm29.pointer.generated.J9IdentityHashDataPointer 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;
}
Aggregations