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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations