use of com.ibm.j9ddr.vm29.types.U32 in project openj9 by eclipse.
the class J9ObjectStructureFormatter method printSubArrayType.
void printSubArrayType(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, int begin, int end, J9IndexableObjectPointer array) throws CorruptDataException {
U32 arraySize = J9IndexableObjectHelper.size(array);
if (arraySize.anyBitsIn(0x80000000)) {
arraySize = new U32(Integer.MAX_VALUE);
}
int finish = Math.min(arraySize.intValue(), end);
if (begin < finish) {
String className = J9IndexableObjectHelper.getClassName(array);
char signature = className.charAt(1);
switch(signature) {
case 'B':
case 'Z':
for (int index = begin; index < finish; index++) {
padding(out, tabLevel);
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, 1);
out.println(String.format("[%d] = %3d, 0x%02x", index, U8Pointer.cast(slot).at(0).longValue(), U8Pointer.cast(slot).at(0).longValue()));
}
break;
case 'C':
for (int index = begin; index < finish; index++) {
padding(out, tabLevel);
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, 2);
long value = U16Pointer.cast(slot).at(0).longValue();
out.println(String.format("[%d] = %5d, 0x%2$04x, '%c'", index, value, (char) value));
}
break;
case 'S':
for (int index = begin; index < finish; index++) {
padding(out, tabLevel);
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, 2);
out.println(String.format("[%d] = %6d, 0x%04x", index, I16Pointer.cast(slot).at(0).longValue(), U16Pointer.cast(slot).at(0).longValue()));
}
break;
case 'I':
case 'F':
for (int index = begin; index < finish; index++) {
padding(out, tabLevel);
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, 4);
out.println(String.format("[%d] = %10d, 0x%08x, %8.8fF", index, I32Pointer.cast(slot).at(0).longValue(), U32Pointer.cast(slot).at(0).longValue(), FloatPointer.cast(slot).floatAt(0)));
}
break;
case 'J':
case 'D':
for (int index = begin; index < finish; index++) {
padding(out, tabLevel);
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, 8);
out.println(String.format("[%d] = %2d, 0x%016x, %8.8fF", index, I64Pointer.cast(slot).at(0).longValue(), I64Pointer.cast(slot).at(0).longValue(), DoublePointer.cast(slot).doubleAt(0)));
}
break;
case 'L':
case '[':
for (int index = begin; index < finish; index++) {
VoidPointer slot = J9IndexableObjectHelper.getElementEA(array, index, (int) ObjectReferencePointer.SIZEOF);
if (slot.notNull()) {
long compressedPtrValue;
if (J9BuildFlags.gc_compressedPointers) {
compressedPtrValue = I32Pointer.cast(slot).at(0).longValue();
} else {
compressedPtrValue = DataType.getProcess().getPointerAt(slot.getAddress());
}
padding(out, tabLevel);
out.println(String.format("[%d] = !fj9object 0x%x = !j9object 0x%x", index, compressedPtrValue, ObjectReferencePointer.cast(slot).at(0).longValue()));
} else {
padding(out, tabLevel);
out.println(String.format("[%d] = null", slot));
}
}
break;
}
}
/* check if it just printed a range; if so, give cmd to see all data */
arraySize = J9IndexableObjectHelper.size(array);
if (begin > 0 || arraySize.longValue() > finish) {
out.println(String.format("To print entire range: !j9indexableobject %s %d %d\n", array.getHexAddress(), 0, arraySize.longValue()));
}
}
use of com.ibm.j9ddr.vm29.types.U32 in project openj9 by eclipse.
the class J9ObjectStructureFormatter method formatArrayObject.
private void formatArrayObject(PrintStream out, J9ClassPointer localClazz, U8Pointer dataStart, J9IndexableObjectPointer localObject, int begin, int end) throws CorruptDataException {
String className = J9IndexableObjectHelper.getClassName(localObject);
out.print(String.format("!J9IndexableObject %s {", localObject.getHexAddress()));
out.println();
/* print individual fields */
out.println(String.format(" struct J9Class* clazz = !j9arrayclass 0x%X // %s", localClazz.getAddress(), className));
out.println(String.format(" Object flags = %s;", J9IndexableObjectHelper.flags(localObject).getHexValue()));
U32 size = J9IndexableObjectHelper.size(localObject);
if (!J9BuildFlags.thr_lockNursery) {
out.println(String.format(" j9objectmonitor_t monitor = %s;", J9IndexableObjectHelper.monitor(localObject).getHexValue()));
}
if (size.anyBitsIn(0x80000000)) {
out.println(String.format(" U_32 size = %s; // Size exceeds Integer.MAX_VALUE!", size.getHexValue()));
} else {
out.println(String.format(" U_32 size = %s;", size.getHexValue()));
}
printSubArrayType(out, 1, localClazz, dataStart, begin, end, localObject);
out.println("}");
}
use of com.ibm.j9ddr.vm29.types.U32 in project openj9 by eclipse.
the class J9ObjectFieldOffsetIterator_V1 method fieldOffsetsFindNext.
// Based on fieldOffsetsFindNext from resolvefield.c
private void fieldOffsetsFindNext() throws CorruptDataException {
while (romFieldsShapeIterator.hasNext()) {
J9ROMFieldShapePointer localField = (J9ROMFieldShapePointer) romFieldsShapeIterator.next();
U32 modifiers = localField.modifiers();
/* count the index for jvmti */
index = index.add(1);
if (modifiers.anyBitsIn(J9AccStatic)) {
if (walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC)) {
/* found a static, the walk wants statics */
if (modifiers.anyBitsIn(J9FieldFlagObject)) {
offset = new UDATA(objectStaticsSeen.mult(UDATA.SIZEOF));
objectStaticsSeen = objectStaticsSeen.add(1);
field = localField;
break;
} else if (!(walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_ONLY_OBJECT_SLOTS))) {
if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
/* Add single scalar and object counts together, round up to 2 and divide by 2 to get number of doubles used by singles */
UDATA doubleSlots;
if (J9BuildFlags.env_data64) {
doubleSlots = new UDATA(romClass.objectStaticCount().add(romClass.singleScalarStaticCount()));
} else {
doubleSlots = new UDATA(romClass.objectStaticCount().add(romClass.singleScalarStaticCount()).add(1)).rightShift(1);
}
offset = doubleSlots.mult(U64.SIZEOF).add(doubleStaticsSeen.mult(U64.SIZEOF));
doubleStaticsSeen = doubleStaticsSeen.add(1);
} else {
offset = new UDATA(romClass.objectStaticCount().mult(UDATA.SIZEOF).add(singleStaticsSeen.mult(UDATA.SIZEOF)));
singleStaticsSeen = singleStaticsSeen.add(1);
}
field = localField;
break;
}
}
} else {
if (walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_INCLUDE_INSTANCE)) {
if (modifiers.anyBitsIn(J9FieldFlagObject)) {
if (walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_BACKFILL_OBJECT_FIELD)) {
// Assert_VM_true(state->backfillOffsetToUse >= 0);
offset = new UDATA(backfillOffsetToUse);
walkFlags = walkFlags.bitAnd(new U32(new UDATA(J9VM_FIELD_OFFSET_WALK_BACKFILL_OBJECT_FIELD).bitNot()));
} else {
offset = firstObjectOffset.add(objectsSeen.mult(fj9object_t_SizeOf));
objectsSeen = objectsSeen.add(1);
}
field = localField;
break;
} else if (!walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_ONLY_OBJECT_SLOTS)) {
if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
offset = firstDoubleOffset.add(doubleSeen.mult(U64.SIZEOF));
doubleSeen = doubleSeen.add(1);
} else {
if (walkFlags.anyBitsIn(J9VM_FIELD_OFFSET_WALK_BACKFILL_SINGLE_FIELD)) {
// Assert_VM_true(state->backfillOffsetToUse >= 0);
offset = new UDATA(backfillOffsetToUse);
walkFlags = walkFlags.bitAnd(new U32(new UDATA(J9VM_FIELD_OFFSET_WALK_BACKFILL_SINGLE_FIELD).bitNot()));
} else {
offset = firstSingleOffset.add(singlesSeen.mult(U32.SIZEOF));
singlesSeen = singlesSeen.add(1);
}
}
field = localField;
break;
}
}
}
}
// At this point all the info we need is stashed away in private state variables
return;
}
use of com.ibm.j9ddr.vm29.types.U32 in project openj9 by eclipse.
the class ConstantPoolHelpers method J9_CP_TYPE.
/**
* This method is Java implementation of the define J9_CP_TYPE in j9cp.h in VM.
* It basically find out the type of the constant pool entry at the given index.
*
* #define J9_CP_TYPE(cpShapeDescription, index) \
* (((cpShapeDescription)[(index) / J9_CP_DESCRIPTIONS_PER_U32] >> \
* (((index) % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)) & J9_CP_DESCRIPTION_MASK)
*
* @param cpShapeDescription Description of the constantPool
* @param index Type index
* @return Type
* @throws CorruptDataException
*/
public static long J9_CP_TYPE(U32Pointer cpShapeDescription, int index) throws CorruptDataException {
U32 cpDescription = cpShapeDescription.at(index / J9_CP_DESCRIPTIONS_PER_U32);
long shapeDesc = cpDescription.rightShift((int) ((index % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)).bitAnd(J9_CP_DESCRIPTION_MASK).longValue();
return shapeDesc;
}
use of com.ibm.j9ddr.vm29.types.U32 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