use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer in project openj9 by eclipse.
the class J9ClassHelper method getJavaName.
public static String getJavaName(J9ClassPointer clazz) throws CorruptDataException {
String baseName = getName(clazz);
char ch = baseName.charAt(0);
if (ch != '[') {
return baseName;
}
J9ArrayClassPointer arrayClass = J9ArrayClassPointer.cast(clazz);
int arity = arrayClass.arity().intValue();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < arity; i++) {
buf.append("[]");
}
String aritySuffix = buf.toString();
ch = baseName.charAt(1);
switch(ch) {
case 'B':
return "byte" + aritySuffix;
case 'C':
return "char" + aritySuffix;
case 'D':
return "double" + aritySuffix;
case 'F':
return "float" + aritySuffix;
case 'I':
return "int" + aritySuffix;
case 'J':
return "long" + aritySuffix;
case 'S':
return "void" + aritySuffix;
case 'V':
return "void" + aritySuffix;
case 'Z':
return "boolean" + aritySuffix;
case 'L':
return getName(arrayClass.leafComponentType()) + aritySuffix;
}
// Should never happen
return baseName;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer in project openj9 by eclipse.
the class J9ClassHelper method getMethodFromPCAndClass.
/*
* Returns a program space pointer to the matching J9Method for the
* specified class and PC.
*/
public static J9MethodPointer getMethodFromPCAndClass(J9ClassPointer localClass, U8Pointer pc) throws CorruptDataException {
J9ROMClassPointer localROMClass = localClass.romClass();
for (int i = 0; i < localROMClass.romMethodCount().longValue(); i++) {
J9MethodPointer localMethod = localClass.ramMethods().add(i);
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(localMethod);
boolean a = pc.gte(U8Pointer.cast(romMethod));
boolean b = pc.lte(J9ROMMethodHelper.bytecodeEnd(romMethod).subOffset(1));
if (a && b) {
return localMethod;
}
}
return J9MethodPointer.NULL;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer in project openj9 by eclipse.
the class J9ClassHelper method superclass.
public static J9ClassPointer superclass(J9ClassPointer clazz) throws CorruptDataException {
long index = classDepth(clazz).longValue() - 1;
if (index < 0) {
return J9ClassPointer.NULL;
}
VoidPointer j9ClassInstancePointer = clazz.superclasses().at(index);
return J9ClassPointer.cast(j9ClassInstancePointer);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer in project openj9 by eclipse.
the class RamClassWalker method allSlotsIniTableDo.
private void allSlotsIniTableDo() throws CorruptDataException {
J9ITablePointer iTable = J9ITablePointer.cast(ramClass.iTable());
int interfaceSize = 0;
final J9ITablePointer superclassITable;
final J9ClassPointer superclass = J9ClassHelper.superclass(ramClass);
if (superclass.isNull()) {
superclassITable = J9ITablePointer.NULL;
} else {
superclassITable = J9ITablePointer.cast(superclass.iTable());
}
/*
* Loops through the linked list of interfaces until it hit it's
* superclass'itable
*/
while (!iTable.eq(superclassITable)) {
classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, iTable.interfaceClassEA(), "iTable->interfaceClass", "!j9class");
classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, iTable.nextEA(), "iTable->next", "!j9itable");
/*
* The iTables for the interface classes do not contain entries for
* methods.
*/
if (!ramClass.romClass().modifiers().allBitsIn(J9Consts.J9_JAVA_INTERFACE)) {
int methodCount = iTable.interfaceClass().romClass().romMethodCount().intValue();
for (int i = 0; i < methodCount; i++) {
/*
* Add the method after the iTable. We add i + 1 to the
* iTable.nextEA() because we do not want to print the
* iTable.nextEA() but actually the value after it which
* will be a method
*/
classWalkerCallback.addSlot(clazz, SlotType.J9_iTableMethod, iTable.nextEA().add(i + 1), "method", "!j9method");
interfaceSize += UDATA.SIZEOF;
}
}
iTable = iTable.next();
interfaceSize += J9ITable.SIZEOF;
}
classWalkerCallback.addSection(clazz, ramClass.iTable(), interfaceSize, "iTable", false);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer in project openj9 by eclipse.
the class DumpAllRamClassLinearCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long nestingThreashold;
if (args.length > 1) {
throw new DDRInteractiveCommandException("This debug extension accepts none or one argument!");
} else if (args.length == 1) {
nestingThreashold = Long.valueOf(args[0]);
} else {
nestingThreashold = 1;
}
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (null != vm) {
out.println();
out.println("!j9javavm " + vm.getHexAddress());
} else {
throw new DDRInteractiveCommandException("Unable to find the VM in core dump!");
}
out.println();
ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
out.println("!dumpramclasslinear " + classPointer.getHexAddress());
// RAM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
out.println(String.format("RAM Class '%s' at %s", J9ClassHelper.getJavaName(classPointer), classPointer.getHexAddress()));
out.println();
ClassWalker classWalker = new RamClassWalker(classPointer, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreashold);
out.println();
}
} catch (CorruptDataException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
Aggregations