use of org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier 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.compiler.TruffleCompilationIdentifier 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);
}
}
use of org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier 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.compiler.TruffleCompilationIdentifier in project graal by oracle.
the class IsolatedCompilationIdentifier method toString0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static CompilerHandle<String> toString0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<TruffleCompilationIdentifier> idHandle, int verbosityOrdinal) {
TruffleCompilationIdentifier id = IsolatedCompileClient.get().unhand(idHandle);
String description = id.toString(VERBOSITIES[verbosityOrdinal]);
return IsolatedCompileClient.get().createStringInCompiler(description);
}
Aggregations