Search in sources :

Example 1 with TruffleFromLibGraal

use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal 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 TruffleFromLibGraal

use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal 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 TruffleFromLibGraal

use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal 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 TruffleFromLibGraal

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

Example 5 with TruffleFromLibGraal

use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal in project graal by oracle.

the class TruffleFromLibGraalEntryPoints method getCallTargetForCallNode.

@TruffleFromLibGraal(GetCallTargetForCallNode)
static long getCallTargetForCallNode(Object truffleRuntime, long callNodeHandle) {
    JavaConstant callNode = LibGraal.unhand(JavaConstant.class, callNodeHandle);
    JavaConstant callTarget = ((TruffleCompilerRuntime) truffleRuntime).getCallTargetForCallNode(callNode);
    return LibGraal.translate(callTarget);
}
Also used : TruffleCompilerRuntime(org.graalvm.compiler.truffle.common.TruffleCompilerRuntime) HotSpotTruffleCompilerRuntime(org.graalvm.compiler.truffle.common.hotspot.HotSpotTruffleCompilerRuntime) AsJavaConstant(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.AsJavaConstant) JavaConstant(jdk.vm.ci.meta.JavaConstant) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Aggregations

TruffleFromLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)29 JNIEnv (org.graalvm.jniutils.JNI.JNIEnv)18 JObject (org.graalvm.jniutils.JNI.JObject)15 HotSpotTruffleCompilerRuntime (org.graalvm.compiler.truffle.common.hotspot.HotSpotTruffleCompilerRuntime)5 JString (org.graalvm.jniutils.JNI.JString)5 TruffleCompilerRuntime (org.graalvm.compiler.truffle.common.TruffleCompilerRuntime)4 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)3 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)3 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)2 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)2 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 Method (java.lang.reflect.Method)1 InstalledCode (jdk.vm.ci.code.InstalledCode)1 HotSpotSpeculationLog (jdk.vm.ci.hotspot.HotSpotSpeculationLog)1 JavaConstant (jdk.vm.ci.meta.JavaConstant)1 TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)1 Id (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id)1 AsJavaConstant (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.AsJavaConstant)1