use of com.oracle.svm.hosted.c.info.RawStructureInfo in project graal by oracle.
the class RawStructureLayoutPlanner method visitRawStructureInfo.
@Override
protected void visitRawStructureInfo(RawStructureInfo info) {
if (info.isPlanned()) {
return;
}
ResolvedJavaType type = (ResolvedJavaType) info.getAnnotatedElement();
for (ResolvedJavaType t : type.getInterfaces()) {
if (!nativeLibs.isPointerBase(t)) {
throw UserError.abort("Type " + type + " must not implement " + t);
}
if (t.equals(nativeLibs.getPointerBaseType())) {
continue;
}
ElementInfo einfo = nativeLibs.findElementInfo(t);
if (!(einfo instanceof RawStructureInfo)) {
throw UserError.abort(new CInterfaceError("Illegal super type " + t + " found", type).getMessage());
}
RawStructureInfo rinfo = (RawStructureInfo) einfo;
rinfo.accept(this);
assert rinfo.isPlanned();
if (info.getParentInfo() != null) {
throw UserError.abort(new CInterfaceError("Only single inheritance of RawStructure types is supported", type).getMessage());
}
info.setParentInfo(rinfo);
}
for (ElementInfo child : new ArrayList<>(info.getChildren())) {
if (child instanceof StructFieldInfo) {
StructFieldInfo fieldInfo = (StructFieldInfo) child;
StructFieldInfo parentFieldInfo = findParentFieldInfo(fieldInfo, info.getParentInfo());
if (parentFieldInfo != null) {
fieldInfo.mergeChildrenAndDelete(parentFieldInfo);
} else {
computeSize(fieldInfo);
}
}
}
planLayout(info);
}
Aggregations