use of org.graalvm.jniutils.JNI.JNIEnv 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.JNIEnv 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.JNIEnv 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.JNIEnv in project graal by oracle.
the class HSCompilableTruffleAST method cancelCompilation.
@TruffleFromLibGraal(CancelCompilation)
@Override
public boolean cancelCompilation(CharSequence reason) {
JNIEnv env = env();
JString jniReason = JNIUtil.createHSString(env, reason.toString());
return callCancelCompilation(env, getHandle(), jniReason);
}
use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSCompilableTruffleAST method toString.
@TruffleFromLibGraal(CompilableToString)
@Override
public String toString() {
String res = cachedString;
if (res == null) {
JNIEnv env = JNIMethodScope.env();
JString value = callCompilableToString(env, getHandle());
res = createString(env, value);
cachedString = res;
}
return res;
}
Aggregations