use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal 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();
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method getString.
@TruffleToLibGraal(GetSuppliedString)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getSuppliedString")
@SuppressWarnings({ "unused", "unchecked", "try" })
public static JString getString(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetSuppliedString, env);
try (JNIMethodScope s = scope) {
Supplier<String> orig = LibGraalObjectHandles.resolve(handle, Supplier.class);
if (orig != null) {
String stackTrace = orig.get();
scope.setObjectResult(JNIUtil.createHSString(env, stackTrace));
} else {
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 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.common.hotspot.libgraal.TruffleToLibGraal 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;
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal 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;
}
}
Aggregations