use of com.oracle.graal.pointsto.constraints.UnsupportedFeatureException in project graal by oracle.
the class ObjectScanner method scanMethod.
private void scanMethod(AnalysisMethod method) {
try {
StreamSupport.stream(method.getTypeFlow().getGraph().getNodes().spliterator(), false).filter(n -> n instanceof ConstantNode).forEach(n -> {
ConstantNode cn = (ConstantNode) n;
JavaConstant c = (JavaConstant) cn.getValue();
if (c.getJavaKind() == JavaKind.Object) {
scanConstant(c, method);
}
});
} catch (UnsupportedFeatureException ex) {
bb.getUnsupportedFeatures().addMessage(method.format("%H.%n(%p)"), method, ex.getMessage(), null, ex);
}
}
use of com.oracle.graal.pointsto.constraints.UnsupportedFeatureException in project graal by oracle.
the class ObjectScanner method scanField.
/**
* Scans the value of a field giving a receiver object.
*
* @param field the scanned field
* @param receiver the receiver object
* @param reason what triggered the scanning
*/
protected final void scanField(AnalysisField field, JavaConstant receiver, Object reason) {
try {
JavaConstant fieldValue = bb.getConstantReflectionProvider().readFieldValue(field, receiver);
if (fieldValue.getJavaKind() == JavaKind.Object && bb.getHostVM().isRelocatedPointer(bb.getSnippetReflectionProvider().asObject(Object.class, fieldValue))) {
forRelocatedPointerFieldValue(receiver, field, fieldValue);
} else if (fieldValue.isNull()) {
forNullFieldValue(receiver, field);
} else if (fieldValue.getJavaKind() == JavaKind.Object) {
if (receiver == null) {
registerRoot(fieldValue, field);
} else {
propagateRoot(receiver, fieldValue);
}
/* Scan the field value. */
scanConstant(fieldValue, reason);
/* Process the field value. */
forNonNullFieldValue(receiver, field, fieldValue);
}
} catch (UnsupportedFeatureException ex) {
unsupportedFeature(field.format("%H.%n"), ex.getMessage(), reason);
}
}
use of com.oracle.graal.pointsto.constraints.UnsupportedFeatureException in project graal by oracle.
the class Inflation method checkType.
private void checkType(AnalysisType type) {
SVMHost svmHost = (SVMHost) hostVM;
if (type.getJavaKind() == JavaKind.Object) {
if (type.isArray() && (type.isInstantiated() || type.isInTypeCheck())) {
svmHost.dynamicHub(type).getComponentHub().setArrayHub(svmHost.dynamicHub(type));
}
try {
AnalysisType enclosingType = type.getEnclosingType();
if (enclosingType != null) {
svmHost.dynamicHub(type).setEnclosingClass(svmHost.dynamicHub(enclosingType));
}
} catch (UnsupportedFeatureException ex) {
getUnsupportedFeatures().addMessage(type.toJavaName(true), null, ex.getMessage(), null, ex);
}
fillGenericInfo(type);
fillInterfaces(type);
/*
* Support for Java annotations.
*/
svmHost.dynamicHub(type).setAnnotationsEncoding(encodeAnnotations(metaAccess, type.getAnnotations(), svmHost.dynamicHub(type).getAnnotationsEncoding()));
/*
* Support for Java enumerations.
*/
if (type.getSuperclass() != null && type.getSuperclass().equals(metaAccess.lookupJavaType(Enum.class)) && svmHost.dynamicHub(type).getEnumConstantsShared() == null) {
/*
* We want to retrieve the enum constant array that is maintained as a private
* static field in the enumeration class. We do not want a copy because that would
* mean we have the array twice in the native image: as the static field, and in the
* enumConstant field of DynamicHub. The only way to get the original value is via a
* reflective field access, and we even have to guess the field name.
*/
AnalysisField found = null;
for (AnalysisField f : type.getStaticFields()) {
if (f.getName().endsWith("$VALUES")) {
if (found != null) {
throw shouldNotReachHere("Enumeration has more than one static field with enumeration values: " + type);
}
found = f;
}
}
if (found == null) {
throw shouldNotReachHere("Enumeration does not have static field with enumeration values: " + type);
}
AnalysisField field = found;
// field.registerAsRead(null);
Enum<?>[] enumConstants = (Enum[]) SubstrateObjectConstant.asObject(getConstantReflectionProvider().readFieldValue(field, null));
assert enumConstants != null;
svmHost.dynamicHub(type).setEnumConstants(enumConstants);
}
}
}
use of com.oracle.graal.pointsto.constraints.UnsupportedFeatureException in project graal by oracle.
the class AnnotationSubstitutionProcessor method lookup.
@Override
public ResolvedJavaType lookup(ResolvedJavaType type) {
Delete deleteAnnotation = deleteAnnotations.get(type);
if (deleteAnnotation != null) {
throw new UnsupportedFeatureException(deleteErrorMessage(type, deleteAnnotation, true));
}
ResolvedJavaType substitution = typeSubstitutions.get(type);
if (substitution != null) {
return substitution;
}
return type;
}
use of com.oracle.graal.pointsto.constraints.UnsupportedFeatureException in project graal by oracle.
the class AnnotationSubstitutionProcessor method lookup.
@Override
public ResolvedJavaField lookup(ResolvedJavaField field) {
Delete deleteAnnotation = deleteAnnotations.get(field);
if (deleteAnnotation != null) {
throw new UnsupportedFeatureException(deleteErrorMessage(field, deleteAnnotation, true));
}
ResolvedJavaField substitution = fieldSubstitutions.get(field);
if (substitution != null) {
return substitution;
}
return field;
}
Aggregations