Search in sources :

Example 1 with HotSpotTruffleCompilerImpl

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

the class TruffleToLibGraalEntryPoints method shutdown.

@TruffleToLibGraal(Shutdown)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_shutdown")
public static void shutdown(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, Shutdown, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        compiler.shutdown();
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) 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 2 with HotSpotTruffleCompilerImpl

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

the class TruffleToLibGraalEntryPoints method initializeCompiler.

@TruffleToLibGraal(InitializeCompiler)
@SuppressWarnings("unused")
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_initializeCompiler")
public static void initializeCompiler(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilerHandle, JByteArray hsOptions, JObject hsCompilable, boolean firstInitialization) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, InitializeCompiler, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(compilerHandle, HotSpotTruffleCompilerImpl.class);
        Map<String, Object> options = decodeOptions(env, hsOptions);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(s, hsCompilable);
        compiler.initialize(options, compilable, firstInitialization);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) 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) 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 3 with HotSpotTruffleCompilerImpl

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

the class TruffleToLibGraalEntryPoints method getCompilerConfigurationName.

@TruffleToLibGraal(GetCompilerConfigurationName)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getCompilerConfigurationName")
public static JString getCompilerConfigurationName(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateId, long handle) {
    JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetCompilerConfigurationName, env);
    try (JNIMethodScope s = scope) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        String name = compiler.getCompilerConfigurationName();
        scope.setObjectResult(createHSString(env, name));
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        scope.setObjectResult(WordFactory.nullPointer());
    }
    return scope.getObjectResult();
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) 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 4 with HotSpotTruffleCompilerImpl

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

the class TruffleToLibGraalEntryPoints method doCompile.

@TruffleToLibGraal(DoCompile)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_doCompile")
public static void doCompile(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilerHandle, long debugContextHandle, long compilationHandle, JByteArray hsOptions, JObject hsTask, JObject hsListener) {
    try (JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, DoCompile, env)) {
        TruffleCompilationIdentifier compilation = LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilationIdentifier.class);
        try (CompilationContext hotSpotObjectConstantScope = HotSpotGraalServices.openLocalCompilationContext(compilation)) {
            HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(compilerHandle, HotSpotTruffleCompilerImpl.class);
            TruffleDebugContext debugContext = LibGraalObjectHandles.resolve(debugContextHandle, TruffleDebugContext.class);
            Map<String, Object> options = decodeOptions(env, hsOptions);
            TruffleCompilationTask task = hsTask.isNull() ? null : new HSTruffleCompilationTask(hsTask);
            TruffleCompilerListener listener = hsListener.isNull() ? null : new HSTruffleCompilerListener(scope, hsListener);
            compiler.doCompile(debugContext, compilation, options, task, listener);
        }
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : TruffleCompilationIdentifier(org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) TruffleDebugContext(org.graalvm.compiler.truffle.common.TruffleDebugContext) 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) TruffleCompilationTask(org.graalvm.compiler.truffle.common.TruffleCompilationTask) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) CompilationContext(org.graalvm.compiler.hotspot.CompilationContext) HSObject(org.graalvm.jniutils.HSObject) JObject(org.graalvm.jniutils.JNI.JObject) TruffleCompilerListener(org.graalvm.compiler.truffle.common.TruffleCompilerListener) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Example 5 with HotSpotTruffleCompilerImpl

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

the class TruffleToLibGraalEntryPoints method pendingTransferToInterpreterOffset.

@TruffleToLibGraal(PendingTransferToInterpreterOffset)
@SuppressWarnings("unused")
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_pendingTransferToInterpreterOffset")
public static int pendingTransferToInterpreterOffset(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, JObject hsCompilable) {
    try (JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, PendingTransferToInterpreterOffset, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(scope, hsCompilable);
        return compiler.pendingTransferToInterpreterOffset(compilable);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        return 0;
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) 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

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