use of org.graalvm.jniutils.JNIMethodScope in project graal by oracle.
the class Target_org_graalvm_compiler_truffle_compiler_hotspot_libgraal_TruffleToLibGraalEntryPoints method compileMethod.
@SuppressWarnings({ "unused", "try" })
@Substitute
private static CompilationRequestResult compileMethod(HotSpotGraalCompiler compiler, CompilationRequest request) {
long offset = compiler.getGraalRuntime().getVMConfig().jniEnvironmentOffset;
long javaThreadAddr = HotSpotJVMCIRuntime.runtime().getCurrentJavaThread();
JNI.JNIEnv env = (JNI.JNIEnv) WordFactory.unsigned(javaThreadAddr).add(WordFactory.unsigned(offset));
// Truffle-specific method annotations.
try {
try (JNIMethodScope scope = LibGraalUtil.openScope("<called from VM>", env)) {
return compiler.compileMethod(request, true, compiler.getGraalRuntime().getOptions());
}
} finally {
/*
* libgraal doesn't use a dedicated reference handler thread, so we trigger the
* reference handling manually when a compilation finishes.
*/
Heap.getHeap().doReferenceHandling();
}
}
Aggregations