use of com.oracle.svm.hosted.c.info.AccessorInfo in project graal by oracle.
the class RawStructureLayoutPlanner method computeSize.
private void computeSize(StructFieldInfo info) {
AccessorInfo ainfo = info.getAccessorInfo();
/**
* Resolve field size using the declared type in its accessors. Note that the field offsets
* are not calculated before visiting all StructFieldInfos and collecting all field types.
*/
ResolvedJavaMethod accessor = (ResolvedJavaMethod) ainfo.getAnnotatedElement();
ResolvedJavaType fieldType;
if (ainfo.getAccessorKind() == AccessorKind.GETTER) {
fieldType = (ResolvedJavaType) accessor.getSignature().getReturnType(null);
} else if (ainfo.getAccessorKind() == AccessorKind.SETTER) {
fieldType = (ResolvedJavaType) accessor.getSignature().getParameterType(ainfo.valueParameterNumber(false), null);
} else {
throw shouldNotReachHere("Unexpected accessor kind " + ainfo.getAccessorKind());
}
TargetDescription target = nativeLibs.getTarget();
int declaredSize = target.arch.getPlatformKind(fieldType.getJavaKind()).getSizeInBytes();
info.getSizeInfo().setProperty(declaredSize);
if (info.getKind() == ElementKind.INTEGER) {
info.getSignednessInfo().setProperty(nativeLibs.isSigned(fieldType) ? SignednessValue.SIGNED : SignednessValue.UNSIGNED);
}
}
Aggregations