Search in sources :

Example 1 with CLibrary

use of org.graalvm.nativeimage.c.function.CLibrary in project graal by oracle.

the class NativeImageGenerator method processNativeLibraryImports.

@SuppressWarnings("try")
private NativeLibraries processNativeLibraryImports(MetaAccessProvider metaAccess, AnalysisConstantReflectionProvider aConstantReflection, SnippetReflectionProvider snippetReflection) {
    CAnnotationProcessorCache.initialize();
    try (StopTimer t = new Timer("(cap)").start()) {
        NativeLibraries nativeLibs = new NativeLibraries(aConstantReflection, metaAccess, snippetReflection, ConfigurationValues.getTarget());
        for (Method method : loader.findAnnotatedMethods(CConstant.class)) {
            nativeLibs.loadJavaMethod(metaAccess.lookupJavaMethod(method));
        }
        for (Class<?> clazz : loader.findAnnotatedClasses(CStruct.class)) {
            nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
        }
        for (Class<?> clazz : loader.findAnnotatedClasses(RawStructure.class)) {
            nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
        }
        for (Class<?> clazz : loader.findAnnotatedClasses(CPointerTo.class)) {
            nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
        }
        for (Class<?> clazz : loader.findAnnotatedClasses(CEnum.class)) {
            nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
        }
        for (CLibrary library : loader.findAnnotations(CLibrary.class)) {
            nativeLibs.addLibrary(library.value());
        }
        nativeLibs.finish(tempDirectory());
        nativeLibs.reportErrors();
        return nativeLibs;
    }
}
Also used : StopTimer(com.oracle.graal.pointsto.util.Timer.StopTimer) Timer(com.oracle.graal.pointsto.util.Timer) NativeLibraries(com.oracle.svm.hosted.c.NativeLibraries) CLibrary(org.graalvm.nativeimage.c.function.CLibrary) StopTimer(com.oracle.graal.pointsto.util.Timer.StopTimer) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) Method(java.lang.reflect.Method) WrappedJavaMethod(com.oracle.graal.pointsto.infrastructure.WrappedJavaMethod) HostedMethod(com.oracle.svm.hosted.meta.HostedMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

WrappedJavaMethod (com.oracle.graal.pointsto.infrastructure.WrappedJavaMethod)1 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 Timer (com.oracle.graal.pointsto.util.Timer)1 StopTimer (com.oracle.graal.pointsto.util.Timer.StopTimer)1 NativeLibraries (com.oracle.svm.hosted.c.NativeLibraries)1 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)1 Method (java.lang.reflect.Method)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 CLibrary (org.graalvm.nativeimage.c.function.CLibrary)1