use of jdk.vm.ci.meta.UnresolvedJavaType in project graal by oracle.
the class InvalidVTableEntryFeature method makeMethod.
private void makeMethod(AnalysisMethod aMethod) {
HostedType holder;
holder = lookupType(aMethod.getDeclaringClass());
Signature signature = makeSignature(aMethod.getSignature(), holder);
ConstantPool constantPool = makeConstantPool(aMethod.getConstantPool(), holder);
ExceptionHandler[] aHandlers = aMethod.getExceptionHandlers();
ExceptionHandler[] sHandlers = new ExceptionHandler[aHandlers.length];
for (int i = 0; i < aHandlers.length; i++) {
ExceptionHandler h = aHandlers[i];
JavaType catchType = h.getCatchType();
if (h.getCatchType() instanceof AnalysisType) {
catchType = lookupType((AnalysisType) catchType);
} else {
assert catchType == null || catchType instanceof UnresolvedJavaType;
}
sHandlers[i] = new ExceptionHandler(h.getStartBCI(), h.getEndBCI(), h.getHandlerBCI(), h.catchTypeCPI(), catchType);
}
HostedMethod sMethod = new HostedMethod(hUniverse, aMethod, holder, signature, constantPool, sHandlers, null);
assert !hUniverse.methods.containsKey(aMethod);
hUniverse.methods.put(aMethod, sMethod);
boolean isCFunction = aMethod.getAnnotation(CFunction.class) != null;
boolean hasCFunctionOptions = aMethod.getAnnotation(CFunctionOptions.class) != null;
if (hasCFunctionOptions && !isCFunction) {
unsupportedFeatures.addMessage(aMethod.format("%H.%n(%p)"), aMethod, "Method annotated with @" + CFunctionOptions.class.getSimpleName() + " must also be annotated with @" + CFunction.class);
}
if (isCFunction) {
if (!aMethod.isNative()) {
unsupportedFeatures.addMessage(aMethod.format("%H.%n(%p)"), aMethod, "Method annotated with @" + CFunction.class.getSimpleName() + " must be declared native");
}
} else if (aMethod.isNative() && !aMethod.isIntrinsicMethod() && !(aMethod.getWrapped() instanceof CustomSubstitutionMethod) && aMethod.isImplementationInvoked() && !NativeImageOptions.ReportUnsupportedElementsAtRuntime.getValue()) {
unsupportedFeatures.addMessage(aMethod.format("%H.%n(%p)"), aMethod, AnnotationSubstitutionProcessor.deleteErrorMessage(aMethod, DeletedMethod.NATIVE_MESSAGE, true));
}
}
use of jdk.vm.ci.meta.UnresolvedJavaType in project graal by oracle.
the class HSTruffleCompilerRuntime method resolveType.
@Override
public ResolvedJavaType resolveType(MetaAccessProvider metaAccess, String className, boolean required) {
String internalName = getInternalName(className);
JavaType jt = runtime().lookupType(internalName, (HotSpotResolvedObjectType) classLoaderDelegate, true);
if (jt instanceof UnresolvedJavaType) {
if (required) {
throw new NoClassDefFoundError(internalName);
} else {
return null;
}
}
ResolvedJavaType resolvedType = (ResolvedJavaType) jt;
// In some situations, we may need the class to be linked now, especially if we are
// compiling immediately (e.g., to successfully devirtualize FrameWithoutBoxing methods).
resolvedType.link();
return resolvedType;
}
Aggregations