use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method getGraphDumpDirectory.
@TruffleToLibGraal(GetGraphDumpDirectory)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getGraphDumpDirectory")
public static JString getGraphDumpDirectory(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetGraphDumpDirectory, env);
try (JNIMethodScope s = scope) {
String path = DebugOptions.getDumpDirectory(HotSpotGraalOptionValues.defaultOptions());
scope.setObjectResult(createHSString(env, path));
} catch (IOException ioe) {
scope.setObjectResult(WordFactory.nullPointer());
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
scope.setObjectResult(WordFactory.nullPointer());
}
return scope.getObjectResult();
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method getNodeTypes.
@TruffleToLibGraal(GetNodeTypes)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getNodeTypes")
@SuppressWarnings({ "unused", "try" })
public static JObjectArray getNodeTypes(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, boolean simpleNames) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetNodeTypes, env);
try (JNIMethodScope s = scope) {
GraphInfo orig = LibGraalObjectHandles.resolve(handle, GraphInfo.class);
String[] nodeTypes = orig.getNodeTypes(simpleNames);
JClass componentType = FromLibGraalCalls.getJNIClass(env, String.class);
JObjectArray res = NewObjectArray(env, nodeTypes.length, componentType, WordFactory.nullPointer());
for (int i = 0; i < nodeTypes.length; i++) {
SetObjectArrayElement(env, res, i, JNIUtil.createHSString(env, nodeTypes[i]));
}
scope.setObjectResult(res);
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
scope.setObjectResult(WordFactory.nullPointer());
}
return scope.getObjectResult();
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method openDebugContextScope.
@TruffleToLibGraal(OpenDebugContextScope)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_openDebugContextScope")
@SuppressWarnings({ "unused", "try" })
public static long openDebugContextScope(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, JString hsName, long compilationHandle) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, OpenDebugContextScope, env)) {
TruffleDebugContext debugContext = LibGraalObjectHandles.resolve(handle, TruffleDebugContext.class);
String name = createString(env, hsName);
AutoCloseable scope;
if (compilationHandle == 0) {
scope = debugContext.scope(name);
} else {
TruffleCompilationIdentifier compilation = LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilationIdentifier.class);
scope = debugContext.scope(name, new TruffleDebugJavaMethod(compilation.getCompilable()));
}
if (scope == null) {
return 0;
}
long scopeHandle = LibGraalObjectHandles.create(scope);
return scopeHandle;
} 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 closeCompilation.
@TruffleToLibGraal(CloseCompilation)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_closeCompilation")
public static void closeCompilation(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilationHandle) {
try (JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, CloseCompilation, env)) {
TruffleCompilation compilation = LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilation.class);
HSCompilableTruffleAST compilable = (HSCompilableTruffleAST) compilation.getCompilable();
try {
compilation.close();
} finally {
compilable.release(env);
HSObject.cleanHandles(env);
doReferenceHandling();
}
} 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 getTruffleCompilationTruffleAST.
@TruffleToLibGraal(GetTruffleCompilationTruffleAST)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getTruffleCompilationTruffleAST")
@SuppressWarnings({ "unused", "try" })
public static JObject getTruffleCompilationTruffleAST(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilationHandle) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetTruffleCompilationTruffleAST, env);
try (JNIMethodScope s = scope) {
HSCompilableTruffleAST compilable = (HSCompilableTruffleAST) LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilation.class).getCompilable();
scope.setObjectResult(compilable.getHandle());
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
scope.setObjectResult(WordFactory.nullPointer());
}
return scope.getObjectResult();
}
Aggregations