use of com.oracle.svm.hosted.meta.HostedInterface in project graal by oracle.
the class NativeImageGenerator method printTypes.
private void printTypes() {
for (HostedType type : hUniverse.getTypes()) {
System.out.format("%8d %s ", type.getTypeID(), type.toJavaName(true));
if (type.getSuperclass() != null) {
System.out.format("extends %d %s ", type.getSuperclass().getTypeID(), type.getSuperclass().toJavaName(false));
}
if (type.getInterfaces().length > 0) {
System.out.print("implements ");
String sep = "";
for (HostedInterface interf : type.getInterfaces()) {
System.out.format("%s%d %s", sep, interf.getTypeID(), interf.toJavaName(false));
sep = ", ";
}
System.out.print(" ");
}
if (type.getWrapped().isInstantiated()) {
System.out.print("instantiated ");
}
if (type.getWrapped().isInTypeCheck()) {
System.out.print("inTypeCheck ");
}
System.out.format("assignableFrom %s ", matchesToString(type.getAssignableFromMatches()));
System.out.format("instanceOf typeID %d, # %d ", type.getInstanceOfFromTypeID(), type.getInstanceOfNumTypeIDs());
// if (type.findLeafConcreteSubtype() != null) {
// System.out.format("unique %d %s ", type.findLeafConcreteSubtype().getTypeID(),
// type.findLeafConcreteSubtype().toJavaName(false));
// }
int le = type.getHub().getLayoutEncoding();
if (LayoutEncoding.isPrimitive(le)) {
System.out.print("primitive ");
} else if (LayoutEncoding.isInterface(le)) {
System.out.print("interface ");
} else if (LayoutEncoding.isAbstract(le)) {
System.out.print("abstract ");
} else if (LayoutEncoding.isInstance(le)) {
System.out.format("instance size %d ", LayoutEncoding.getInstanceSize(le).rawValue());
} else if (LayoutEncoding.isObjectArray(le)) {
System.out.format("object array base %d shift %d scale %d ", LayoutEncoding.getArrayBaseOffset(le).rawValue(), LayoutEncoding.getArrayIndexShift(le), LayoutEncoding.getArrayIndexScale(le));
} else if (LayoutEncoding.isPrimitiveArray(le)) {
System.out.format("primitive array base %d shift %d scale %d ", LayoutEncoding.getArrayBaseOffset(le).rawValue(), LayoutEncoding.getArrayIndexShift(le), LayoutEncoding.getArrayIndexScale(le));
} else {
throw VMError.shouldNotReachHere();
}
System.out.println();
for (HostedType sub : type.getSubTypes()) {
System.out.format(" s %d %s\n", sub.getTypeID(), sub.toJavaName(false));
}
if (type.isInterface()) {
for (HostedMethod method : hUniverse.getMethods()) {
if (method.getDeclaringClass() == type) {
printMethod(method, -1);
}
}
} else if (type.isInstanceClass()) {
HostedField[] fields = type.getInstanceFields(false);
fields = Arrays.copyOf(fields, fields.length);
Arrays.sort(fields, Comparator.comparing(HostedField::toString));
for (HostedField field : fields) {
System.out.println(" f " + field.getLocation() + ": " + field.format("%T %n"));
}
HostedMethod[] vtable = type.getVTable();
for (int i = 0; i < vtable.length; i++) {
if (vtable[i] != null) {
printMethod(vtable[i], i);
}
}
for (HostedMethod method : hUniverse.getMethods()) {
if (method.getDeclaringClass() == type && !method.hasVTableIndex()) {
printMethod(method, -1);
}
}
}
}
}
Aggregations