Search in sources :

Example 1 with SubstrateCompilableTruffleAST

use of com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST in project graal by oracle.

the class IsolateAwareTruffleCompiler method doCompile.

@Override
@SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE", justification = "False positive.")
public void doCompile(TruffleDebugContext debug, TruffleCompilation compilation, Map<String, Object> options, TruffleCompilationTask task, TruffleCompilerListener listener) {
    if (!SubstrateOptions.shouldCompileInIsolates()) {
        delegate.doCompile(null, compilation, options, task, listener);
        return;
    }
    CompilerIsolateThread context = beforeCompilation();
    try {
        IsolatedCompileClient client = new IsolatedCompileClient(context);
        IsolatedCompileClient.set(client);
        try {
            byte[] encodedOptions = options.isEmpty() ? null : OptionsEncoder.encode(options);
            IsolatedEventContext eventContext = null;
            if (listener != null) {
                eventContext = new IsolatedEventContext(listener, compilation.getCompilable(), task);
            }
            ClientHandle<String> thrownException = doCompile0(context, (ClientIsolateThread) CurrentIsolate.getCurrentThread(), ImageHeapObjects.ref(delegate), client.hand(((TruffleCompilationIdentifier) compilation)), client.hand((SubstrateCompilableTruffleAST) compilation.getCompilable()), client.hand(encodedOptions), IsolatedGraalUtils.getNullableArrayLength(encodedOptions), client.hand(task), client.hand(eventContext), firstCompilation.getAndSet(false));
            String exception = client.unhand(thrownException);
            if (exception != null) {
                throw new RuntimeException("doCompile threw: " + exception);
            }
        } finally {
            IsolatedCompileClient.set(null);
        }
    } finally {
        afterCompilation(context);
    }
}
Also used : IsolatedCompileClient(com.oracle.svm.graal.isolated.IsolatedCompileClient) SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) CompilerIsolateThread(com.oracle.svm.graal.isolated.CompilerIsolateThread) SuppressFBWarnings(org.graalvm.compiler.core.common.SuppressFBWarnings)

Example 2 with SubstrateCompilableTruffleAST

use of com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST in project graal by oracle.

the class IsolatedCompilableTruffleAST method cancelCompilation0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static boolean cancelCompilation0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> compilableHandle, ClientHandle<String> reasonHandle) {
    final IsolatedCompileClient isolatedCompileClient = IsolatedCompileClient.get();
    final SubstrateCompilableTruffleAST compilable = isolatedCompileClient.unhand(compilableHandle);
    final String reason = isolatedCompileClient.unhand(reasonHandle);
    return compilable.cancelCompilation(reason);
}
Also used : IsolatedCompileClient(com.oracle.svm.graal.isolated.IsolatedCompileClient) SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 3 with SubstrateCompilableTruffleAST

use of com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST in project graal by oracle.

the class IsolatedCompilableTruffleAST method getCompilationSpeculationLog0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<SpeculationLog> getCompilationSpeculationLog0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> compilableHandle) {
    SubstrateCompilableTruffleAST compilable = IsolatedCompileClient.get().unhand(compilableHandle);
    SpeculationLog log = compilable.getCompilationSpeculationLog();
    return IsolatedCompileClient.get().hand(log);
}
Also used : SpeculationLog(jdk.vm.ci.meta.SpeculationLog) IsolatedSpeculationLog(com.oracle.svm.graal.isolated.IsolatedSpeculationLog) SubstrateCompilableTruffleAST(com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 4 with SubstrateCompilableTruffleAST

use of com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST 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)

Example 5 with SubstrateCompilableTruffleAST

use of com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST in project graal by oracle.

the class IsolatedCompilableTruffleAST method getValidRootAssumption0.

@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<Assumption> getValidRootAssumption0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> handle) {
    CompilableTruffleAST ast = IsolatedCompileClient.get().unhand(handle);
    JavaConstant assumptionConstant = ast.getValidRootAssumptionConstant();
    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

SubstrateCompilableTruffleAST (com.oracle.svm.truffle.api.SubstrateCompilableTruffleAST)9 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)8 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)8 IsolatedCompileClient (com.oracle.svm.graal.isolated.IsolatedCompileClient)3 CompilableTruffleAST (org.graalvm.compiler.truffle.common.CompilableTruffleAST)3 Assumption (com.oracle.truffle.api.Assumption)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 TruffleCallNode (org.graalvm.compiler.truffle.common.TruffleCallNode)2 ClientHandle (com.oracle.svm.graal.isolated.ClientHandle)1 CompilerIsolateThread (com.oracle.svm.graal.isolated.CompilerIsolateThread)1 IsolatedSpeculationLog (com.oracle.svm.graal.isolated.IsolatedSpeculationLog)1 SpeculationLog (jdk.vm.ci.meta.SpeculationLog)1 SuppressFBWarnings (org.graalvm.compiler.core.common.SuppressFBWarnings)1 PinnedObject (org.graalvm.nativeimage.PinnedObject)1