Search in sources :

Example 6 with HotSpotTruffleCompilerImpl

use of org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl 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 HotSpotTruffleCompilerImpl

use of org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl in project graal by oracle.

the class TruffleToLibGraalEntryPoints method installTruffleReservedOopMethod.

@TruffleToLibGraal(Id.InstallTruffleReservedOopMethod)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_installTruffleReservedOopMethod")
public static void installTruffleReservedOopMethod(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, long methodHandle) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, Id.InstallTruffleReservedOopMethod, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        compiler.installTruffleReservedOopMethod(LibGraal.unhand(ResolvedJavaMethod.class, methodHandle));
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Example 8 with HotSpotTruffleCompilerImpl

use of org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl 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)

Example 9 with HotSpotTruffleCompilerImpl

use of org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl in project graal by oracle.

the class TruffleToLibGraalEntryPoints method installTruffleCallBoundaryMethod.

@TruffleToLibGraal(InstallTruffleCallBoundaryMethod)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_installTruffleCallBoundaryMethod")
public static void installTruffleCallBoundaryMethod(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, long methodHandle) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, InstallTruffleCallBoundaryMethod, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        compiler.installTruffleCallBoundaryMethod(LibGraal.unhand(ResolvedJavaMethod.class, methodHandle));
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Aggregations

TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)9 HotSpotTruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl)9 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)9 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)9 GetSuppliedString (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString)4 JString (org.graalvm.jniutils.JNI.JString)4 JNIUtil.createHSString (org.graalvm.jniutils.JNIUtil.createHSString)4 JNIUtil.createString (org.graalvm.jniutils.JNIUtil.createString)4 CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)3 HSObject (org.graalvm.jniutils.HSObject)3 JObject (org.graalvm.jniutils.JNI.JObject)3 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 TruffleCompilation (org.graalvm.compiler.truffle.common.TruffleCompilation)2 TruffleDebugContext (org.graalvm.compiler.truffle.common.TruffleDebugContext)2 TruffleCompilationIdentifier (org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier)2 CompilationContext (org.graalvm.compiler.hotspot.CompilationContext)1 TruffleCompilationTask (org.graalvm.compiler.truffle.common.TruffleCompilationTask)1 TruffleCompilerListener (org.graalvm.compiler.truffle.common.TruffleCompilerListener)1