Search in sources :

Example 6 with TruffleCompilation

use of org.graalvm.compiler.truffle.common.TruffleCompilation in project graal by oracle.

the class TruffleToLibGraalEntryPoints method openDebugContext.

@TruffleToLibGraal(OpenDebugContext)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_openDebugContext")
@SuppressWarnings({ "unused", "try" })
public static long openDebugContext(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilerHandle, long compilationHandle, JByteArray hsOptions) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, OpenDebugContext, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(compilerHandle, HotSpotTruffleCompilerImpl.class);
        TruffleCompilation compilation = LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilation.class);
        Map<String, Object> options = decodeOptions(env, hsOptions);
        TruffleDebugContext debugContext = compiler.openDebugContext(options, compilation);
        long handle = LibGraalObjectHandles.create(debugContext);
        return handle;
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        return 0;
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) TruffleCompilation(org.graalvm.compiler.truffle.common.TruffleCompilation) TruffleDebugContext(org.graalvm.compiler.truffle.common.TruffleDebugContext) HSObject(org.graalvm.jniutils.HSObject) JObject(org.graalvm.jniutils.JNI.JObject) JNIUtil.createString(org.graalvm.jniutils.JNIUtil.createString) JString(org.graalvm.jniutils.JNI.JString) GetSuppliedString(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString) JNIUtil.createHSString(org.graalvm.jniutils.JNIUtil.createHSString) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Example 7 with TruffleCompilation

use of org.graalvm.compiler.truffle.common.TruffleCompilation in project graal by oracle.

the class TruffleToLibGraalEntryPoints method openCompilation.

@TruffleToLibGraal(OpenCompilation)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_openCompilation")
public static long openCompilation(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, JObject hsCompilable) {
    JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, OpenCompilation, env);
    try (JNIMethodScope s = scope) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(env, hsCompilable);
        TruffleCompilation compilation = compiler.openCompilation(compilable);
        assert compilation instanceof TruffleCompilationIdentifier;
        return LibGraalObjectHandles.create(compilation);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        return 0;
    }
}
Also used : TruffleCompilationIdentifier(org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) TruffleCompilation(org.graalvm.compiler.truffle.common.TruffleCompilation) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Aggregations

TruffleCompilation (org.graalvm.compiler.truffle.common.TruffleCompilation)7 TruffleDebugContext (org.graalvm.compiler.truffle.common.TruffleDebugContext)4 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)4 TruffleCompiler (org.graalvm.compiler.truffle.common.TruffleCompiler)3 TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)3 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)3 HotSpotTruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl)2 GraalTruffleRuntime (org.graalvm.compiler.truffle.runtime.GraalTruffleRuntime)2 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)2 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)1 IsolatedCompileContext (com.oracle.svm.graal.isolated.IsolatedCompileContext)1 SubstrateTruffleCompiler (com.oracle.svm.truffle.api.SubstrateTruffleCompiler)1 OptimizationFailedException (com.oracle.truffle.api.OptimizationFailedException)1 RootNode (com.oracle.truffle.api.nodes.RootNode)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 ServiceConfigurationError (java.util.ServiceConfigurationError)1 CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)1 TruffleCompilationTask (org.graalvm.compiler.truffle.common.TruffleCompilationTask)1 TruffleCompilerListener (org.graalvm.compiler.truffle.common.TruffleCompilerListener)1