use of org.graalvm.jniutils.JNI.JObject in project graal by oracle.
the class HSTruffleCompilerListener method onCompilationRetry.
@TruffleFromLibGraal(OnCompilationRetry)
@Override
public void onCompilationRetry(CompilableTruffleAST compilable, TruffleCompilationTask task) {
JObject hsCompilable = ((HSCompilableTruffleAST) compilable).getHandle();
JObject hsTask = ((HSTruffleCompilationTask) ((TruffleCompilerImpl.CancellableTruffleCompilationTask) task).getDelegate()).getHandle();
JNIEnv env = JNIMethodScope.env();
callOnCompilationRetry(env, getHandle(), hsCompilable, hsTask);
}
use of org.graalvm.jniutils.JNI.JObject in project graal by oracle.
the class HSTruffleCompilerListener method onSuccess.
@TruffleFromLibGraal(OnSuccess)
@Override
public void onSuccess(CompilableTruffleAST compilable, TruffleInliningData inliningPlan, GraphInfo graphInfo, CompilationResultInfo compilationResultInfo, int tier) {
JObject hsCompilable = ((HSCompilableTruffleAST) compilable).getHandle();
JObject hsInliningPlan = ((HSTruffleInliningData) inliningPlan).getHandle();
JNIEnv env = JNIMethodScope.env();
try (LibGraalObjectHandleScope graphInfoScope = LibGraalObjectHandleScope.forObject(graphInfo);
LibGraalObjectHandleScope compilationResultInfoScope = LibGraalObjectHandleScope.forObject(compilationResultInfo)) {
callOnSuccess(env, getHandle(), hsCompilable, hsInliningPlan, graphInfoScope.getHandle(), compilationResultInfoScope.getHandle(), tier);
}
}
use of org.graalvm.jniutils.JNI.JObject in project graal by oracle.
the class HSTruffleInliningData method getPosition.
@TruffleFromLibGraal(GetPosition)
@Override
public TruffleSourceLanguagePosition getPosition(JavaConstant node) {
long nodeHandle = LibGraal.translate(node);
JNIEnv env = scope.getEnv();
JObject res = callGetPosition(env, getHandle(), nodeHandle);
if (res.isNull()) {
return null;
}
return new HSTruffleSourceLanguagePosition(scope, res);
}
use of org.graalvm.jniutils.JNI.JObject in project graal by oracle.
the class HSTruffleInliningData method addInlinedTarget.
@TruffleFromLibGraal(AddInlinedTarget)
@Override
public void addInlinedTarget(CompilableTruffleAST target) {
JObject hsCompilable = ((HSCompilableTruffleAST) target).getHandle();
callAddInlinedTarget(scope.getEnv(), getHandle(), hsCompilable);
}
use of org.graalvm.jniutils.JNI.JObject in project graal by oracle.
the class TruffleToLibGraalEntryPoints method initializeCompiler.
@TruffleToLibGraal(InitializeCompiler)
@SuppressWarnings("unused")
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_initializeCompiler")
public static void initializeCompiler(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilerHandle, JByteArray hsOptions, JObject hsCompilable, boolean firstInitialization) {
try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, InitializeCompiler, env)) {
HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(compilerHandle, HotSpotTruffleCompilerImpl.class);
Map<String, Object> options = decodeOptions(env, hsOptions);
CompilableTruffleAST compilable = new HSCompilableTruffleAST(s, hsCompilable);
compiler.initialize(options, compilable, firstInitialization);
} catch (Throwable t) {
JNIExceptionWrapper.throwInHotSpot(env, t);
}
}
Aggregations