use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer in project openj9 by eclipse.
the class VmCheckCommand method verifyClassMethods.
private int verifyClassMethods(J9JavaVMPointer vm, PrintStream out, J9ClassPointer clazz) throws CorruptDataException {
int count = 0;
J9ROMClassPointer romClass = clazz.romClass();
int methodCount = romClass.romMethodCount().intValue();
J9MethodPointer methods = clazz.ramMethods();
boolean isInterfaceClass = J9ROMClassHelper.isInterface(romClass);
J9ConstantPoolPointer ramConstantPool = J9ConstantPoolPointer.cast(clazz.ramConstantPool());
for (int i = 0; i < methodCount; i++) {
J9MethodPointer method = methods.add(i);
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(method);
boolean methodInVTable = J9ROMMethodHelper.hasVTable(romMethod);
if (!findROMMethodInClass(vm, romClass, romMethod, methodCount)) {
reportError(out, "romMethod=0x%s (ramMethod=0x%s) not found in romClass=0x%s", Long.toHexString(romMethod.getAddress()), Long.toHexString(method.getAddress()), Long.toHexString(romClass.getAddress()));
}
if (!isInterfaceClass && methodInVTable) {
if (!findMethodInVTable(method, clazz)) {
reportError(out, "romMethod=0x%s (ramMethod=0x%s) not found in vTable of ramClass=0x%s", Long.toHexString(romMethod.getAddress()), Long.toHexString(method.getAddress()), Long.toHexString(clazz.getAddress()));
}
}
if (!ramConstantPool.eq(ConstantPoolHelpers.J9_CP_FROM_METHOD(method))) {
reportError(out, "ramConstantPool=0x%s on ramMethod=0x%s not equal to ramConstantPool=0x%s on ramClass=0x%s", Long.toHexString(ConstantPoolHelpers.J9_CP_FROM_METHOD(method).getAddress()), Long.toHexString(method.getAddress()), Long.toHexString(ramConstantPool.getAddress()), Long.toHexString(clazz.getAddress()));
}
count++;
}
return count;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer in project openj9 by eclipse.
the class CheckVMThreadStacks method dumpStackTrace.
/* TODO : this is an implementation of the internal VM function dumpStackTrace
* and really should be somewhere global and public */
private void dumpStackTrace(J9VMThreadPointer walkThread) {
WalkState walkState = new WalkState();
walkState.walkThread = walkThread;
walkState.flags = J9_STACKWALK_VISIBLE_ONLY | J9_STACKWALK_INCLUDE_NATIVES | J9_STACKWALK_ITERATE_FRAMES;
walkState.callBacks = new BaseStackWalkerCallbacks() {
public FrameCallbackResult frameWalkFunction(J9VMThreadPointer walkThread, WalkState walkState) {
String className = "(unknown class)";
if (walkState.constantPool.notNull()) {
try {
className = J9ClassHelper.getName(walkState.constantPool.ramClass());
} catch (CorruptDataException e) {
// TODO Auto-generated catch block
}
}
if (walkState.method.isNull()) {
getReporter().println(String.format("0x%08X %s (unknown method)", walkState.pc.getAddress(), className));
} else {
if (walkState.jitInfo.isNull()) {
boolean isNative = false;
U8Pointer bytecodes = U8Pointer.NULL;
String name = "(corrupt)";
String sig = "(corrupt)";
try {
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(walkState.method);
isNative = romMethod.modifiers().allBitsIn(J9_JAVA_NATIVE);
if (!isNative) {
bytecodes = J9ROMMethodHelper.bytecodes(romMethod);
}
name = J9ROMMethodHelper.getName(romMethod);
sig = J9ROMMethodHelper.getSignature(romMethod);
} catch (CorruptDataException e) {
// This should never happen
}
if (isNative) {
getReporter().println(String.format(" NATIVE %s.%s%s", className, name, sig));
} else {
getReporter().println(String.format(" %08X %s.%s%s", walkState.pc.sub(bytecodes).longValue(), className, name, sig));
}
} else {
boolean isInlined = walkState.inlineDepth != 0;
U8Pointer jitPC = walkState.pc;
String name = "(corrupt)";
String sig = "(corrupt)";
try {
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(walkState.method);
name = J9UTF8Helper.stringValue(romMethod.nameAndSignature().name());
sig = J9UTF8Helper.stringValue(romMethod.nameAndSignature().signature());
if (!isInlined) {
jitPC = U8Pointer.cast(jitPC.sub(U8Pointer.cast(walkState.method.extra())).longValue());
}
} catch (CorruptDataException e) {
// This should never happen
}
if (isInlined) {
getReporter().println(String.format(" INLINED %s.%s%s (@%s)", className, name, sig, formatPointer(walkState.pc)));
} else {
getReporter().println(String.format(" %08X %s.%s%s (@%s)", jitPC.getAddress(), className, name, sig, formatPointer(walkState.pc)));
}
}
}
return FrameCallbackResult.KEEP_ITERATING;
}
};
StackWalker.walkStackFrames(walkState);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer in project openj9 by eclipse.
the class J9ROMMethodStructureFormatter method postFormat.
@Override
public FormatWalkResult postFormat(String type, long address, PrintStream out, Context context, List<IFieldFormatter> fieldFormatters, String[] extraArgs) {
if (type.equalsIgnoreCase("j9rommethod")) {
J9ROMMethodPointer method = J9ROMMethodPointer.cast(address);
if (!method.isNull()) {
writeMethodName(method, out);
writeNextROMMethodAddress(method, out);
}
}
return FormatWalkResult.KEEP_WALKING;
}
Aggregations