Search in sources :

Example 1 with JNIEnv

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);
}
Also used : TruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl) JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 2 with JNIEnv

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);
    }
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 3 with JNIEnv

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);
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 4 with JNIEnv

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);
}
Also used : JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) JString(org.graalvm.jniutils.JNI.JString) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 5 with JNIEnv

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;
}
Also used : HSCompilableTruffleASTGen.callCompilableToString(org.graalvm.compiler.truffle.compiler.hotspot.libgraal.HSCompilableTruffleASTGen.callCompilableToString) JNIUtil.createString(org.graalvm.jniutils.JNIUtil.createString) JString(org.graalvm.jniutils.JNI.JString) CompilableToString(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.CompilableToString) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) JString(org.graalvm.jniutils.JNI.JString) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Aggregations

TruffleFromLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)18 JNIEnv (org.graalvm.jniutils.JNI.JNIEnv)18 JObject (org.graalvm.jniutils.JNI.JObject)12 JString (org.graalvm.jniutils.JNI.JString)5 CompilableToString (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.CompilableToString)2 HSCompilableTruffleASTGen.callCompilableToString (org.graalvm.compiler.truffle.compiler.hotspot.libgraal.HSCompilableTruffleASTGen.callCompilableToString)2 JNIUtil.createString (org.graalvm.jniutils.JNIUtil.createString)2 TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)1 TruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl)1 JObjectArray (org.graalvm.jniutils.JNI.JObjectArray)1 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)1