Search in sources :

Example 1 with JNICallTrampolineMethod

use of com.oracle.svm.jni.hosted.JNICallTrampolineMethod in project graal by oracle.

the class JNIFunctionTablesFeature method prepareCallTrampoline.

private static CFunctionPointer prepareCallTrampoline(CompilationAccessImpl access, CallVariant variant, boolean nonVirtual) {
    JNICallTrampolineMethod trampolineMethod = JNIAccessFeature.singleton().getCallTrampolineMethod(variant, nonVirtual);
    AnalysisMethod analysisTrampoline = access.getUniverse().getBigBang().getUniverse().lookup(trampolineMethod);
    HostedMethod hostedTrampoline = access.getUniverse().lookup(analysisTrampoline);
    hostedTrampoline.compilationInfo.setCustomParseFunction(trampolineMethod.createCustomParseFunction());
    hostedTrampoline.compilationInfo.setCustomCompileFunction(trampolineMethod.createCustomCompileFunction());
    return MethodPointer.factory(hostedTrampoline);
}
Also used : AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) HostedMethod(com.oracle.svm.hosted.meta.HostedMethod) JNICallTrampolineMethod(com.oracle.svm.jni.hosted.JNICallTrampolineMethod)

Example 2 with JNICallTrampolineMethod

use of com.oracle.svm.jni.hosted.JNICallTrampolineMethod in project graal by oracle.

the class JNIAccessFeature method createJavaCallTrampoline.

private static JNICallTrampolineMethod createJavaCallTrampoline(BeforeAnalysisAccessImpl access, CallVariant variant, boolean nonVirtual) {
    MetaAccessProvider wrappedMetaAccess = access.getMetaAccess().getWrapped();
    ResolvedJavaField field = JNIAccessibleMethod.getCallWrapperField(wrappedMetaAccess, variant, nonVirtual);
    access.registerAsAccessed(access.getUniverse().lookup(field));
    ResolvedJavaMethod method = JNIJavaCallWrappers.lookupJavaCallTrampoline(wrappedMetaAccess, variant, nonVirtual);
    JNICallTrampolineMethod trampoline = new JNICallTrampolineMethod(method, field, nonVirtual);
    access.registerAsCompiled(access.getUniverse().lookup(trampoline));
    return trampoline;
}
Also used : JNICallTrampolineMethod(com.oracle.svm.jni.hosted.JNICallTrampolineMethod) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField)

Aggregations

JNICallTrampolineMethod (com.oracle.svm.jni.hosted.JNICallTrampolineMethod)2 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)1 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)1 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1