use of com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer in project openj9 by eclipse.
the class J9BCUtil method dumpMethodParameters.
private static void dumpMethodParameters(PrintStream out, J9ROMClassPointer romclass, J9ROMMethodPointer romMethod, long flags) throws CorruptDataException {
J9MethodParametersDataPointer methodParameters = ROMHelp.getMethodParametersFromROMMethod(romMethod);
if (methodParameters != J9MethodParametersDataPointer.NULL) {
J9MethodParameterPointer parameters = methodParameters.parameters();
out.println(String.format(" Method Parameters (%d):\n", methodParameters.parameterCount().longValue()));
for (int i = 0; i < methodParameters.parameterCount().longValue(); i++) {
J9UTF8Pointer name = J9UTF8Pointer.cast(parameters.nameEA().get());
long parameterFlags = parameters.flags().longValue();
if (name.isNull()) {
out.print(" <no name>");
} else {
out.print(" " + J9UTF8Helper.stringValue(name));
}
out.print(String.format(" 0x%x ( ", parameterFlags));
dumpModifiers(out, parameterFlags, ONLY_SPEC_MODIFIERS, MODIFIERSOURCE_METHODPARAMETER);
out.println(" )\n");
}
out.println("\n");
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer in project openj9 by eclipse.
the class J9BCUtil method dumpStackMapSlots.
static U8Pointer dumpStackMapSlots(PrintStream out, J9ROMClassPointer classfile, U8Pointer slotData, long slotCount) throws CorruptDataException {
int slotType;
String[] slotTypes = { "top", "int", "float", "double", "long", "null", "uninitialized_this" };
String[] primitiveArrayTypes = { "I", "F", "D", "J", "S", "B", "C", "Z" };
out.print("(");
for (int i = 0; i < slotCount; i++) {
slotType = slotData.at(0).intValue();
slotData = slotData.add(1);
if (slotType <= 0x06) /*FR_STACKMAP_TYPE_INIT_OBJECT*/
{
out.print(slotTypes[slotType]);
} else if (slotType == 0x07) /* CFR_STACKMAP_TYPE_OBJECT */
{
long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
J9ROMConstantPoolItemPointer constantPool = ConstantPoolHelpers.J9_ROM_CP_FROM_ROM_CLASS(classfile);
J9ROMStringRefPointer item = J9ROMStringRefPointer.cast(constantPool.add(index));
J9UTF8Pointer data = item.utf8Data();
String s = J9UTF8Helper.stringValue(data);
if (s.charAt(0) != '[') {
out.print("L");
}
out.print(s);
slotData = slotData.add(2);
} else if (slotType == 0x08) /* CFR_STACKMAP_TYPE_NEW_OBJECT */
{
long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
out.print("this pc:" + index);
slotData = slotData.add(2);
} else {
/* J9-ism: primitive array types start at slotType 9 and arity is really NEXT_U16()+1*/
StringBuffer primitiveType = new StringBuffer("[");
long index = new U16(slotData.at(0)).leftShift(8).add(slotData.at(1)).longValue();
while (index-- > 0) {
primitiveType.append("[");
}
primitiveType.append(primitiveArrayTypes[slotType - 9]);
out.print(primitiveType.toString());
slotData = slotData.add(2);
}
if (i != (slotCount - 1)) {
out.print(", ");
}
}
out.print(")");
return slotData;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer in project openj9 by eclipse.
the class J9BCUtil method dumpMethodAnnotations.
private static void dumpMethodAnnotations(PrintStream out, J9ROMMethodPointer romMethod) throws CorruptDataException {
U32Pointer methodAnnotationData = ROMHelp.getMethodAnnotationsDataFromROMMethod(romMethod);
U32Pointer parametersAnnotationData = ROMHelp.getParameterAnnotationsDataFromROMMethod(romMethod);
U32Pointer defaultAnnotationData = ROMHelp.getDefaultAnnotationDataFromROMMethod(romMethod);
U32Pointer methodTypeAnnotations = ROMHelp.getMethodTypeAnnotationDataFromROMMethod(romMethod);
U32Pointer codeTypeAnnotations = ROMHelp.getCodeTypeAnnotationDataFromROMMethod(romMethod);
if ((!methodAnnotationData.isNull()) || (!parametersAnnotationData.isNull()) || (!defaultAnnotationData.isNull())) {
J9ROMNameAndSignaturePointer nameAndSignature = romMethod.nameAndSignature();
J9UTF8Pointer name = nameAndSignature.name();
J9UTF8Pointer signature = nameAndSignature.signature();
out.append(" Name: " + J9UTF8Helper.stringValue(name) + nl);
out.append(" Signature: " + J9UTF8Helper.stringValue(signature) + nl);
}
if (!methodAnnotationData.isNull()) {
U32 length = methodAnnotationData.at(0);
U32Pointer data = methodAnnotationData.add(1);
out.append(String.format(" Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!parametersAnnotationData.isNull()) {
U32 length = parametersAnnotationData.at(0);
U32Pointer data = parametersAnnotationData.add(1);
out.append(String.format(" Parameters Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!defaultAnnotationData.isNull()) {
U32 length = defaultAnnotationData.at(0);
U32Pointer data = defaultAnnotationData.add(1);
out.append(String.format(" Default Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!methodTypeAnnotations.isNull()) {
U32 length = methodTypeAnnotations.at(0);
U32Pointer data = methodTypeAnnotations.add(1);
out.append(String.format(" Method Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!codeTypeAnnotations.isNull()) {
U32 length = codeTypeAnnotations.at(0);
U32Pointer data = codeTypeAnnotations.add(1);
out.append(String.format(" Code Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer in project openj9 by eclipse.
the class J9ObjectStructureFormatter method printJ9ObjectFields.
private void printJ9ObjectFields(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, J9ObjectPointer localObject) throws CorruptDataException {
J9ClassPointer instanceClass = localClazz;
long superclassIndex;
long depth;
J9ClassPointer previousSuperclass = J9ClassPointer.NULL;
boolean lockwordPrinted = false;
if (J9BuildFlags.thr_lockNursery) {
lockwordPrinted = false;
}
/* print individual fields */
J9UTF8Pointer classNameUTF = instanceClass.romClass().className();
padding(out, tabLevel);
out.println(String.format("struct J9Class* clazz = !j9class 0x%X // %s", localClazz.getAddress(), J9UTF8Helper.stringValue(classNameUTF)));
padding(out, tabLevel);
out.println(String.format("Object flags = %s;", J9ObjectHelper.flags(localObject).getHexValue()));
if (!J9BuildFlags.thr_lockNursery) {
UDATA lockword = J9ObjectHelper.monitor(localObject);
if (lockword != null) {
padding(out, tabLevel);
out.println(String.format("j9objectmonitor_t monitor = %s;", lockword.getHexValue()));
}
}
depth = J9ClassHelper.classDepth(instanceClass).longValue();
for (superclassIndex = 0; superclassIndex <= depth; superclassIndex++) {
J9ClassPointer superclass;
if (superclassIndex == depth) {
superclass = instanceClass;
} else {
superclass = J9ClassPointer.cast(instanceClass.superclasses().at(superclassIndex));
}
U32 flags = new U32(J9VM_FIELD_OFFSET_WALK_INCLUDE_INSTANCE | J9VM_FIELD_OFFSET_WALK_INCLUDE_HIDDEN);
Iterator<J9ObjectFieldOffset> iterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(superclass.romClass(), instanceClass, previousSuperclass, flags);
while (iterator.hasNext()) {
J9ObjectFieldOffset result = iterator.next();
boolean printField = true;
boolean isHiddenField = result.isHidden();
if (J9BuildFlags.thr_lockNursery) {
boolean isLockword = (isHiddenField && ((result.getOffsetOrAddress().add(J9Object.SIZEOF).eq(superclass.lockOffset()))));
if (isLockword) {
/* Print the lockword field if it is indeed the lockword for this instanceClass and we haven't printed it yet. */
printField = (!lockwordPrinted && (instanceClass.lockOffset().eq(superclass.lockOffset())));
if (printField) {
lockwordPrinted = true;
}
}
}
if (printField) {
printObjectField(out, tabLevel, localClazz, dataStart, superclass, result);
out.println();
}
}
previousSuperclass = superclass;
}
}
Aggregations