use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method isPrintGraphEnabled.
@TruffleToLibGraal(IsPrintGraphEnabled)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_isPrintGraphEnabled")
public static boolean isPrintGraphEnabled(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long truffleRuntimeHandle) {
try (JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, IsPrintGraphEnabled, env)) {
HSTruffleCompilerRuntime hsTruffleRuntime = LibGraalObjectHandles.resolve(truffleRuntimeHandle, HSTruffleCompilerRuntime.class);
assert TruffleCompilerRuntime.getRuntime() == hsTruffleRuntime;
OptionValues graalOptions = hsTruffleRuntime.getGraalOptions(OptionValues.class);
return DebugOptions.PrintGraph.getValue(graalOptions) != DebugOptions.PrintGraphTarget.Disable;
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
return false;
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method installTruffleReservedOopMethod.
@TruffleToLibGraal(Id.InstallTruffleReservedOopMethod)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_installTruffleReservedOopMethod")
public static void installTruffleReservedOopMethod(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, long methodHandle) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, Id.InstallTruffleReservedOopMethod, env)) {
HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
compiler.installTruffleReservedOopMethod(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 getTruffleCompilationId.
@TruffleToLibGraal(GetTruffleCompilationId)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getTruffleCompilationId")
@SuppressWarnings({ "unused", "try" })
public static JString getTruffleCompilationId(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilationHandle) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetTruffleCompilationId, env);
try (JNIMethodScope s = scope) {
String compilationId = LibGraalObjectHandles.resolve(compilationHandle, TruffleCompilationIdentifier.class).toString(CompilationIdentifier.Verbosity.ID);
scope.setObjectResult(createHSString(env, compilationId));
} 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 dumpChannelWrite.
@TruffleToLibGraal(DumpChannelWrite)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_dumpChannelWrite")
@SuppressWarnings({ "unused", "try" })
public static int dumpChannelWrite(JNIEnv env, JClass hsClass, @CEntryPoint.IsolateThreadContext long isolateThreadId, long channelHandle, JObject hsSource, int capacity, int position, int limit) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, DumpChannelWrite, env)) {
WritableByteChannel channel = LibGraalObjectHandles.resolve(channelHandle, WritableByteChannel.class);
VoidPointer baseAddr = JNIUtil.GetDirectBufferAddress(env, hsSource);
ByteBuffer source = CTypeConversion.asByteBuffer(baseAddr, capacity);
source.position(position);
source.limit(limit);
return channel.write(source);
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
return -1;
}
}
use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal in project graal by oracle.
the class TruffleToLibGraalEntryPoints method getCompilerConfigurationFactoryName.
@TruffleToLibGraal(GetCompilerConfigurationFactoryName)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getCompilerConfigurationFactoryName")
public static JString getCompilerConfigurationFactoryName(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long truffleRuntimeHandle) {
JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetCompilerConfigurationFactoryName, env);
try (JNIMethodScope s = scope) {
HSTruffleCompilerRuntime hsTruffleRuntime = LibGraalObjectHandles.resolve(truffleRuntimeHandle, HSTruffleCompilerRuntime.class);
assert TruffleCompilerRuntime.getRuntime() == hsTruffleRuntime;
OptionValues graalOptions = hsTruffleRuntime.getGraalOptions(OptionValues.class);
String compConfig = Options.TruffleCompilerConfiguration.getValue(graalOptions);
CompilerConfigurationFactory compilerConfigurationFactory = CompilerConfigurationFactory.selectFactory(compConfig, graalOptions, HotSpotJVMCIRuntime.runtime());
String name = compilerConfigurationFactory.getName();
scope.setObjectResult(createHSString(env, name));
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
scope.setObjectResult(WordFactory.nullPointer());
}
return scope.getObjectResult();
}
Aggregations