Search in sources :

Example 6 with CompilableTruffleAST

use of org.graalvm.compiler.truffle.common.CompilableTruffleAST in project graal by oracle.

the class TruffleToLibGraalEntryPoints method pendingTransferToInterpreterOffset.

@TruffleToLibGraal(PendingTransferToInterpreterOffset)
@SuppressWarnings("unused")
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_pendingTransferToInterpreterOffset")
public static int pendingTransferToInterpreterOffset(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, JObject hsCompilable) {
    try (JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, PendingTransferToInterpreterOffset, env)) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(scope, hsCompilable);
        return compiler.pendingTransferToInterpreterOffset(compilable);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        return 0;
    }
}
Also used : JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) 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)

Example 7 with CompilableTruffleAST

use of org.graalvm.compiler.truffle.common.CompilableTruffleAST in project graal by oracle.

the class TruffleToLibGraalEntryPoints method openCompilation.

@TruffleToLibGraal(OpenCompilation)
@SuppressWarnings({ "unused", "try" })
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_openCompilation")
public static long openCompilation(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, JObject hsCompilable) {
    JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, OpenCompilation, env);
    try (JNIMethodScope s = scope) {
        HotSpotTruffleCompilerImpl compiler = LibGraalObjectHandles.resolve(handle, HotSpotTruffleCompilerImpl.class);
        CompilableTruffleAST compilable = new HSCompilableTruffleAST(env, hsCompilable);
        TruffleCompilation compilation = compiler.openCompilation(compilable);
        assert compilation instanceof TruffleCompilationIdentifier;
        return LibGraalObjectHandles.create(compilation);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        return 0;
    }
}
Also used : TruffleCompilationIdentifier(org.graalvm.compiler.truffle.compiler.TruffleCompilationIdentifier) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) TruffleCompilation(org.graalvm.compiler.truffle.common.TruffleCompilation) 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)

Example 8 with CompilableTruffleAST

use of org.graalvm.compiler.truffle.common.CompilableTruffleAST in project graal by oracle.

the class TruffleCompilerImpl method openDebugContext.

@Override
public final TruffleDebugContext openDebugContext(Map<String, Object> options, TruffleCompilation compilation) {
    OptionValues graalOptions = TruffleCompilerRuntime.getRuntime().getGraalOptions(OptionValues.class);
    final DebugContext debugContext;
    if (compilation == null) {
        debugContext = new Builder(graalOptions).build();
    } else {
        TruffleCompilationIdentifier ident = asTruffleCompilationIdentifier(compilation);
        CompilableTruffleAST compilable = ident.getCompilable();
        org.graalvm.options.OptionValues truffleOptions = getOptionsForCompiler(options);
        if (ExpansionStatistics.isEnabled(truffleOptions)) {
            graalOptions = enableNodeSourcePositions(graalOptions);
        }
        debugContext = createDebugContext(graalOptions, ident, compilable, DebugContext.getDefaultLogStream());
    }
    return new TruffleDebugContextImpl(debugContext);
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) Builder(org.graalvm.compiler.debug.DebugContext.Builder) TruffleDebugContext(org.graalvm.compiler.truffle.common.TruffleDebugContext) DebugContext(org.graalvm.compiler.debug.DebugContext) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST)

Example 9 with CompilableTruffleAST

use of org.graalvm.compiler.truffle.common.CompilableTruffleAST in project graal by oracle.

the class TruffleCompilerImpl method doCompile.

@Override
@SuppressWarnings("try")
public final void doCompile(TruffleDebugContext truffleDebug, TruffleCompilation compilation, Map<String, Object> optionsMap, TruffleCompilationTask task, TruffleCompilerListener inListener) {
    Objects.requireNonNull(compilation, "Compilation must be non null.");
    org.graalvm.options.OptionValues options = getOptionsForCompiler(optionsMap);
    TruffleCompilationIdentifier compilationId = asTruffleCompilationIdentifier(compilation);
    CompilableTruffleAST compilable = compilationId.getCompilable();
    boolean usingCallersDebug = truffleDebug instanceof TruffleDebugContextImpl;
    if (usingCallersDebug) {
        final DebugContext callerDebug = ((TruffleDebugContextImpl) truffleDebug).debugContext;
        try (DebugContext.Scope s = maybeOpenTruffleScope(compilable, callerDebug)) {
            actuallyCompile(options, task, inListener, compilationId, compilable, callerDebug);
        } catch (Throwable e) {
            notifyCompilableOfFailure(compilable, e, isSuppressedFailure(compilable, e));
        }
    } else {
        OptionValues debugContextOptionValues = TruffleCompilerRuntime.getRuntime().getGraalOptions(OptionValues.class);
        try (DebugContext graalDebug = createDebugContext(debugContextOptionValues, compilationId, compilable, DebugContext.getDefaultLogStream());
            DebugContext.Scope s = maybeOpenTruffleScope(compilable, graalDebug)) {
            actuallyCompile(options, task, inListener, compilationId, compilable, graalDebug);
        } catch (Throwable e) {
            notifyCompilableOfFailure(compilable, e, isSuppressedFailure(compilable, e));
        }
    }
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) Scope(org.graalvm.compiler.debug.DebugContext.Scope) TruffleDebugContext(org.graalvm.compiler.truffle.common.TruffleDebugContext) DebugContext(org.graalvm.compiler.debug.DebugContext) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST)

Example 10 with CompilableTruffleAST

use of org.graalvm.compiler.truffle.common.CompilableTruffleAST in project graal by oracle.

the class IsolatedCompilableTruffleAST method getNodeRewritingAssumption0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<Assumption> getNodeRewritingAssumption0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> handle) {
    CompilableTruffleAST ast = IsolatedCompileClient.get().unhand(handle);
    JavaConstant assumptionConstant = ast.getNodeRewritingAssumptionConstant();
    Assumption assumption = (Assumption) SubstrateObjectConstant.asObject(assumptionConstant);
    return IsolatedCompileClient.get().hand(assumption);
}
Also used : JavaConstant(jdk.vm.ci.meta.JavaConstant) CompilableTruffleAST(org.graalvm.compiler.truffle.common.CompilableTruffleAST) SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) Assumption(com.oracle.truffle.api.Assumption) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)12 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)6 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)3 SubstrateCompilableTruffleAST (com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST)3 TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)3 HotSpotTruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl)3 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)3 Assumption (com.oracle.truffle.api.Assumption)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 DebugContext (org.graalvm.compiler.debug.DebugContext)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 TruffleDebugContext (org.graalvm.compiler.truffle.common.TruffleDebugContext)2 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 Builder (org.graalvm.compiler.debug.DebugContext.Builder)1 Scope (org.graalvm.compiler.debug.DebugContext.Scope)1 TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)1