use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal 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;
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method closeDebugContextScope.
@TruffleToLibGraal(CloseDebugContextScope)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_closeDebugContextScope")
@SuppressWarnings({ "unused", "try" })
public static void closeDebugContextScope(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, CloseDebugContextScope, env)) {
AutoCloseable scope = LibGraalObjectHandles.resolve(handle, DebugContext.Scope.class);
scope.close();
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method initializeRuntime.
@TruffleToLibGraal(InitializeRuntime)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_initializeRuntime")
public static long initializeRuntime(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, JObject truffleRuntime, long classLoaderDelegateId) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, InitializeRuntime, env)) {
ResolvedJavaType classLoaderDelegate = LibGraal.unhand(ResolvedJavaType.class, classLoaderDelegateId);
HSTruffleCompilerRuntime hsTruffleRuntime = new HSTruffleCompilerRuntime(env, truffleRuntime, classLoaderDelegate, HotSpotGraalOptionValues.defaultOptions());
TruffleCompilerRuntimeInstance.initialize(hsTruffleRuntime);
long truffleRuntimeHandle = LibGraalObjectHandles.create(hsTruffleRuntime);
return truffleRuntimeHandle;
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
return 0L;
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal 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);
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method getInfopoints.
@TruffleToLibGraal(GetInfopoints)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getInfopoints")
@SuppressWarnings({ "unused", "try" })
public static JObjectArray getInfopoints(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetInfopoints, env);
try (JNIMethodScope s = scope) {
String[] infoPoints = LibGraalObjectHandles.resolve(handle, CompilationResultInfo.class).getInfopoints();
JClass componentType = FromLibGraalCalls.getJNIClass(env, String.class);
JObjectArray res = NewObjectArray(env, infoPoints.length, componentType, WordFactory.nullPointer());
for (int i = 0; i < infoPoints.length; i++) {
SetObjectArrayElement(env, res, i, createHSString(env, infoPoints[i]));
}
scope.setObjectResult(res);
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
scope.setObjectResult(WordFactory.nullPointer());
}
return scope.getObjectResult();
}
Aggregations