Search in sources :

Example 11 with TruffleFromLibGraal

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

the class HSCompilableTruffleAST method getName.

@TruffleFromLibGraal(GetCompilableName)
@Override
public String getName() {
    String res = cachedName;
    if (res == null) {
        JNIEnv env = JNIMethodScope.env();
        JString name = callGetCompilableName(env, getHandle());
        res = createString(env, name);
        cachedName = 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)

Example 12 with TruffleFromLibGraal

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

the class HSCompilableTruffleAST method onCompilationFailed.

@TruffleFromLibGraal(CreateStringSupplier)
@TruffleFromLibGraal(OnCompilationFailed)
@Override
public void onCompilationFailed(Supplier<String> serializedException, boolean silent, boolean bailout, boolean permanentBailout, boolean graphTooBig) {
    long serializedExceptionHandle = LibGraalObjectHandles.create(serializedException);
    boolean success = false;
    JNIEnv env = env();
    try {
        JObject instance = callCreateStringSupplier(env, serializedExceptionHandle);
        callOnCompilationFailed(env, getHandle(), instance, silent, bailout, permanentBailout, graphTooBig);
        success = true;
    } finally {
        if (!success) {
            LibGraalObjectHandles.remove(serializedExceptionHandle);
        }
    }
}
Also used : JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 13 with TruffleFromLibGraal

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

the class HSCompilableTruffleAST method getCallNodes.

@TruffleFromLibGraal(GetCallNodes)
@Override
public TruffleCallNode[] getCallNodes() {
    JNIMethodScope scope = scope();
    JNIEnv env = scope.getEnv();
    JObjectArray peerArr = callGetCallNodes(env, getHandle());
    int len = JNIUtil.GetArrayLength(env, peerArr);
    TruffleCallNode[] res = new TruffleCallNode[len];
    for (int i = 0; i < len; i++) {
        JObject peerTruffleCallNode = JNIUtil.GetObjectArrayElement(env, peerArr, i);
        res[i] = new HSTruffleCallNode(scope, peerTruffleCallNode);
    }
    return res;
}
Also used : TruffleCallNode(org.graalvm.compiler.truffle.common.TruffleCallNode) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) JObjectArray(org.graalvm.jniutils.JNI.JObjectArray) JObject(org.graalvm.jniutils.JNI.JObject) JNIEnv(org.graalvm.jniutils.JNI.JNIEnv) TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)

Example 14 with TruffleFromLibGraal

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

the class HSTruffleCompilerRuntime method isSuppressedFailure.

@TruffleFromLibGraal(CreateStringSupplier)
@TruffleFromLibGraal(IsSuppressedFailure)
@Override
public boolean isSuppressedFailure(CompilableTruffleAST compilable, Supplier<String> serializedException) {
    long serializedExceptionHandle = LibGraalObjectHandles.create(serializedException);
    boolean success = false;
    JNIEnv env = env();
    try {
        JObject instance = callCreateStringSupplier(env, serializedExceptionHandle);
        boolean res = callIsSuppressedFailure(env, getHandle(), ((HSCompilableTruffleAST) compilable).getHandle(), instance);
        success = true;
        return res;
    } finally {
        if (!success) {
            LibGraalObjectHandles.remove(serializedExceptionHandle);
        }
    }
}
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 TruffleFromLibGraal

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

the class HSTruffleCompilerRuntime method asCompilableTruffleAST.

@TruffleFromLibGraal(AsCompilableTruffleAST)
@Override
public CompilableTruffleAST asCompilableTruffleAST(JavaConstant constant) {
    JNIMethodScope scope = JNIMethodScope.scopeOrNull();
    if (scope == null) {
        return null;
    }
    long constantHandle = LibGraal.translate(constant);
    JObject hsCompilable = callAsCompilableTruffleAST(scope.getEnv(), getHandle(), constantHandle);
    if (hsCompilable.isNull()) {
        return null;
    } else {
        return new HSCompilableTruffleAST(scope, hsCompilable);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) JObject(org.graalvm.jniutils.JNI.JObject) 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