Search in sources :

Example 1 with JObject

use of org.graalvm.jniutils.JNI.JObject 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 JObject

use of org.graalvm.jniutils.JNI.JObject 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 JObject

use of org.graalvm.jniutils.JNI.JObject 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 JObject

use of org.graalvm.jniutils.JNI.JObject 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 JObject

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

the class TruffleToLibGraalEntryPoints method initializeCompiler.

@TruffleToLibGraal(InitializeCompiler)
@SuppressWarnings("unused")
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_initializeCompiler")
public static void initializeCompiler(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long compilerHandle, JByteArray hsOptions, JObject hsCompilable, boolean firstInitialization) {
    try (JNIMethodScope s = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, InitializeCompiler, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(compilerHandle, HotSpotTruffleCompilerImpl.class);
        Map<String, Object> options = decodeOptions(env, hsOptions);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(s, hsCompilable);
        compiler.initialize(options, compilable, firstInitialization);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) HSObject(org.graalvm.jniutils.HSObject) JObject(org.graalvm.jniutils.JNI.JObject) JNIUtil.createString(org.graalvm.jniutils.JNIUtil.createString) JString(org.graalvm.jniutils.JNI.JString) GetSuppliedString(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString) JNIUtil.createHSString(org.graalvm.jniutils.JNIUtil.createHSString) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST) HotSpotTruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Aggregations

JObject (org.graalvm.jniutils.JNI.JObject)20 TruffleFromLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)15 JNIEnv (org.graalvm.jniutils.JNI.JNIEnv)12 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)5 JString (org.graalvm.jniutils.JNI.JString)3 TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)2 GetSuppliedString (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString)2 HotSpotTruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl)2 HSObject (org.graalvm.jniutils.HSObject)2 JNIUtil.createHSString (org.graalvm.jniutils.JNIUtil.createHSString)2 JNIUtil.createString (org.graalvm.jniutils.JNIUtil.createString)2 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)2 CompilationContext (org.graalvm.compiler.hotspot.CompilationContext)1 CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)1 TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)1 TruffleCompilationTask (org.graalvm.compiler.truffle.common.TruffleCompilationTask)1 TruffleCompilerListener (org.graalvm.compiler.truffle.common.TruffleCompilerListener)1 TruffleDebugContext (org.graalvm.compiler.truffle.common.TruffleDebugContext)1 TruffleCompilationIdentifier (org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier)1 TruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl)1