use of com.ibm.j9ddr.vm29.pointer.U32Pointer in project openj9 by eclipse.
the class J9BCUtil method dumpStackMapTable.
private static void dumpStackMapTable(PrintStream out, J9ROMClassPointer romclass, J9ROMMethodPointer romMethod, long flags) throws CorruptDataException {
U32Pointer stackMapMethod = ROMHelp.getStackMapFromROMMethod(romMethod);
U16 stackMapCount;
U8Pointer stackMapData;
long mapPC = -1;
long mapType;
if (stackMapMethod.notNull()) {
stackMapData = U8Pointer.cast(stackMapMethod.add(1));
stackMapCount = new U16(stackMapData.at(0)).leftShift(8).bitOr(stackMapData.at(1));
stackMapData = stackMapData.add(2);
out.println("\n StackMapTable\n Stackmaps(" + stackMapCount.intValue() + "):");
for (int i = 0; i < stackMapCount.intValue(); i++) {
mapPC++;
mapType = stackMapData.at(0).longValue();
stackMapData = stackMapData.add(1);
if (mapType < 64) {
mapPC += mapType;
out.println(" pc: " + mapPC + " same");
} else if (mapType < 128) {
mapPC += (mapType - 64);
out.print(" pc: " + mapPC + " same_locals_1_stack_item: ");
stackMapData = dumpStackMapSlots(out, romclass, stackMapData, 1);
out.println();
} else if (mapType < 247) {
out.println(" UNKNOWN FRAME TAG: (" + mapType + ")\n");
} else if (mapType == 247) {
long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
mapPC += offset;
out.print(" pc: " + mapPC + " same_locals_1_stack_item_extended: ");
stackMapData = dumpStackMapSlots(out, romclass, stackMapData, 1);
out.println();
} else if (mapType < 251) {
long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
mapPC += offset;
out.println(" pc: " + mapPC + " chop " + (251 - mapType));
} else if (mapType == 251) {
long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
mapPC += offset;
out.println(" pc: " + mapPC + " same_extended\n");
} else if (mapType < 255) {
long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
mapPC += offset;
out.print(" pc: " + mapPC + " append: ");
stackMapData = dumpStackMapSlots(out, romclass, stackMapData, (mapType - 251));
out.println();
} else if (mapType == 255) {
long offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
mapPC += offset;
out.print(" pc: " + mapPC + " full, local(s): ");
offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
stackMapData = dumpStackMapSlots(out, romclass, stackMapData, offset);
out.print(", stack: ");
offset = new U16(stackMapData.at(0)).leftShift(8).add(stackMapData.at(1)).longValue();
stackMapData = stackMapData.add(2);
stackMapData = dumpStackMapSlots(out, romclass, stackMapData, offset);
out.println();
}
}
}
}
use of com.ibm.j9ddr.vm29.pointer.U32Pointer in project openj9 by eclipse.
the class VmCheckCommand method verifyJ9ROMClass.
private void verifyJ9ROMClass(PrintStream out, J9JavaVMPointer vm, J9ClassPointer clazz) throws CorruptDataException {
J9ROMClassPointer romClass = clazz.romClass();
J9ClassLoaderPointer classLoader = clazz.classLoader();
J9MemorySegmentPointer segment = findSegmentInClassLoaderForAddress(classLoader, romClass);
if (!segment.isNull()) {
long address;
if (romClass.interfaceCount().longValue() != 0) {
address = romClass.interfaces().getAddress();
verifyAddressInSegment(out, vm, segment, address, "romClass->interfaces");
}
if (romClass.romMethodCount().longValue() != 0) {
address = romClass.romMethods().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->romMethods");
}
if (romClass.romFieldCount().longValue() != 0) {
address = romClass.romFields().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->romFields");
}
if (romClass.innerClassCount().longValue() != 0) {
address = romClass.innerClasses().longValue();
verifyAddressInSegment(out, vm, segment, address, "romClass->innerClasses");
}
U32Pointer cpShapeDescription = romClass.cpShapeDescription();
/* TODO: is !isNull() check required or not? */
if (!cpShapeDescription.isNull()) {
address = cpShapeDescription.getAddress();
verifyAddressInSegment(out, vm, segment, address, "romClass->cpShapeDescription");
}
}
{
J9UTF8Pointer className = romClass.className();
J9UTF8Pointer superclassName = romClass.superclassName();
J9UTF8Pointer outerClassName = romClass.outerClassName();
if (className.isNull() || !verifyUTF8(className)) {
reportError(out, "invalid className=0x%s utf8 for romClass=0x%s", Long.toHexString(className.getAddress()), Long.toHexString(romClass.getAddress()));
}
if (!superclassName.isNull() && !verifyUTF8(superclassName)) {
reportError(out, "invalid superclassName=0x%s utf8 for romClass=0x%s", Long.toHexString(superclassName.getAddress()), Long.toHexString(romClass.getAddress()));
}
if (!outerClassName.isNull() && !verifyUTF8(outerClassName)) {
reportError(out, "invalid outerclassName=0x%s utf8 for romClass=0x%s", Long.toHexString(outerClassName.getAddress()), Long.toHexString(romClass.getAddress()));
}
}
U32 ramConstantPoolCount = romClass.ramConstantPoolCount();
U32 romConstantPoolCount = romClass.romConstantPoolCount();
if (ramConstantPoolCount.gt(romConstantPoolCount)) {
reportError(out, "ramConstantPoolCount=%d > romConstantPoolCount=%d for romClass=0x%s", ramConstantPoolCount.longValue(), romConstantPoolCount.longValue(), Long.toHexString(romClass.getAddress()));
}
}
use of com.ibm.j9ddr.vm29.pointer.U32Pointer 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.pointer.U32Pointer in project openj9 by eclipse.
the class Pool_29_V0 method isPuddleSlotFree.
// PUDDLE_SLOT_FREE
private boolean isPuddleSlotFree(J9PoolPuddlePointer currentPuddle) throws CorruptDataException {
U32Pointer ptr = U32Pointer.cast(currentPuddle.add(1));
ptr = ptr.add(slot / 32);
long value = ptr.at(0).longValue();
int bitmask = (1 << (31 - slot % 32));
return (value & bitmask) != 0;
}
use of com.ibm.j9ddr.vm29.pointer.U32Pointer in project openj9 by eclipse.
the class J9MemTagHelper method checkTagSumCheck.
/**
* Checks that the memory tag is not corrupt.
*
* @param[in] tagAddress the in-process or out-of-process address of the
* header/footer memory tag
* @param[in] eyeCatcher the eyecatcher corresponding to the memory tag
*
* @return 0 if the sum check is successful, non-zero otherwise
* @throws CorruptDataException
*/
public static void checkTagSumCheck(J9MemTagPointer tag, long eyeCatcher) throws CorruptDataException {
int sum = 0;
U32Pointer slots;
if (!checkEyecatcher(tag, eyeCatcher)) {
throw new J9MemTagCheckError(tag, "Wrong eyecatcher. Expected 0x" + Long.toHexString(eyeCatcher) + " but was " + UDATA.cast(tag).getHexValue());
}
slots = U32Pointer.cast(tag);
/*
* Could be unrolled into chained xors with a J9VM_ENV_DATA64
* conditional on the extra 2 U_32s
*/
for (int i = 0; i < (J9MemTag.SIZEOF / U32.SIZEOF); i++) {
sum ^= slots.at(i).longValue();
}
if (J9BuildFlags.env_data64) {
U32 a = new U32(UDATA.cast(tag).rightShift(32));
U32 b = new U32(UDATA.cast(tag).bitAnd(U32.MAX));
sum ^= a.longValue() ^ b.longValue();
} else {
sum ^= tag.longValue();
}
if (sum != 0) {
throw new J9MemTagCheckError(tag, "J9MemTag sumcheck failed: " + sum);
}
}
Aggregations