Search in sources :

Example 11 with JNIEnv

use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.

the class HSTruffleCompilerRuntime method log.

@TruffleFromLibGraal(Log)
@Override
public void log(String loggerId, CompilableTruffleAST compilable, String message) {
    JNIEnv env = env();
    JString jniLoggerId = JNIUtil.createHSString(env, loggerId);
    JString jniMessage = JNIUtil.createHSString(env, message);
    callLog(env, getHandle(), jniLoggerId, ((HSCompilableTruffleAST) compilable).getHandle(), jniMessage);
}
Also used : JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) JString(org.graalvm.jniutils.JNI.JString) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 12 with JNIEnv

use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.

the class HSTruffleCompilerRuntime method getCallTargetForCallNode.

@TruffleFromLibGraal(GetCallTargetForCallNode)
@Override
public JavaConstant getCallTargetForCallNode(JavaConstant callNode) {
    long callNodeHandle = LibGraal.translate(callNode);
    JNIEnv env = env();
    long callTargetHandle = callGetCallTargetForCallNode(env, getHandle(), callNodeHandle);
    return LibGraal.unhand(JavaConstant.class, callTargetHandle);
}
Also used : JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 13 with JNIEnv

use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.

the class HSTruffleCompilerRuntime method registerOptimizedAssumptionDependency.

@TruffleFromLibGraal(RegisterOptimizedAssumptionDependency)
@Override
public Consumer<OptimizedAssumptionDependency> registerOptimizedAssumptionDependency(JavaConstant optimizedAssumption) {
    long optimizedAssumptionHandle = LibGraal.translate(optimizedAssumption);
    JNIEnv env = env();
    JObject assumptionConsumer = callRegisterOptimizedAssumptionDependency(env, getHandle(), optimizedAssumptionHandle);
    return assumptionConsumer.isNull() ? null : new HSConsumer(scope(), assumptionConsumer);
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 14 with JNIEnv

use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.

the class HSTruffleCompilerListener method onGraalTierFinished.

@TruffleFromLibGraal(OnGraalTierFinished)
@Override
public void onGraalTierFinished(CompilableTruffleAST compilable, GraphInfo graph) {
    JObject hsCompilable = ((HSCompilableTruffleAST) compilable).getHandle();
    JNIEnv env = JNIMethodScope.env();
    try (LibGraalObjectHandleScope graphInfoScope = LibGraalObjectHandleScope.forObject(graph)) {
        callOnGraalTierFinished(env, getHandle(), hsCompilable, graphInfoScope.getHandle());
    }
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 15 with JNIEnv

use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.

the class HSTruffleCompilerListener method onTruffleTierFinished.

@TruffleFromLibGraal(OnTruffleTierFinished)
@Override
public void onTruffleTierFinished(CompilableTruffleAST compilable, TruffleInliningData inliningPlan, GraphInfo graph) {
    JObject hsCompilable = ((HSCompilableTruffleAST) compilable).getHandle();
    JObject hsInliningPlan = ((HSTruffleInliningData) inliningPlan).getHandle();
    JNIEnv env = JNIMethodScope.env();
    try (LibGraalObjectHandleScope graphInfoScope = LibGraalObjectHandleScope.forObject(graph)) {
        callOnTruffleTierFinished(env, getHandle(), hsCompilable, hsInliningPlan, graphInfoScope.getHandle());
    }
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) 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