use of com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator in project openj9 by eclipse.
the class J9BCUtil method j9bcutil_dumpRomClass.
public static void j9bcutil_dumpRomClass(PrintStream out, J9ROMClassPointer romClass, long flags) throws CorruptDataException {
out.append((String.format("ROM Size: 0x%s (%d)", Long.toHexString(romClass.romSize().longValue()), romClass.romSize().longValue())));
out.append(nl);
out.append(String.format("Class Name: %s", J9UTF8Helper.stringValue(romClass.className())));
out.append(nl);
if (romClass.superclassName().isNull()) {
out.append("Superclass Name: <none>");
} else {
out.append(String.format("Superclass Name: %s", J9UTF8Helper.stringValue(romClass.superclassName())));
}
out.append(nl);
/* dump the source file name */
dumpSourceFileName(out, romClass, flags);
/* dump the simple name */
dumpSimpleName(out, romClass, flags);
/* dump the class generic signature */
dumpGenericSignature(out, romClass, flags);
/* dump the enclosing method */
dumpEnclosingMethod(out, romClass, flags);
out.append(String.format("Sun Access Flags (0x%s): ", Long.toHexString(romClass.modifiers().longValue())));
dumpModifiers(out, romClass.modifiers().longValue(), MODIFIERSOURCE_CLASS, ONLY_SPEC_MODIFIERS);
out.append(String.format("J9 Access Flags (0x%s): ", Long.toHexString(romClass.extraModifiers().longValue())));
dumpClassJ9ExtraModifiers(out, romClass.extraModifiers().longValue());
out.append(nl);
out.append(String.format("Class file version: %d.%d", romClass.majorVersion().longValue(), romClass.minorVersion().longValue()));
out.append(nl);
out.append(String.format("Instance Shape: 0x%s", Long.toHexString(romClass.instanceShape().longValue())));
out.append(nl);
out.append(String.format("Intermediate Class Data (%d bytes): %s", romClass.intermediateClassDataLength().longValue(), Long.toHexString(romClass.intermediateClassData().longValue())));
out.append(nl);
out.append(String.format("Maximum Branch Count: %d", romClass.maxBranchCount().longValue()));
out.append(nl);
out.append(String.format("Interfaces (%d):" + nl, romClass.interfaceCount().longValue()));
if (!romClass.interfaceCount().eq(0)) {
SelfRelativePointer interfaces = romClass.interfaces();
long interfaceCount = romClass.interfaceCount().longValue();
for (int i = 0; i < interfaceCount; i++) {
out.append(" ");
J9UTF8Pointer interfaceName = J9UTF8Pointer.cast(interfaces.get());
out.append(J9UTF8Helper.stringValue(interfaceName));
out.append(nl);
interfaces = interfaces.add(1);
}
}
J9UTF8Pointer outerClassName = romClass.outerClassName();
if (!outerClassName.isNull()) {
out.append("Declaring Class: " + J9UTF8Helper.stringValue(romClass.outerClassName()));
out.append(nl);
out.append(String.format("Member Access Flags (0x%s): ", Long.toHexString(romClass.memberAccessFlags().longValue())));
dumpModifiers(out, romClass.memberAccessFlags().longValue(), MODIFIERSOURCE_CLASS, ONLY_SPEC_MODIFIERS);
out.append(nl);
outerClassName = outerClassName.add(1);
}
long innerClassCount = romClass.innerClassCount().longValue();
if (innerClassCount != 0) {
SelfRelativePointer innerClasses = romClass.innerClasses();
out.append(String.format("Declared Classes (%d):" + nl, innerClassCount));
for (int i = 0; i < innerClassCount; i++) {
J9UTF8Pointer innerClassName = J9UTF8Pointer.cast(innerClasses.get());
out.append(" " + J9UTF8Helper.stringValue(innerClassName));
innerClasses = innerClasses.add(1);
}
}
U32 romFieldCount = romClass.romFieldCount();
out.append(String.format("Fields (%d):" + nl, romFieldCount.longValue()));
J9ROMFieldShapeIterator iterator = new J9ROMFieldShapeIterator(romClass.romFields(), romFieldCount);
while (iterator.hasNext()) {
J9ROMFieldShapePointer currentField = (J9ROMFieldShapePointer) iterator.next();
if (!currentField.modifiers().bitAnd(J9JavaAccessFlags.J9AccStatic).eq(0)) {
dumpRomStaticField(out, currentField, flags);
} else {
dumpRomField(out, currentField, flags);
}
out.append(nl);
}
dumpCPShapeDescription(out, romClass, flags);
long romMethodsCount = romClass.romMethodCount().longValue();
out.append(String.format("Methods (%d):" + nl, romMethodsCount));
J9ROMMethodPointer romMethod = romClass.romMethods();
for (int i = 0; i < romClass.romMethodCount().intValue(); i++) {
J9BCUtil.j9bcutil_dumpRomMethod(out, romMethod, romClass, flags, 0);
romMethod = ROMHelp.nextROMMethod(romMethod);
}
/* dump source debug extension */
dumpSourceDebugExtension(out, romClass, flags);
/* dump annotation info */
dumpAnnotationInfo(out, romClass, flags);
/* dump callsite data */
dumpCallSiteData(out, romClass);
/* dump split side tables */
dumpStaticSplitSideTable(out, romClass);
dumpSpecialSplitSideTable(out, romClass);
}
use of com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator in project openj9 by eclipse.
the class J9BCUtil method dumpAnnotationInfo.
private static void dumpAnnotationInfo(PrintStream out, J9ROMClassPointer romClass, long flags) throws CorruptDataException {
U32Pointer classAnnotationData = OptInfo.getClassAnnotationsDataForROMClass(romClass);
U32Pointer classTypeAnnotationData = OptInfo.getClassTypeAnnotationsDataForROMClass(romClass);
out.append(" Annotation Info:" + nl);
if (!classAnnotationData.isNull()) {
U32 length = classAnnotationData.at(0);
U32Pointer data = classAnnotationData.add(1);
out.append(String.format(" Class Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!classTypeAnnotationData.isNull()) {
U32 length = classTypeAnnotationData.at(0);
U32Pointer data = classTypeAnnotationData.add(1);
out.append(String.format(" Class Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
/* print field annotations */
J9ROMFieldShapeIterator iterator = new J9ROMFieldShapeIterator(romClass.romFields(), romClass.romFieldCount());
out.append(" Field Annotations:" + nl);
while (iterator.hasNext()) {
J9ROMFieldShapePointer currentField = (J9ROMFieldShapePointer) iterator.next();
U32Pointer fieldAnnotationData = J9ROMFieldShapeHelper.getFieldAnnotationsDataFromROMField(currentField);
U32Pointer fieldTypeAnnotationData = J9ROMFieldShapeHelper.getFieldTypeAnnotationsDataFromROMField(currentField);
if (!fieldAnnotationData.isNull()) {
U32 length = fieldAnnotationData.at(0);
U32Pointer data = fieldAnnotationData.add(1);
out.append(" Name: " + J9UTF8Helper.stringValue(currentField.nameAndSignature().name()) + nl);
out.append(" Signature: " + J9UTF8Helper.stringValue(currentField.nameAndSignature().signature()) + nl);
out.append(String.format(" Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
if (!fieldTypeAnnotationData.isNull()) {
U32 length = fieldTypeAnnotationData.at(0);
U32Pointer data = fieldTypeAnnotationData.add(1);
out.append(String.format(" Type Annotations (%d bytes): %s" + nl, length.intValue(), data.getHexAddress()));
}
}
out.append(nl);
/* print method, parameter and default annotations */
J9ROMMethodPointer romMethod = romClass.romMethods();
out.append(" Method Annotations:" + nl);
for (int i = 0; i < romClass.romMethodCount().intValue(); i++) {
dumpMethodAnnotations(out, romMethod);
romMethod = ROMHelp.nextROMMethod(romMethod);
}
out.append(nl);
}
use of com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator in project openj9 by eclipse.
the class ObjectFieldInfo method countInstanceFields.
void countInstanceFields() throws CorruptDataException {
/* iterate over fields to count instance fields by size */
Iterable<J9ROMFieldShapePointer> fields = new J9ROMFieldShapeIterator(romClass.romFields(), romClass.romFieldCount());
for (J9ROMFieldShapePointer f : fields) {
U32 modifiers = f.modifiers();
if (!modifiers.anyBitsIn(J9AccStatic)) {
if (modifiers.anyBitsIn(J9FieldFlagObject)) {
instanceObjectCount += 1;
totalObjectCount += 1;
} else if (modifiers.anyBitsIn(J9FieldSizeDouble)) {
instanceDoubleCount += 1;
totalDoubleCount += 1;
} else {
instanceSingleCount += 1;
totalSingleCount += 1;
}
}
}
instanceFieldBackfillEligible = (instanceSingleCount > 0) || (objectCanUseBackfill && (instanceSingleCount > 0));
}
use of com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator in project openj9 by eclipse.
the class RomClassWalker method allSlotsInROMFieldsSectionDo.
private void allSlotsInROMFieldsSectionDo() throws CorruptDataException {
J9ROMFieldShapeIterator iterator = new J9ROMFieldShapeIterator(romClass.romFields(), romClass.romFieldCount());
int size = 0;
while (iterator.hasNext()) {
J9ROMFieldShapePointer currentField = (J9ROMFieldShapePointer) iterator.next();
int fieldLength = allSlotsInROMFieldDo(currentField);
if (0 == fieldLength) {
/* Range validation failed on the field, break early. */
break;
}
size += fieldLength;
}
classWalkerCallback.addSection(clazz, romClass.romFields(), size, "fields", true);
}
Aggregations