use of com.oracle.svm.graal.isolated.IsolatedCompileClient 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.graal.isolated.IsolatedCompileClient 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.graal.isolated.IsolatedCompileClient in project graal by oracle.
the class IsolatedTruffleInlining method addInlinedTarget0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static void addInlinedTarget0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<? extends TruffleInliningData> providerHandle, ClientHandle<SubstrateCompilableTruffleAST> targetHandle) {
final IsolatedCompileClient isolatedCompileClient = IsolatedCompileClient.get();
TruffleInliningData truffleInliningData = isolatedCompileClient.unhand(providerHandle);
truffleInliningData.addInlinedTarget(isolatedCompileClient.unhand(targetHandle));
}
use of com.oracle.svm.graal.isolated.IsolatedCompileClient in project graal by oracle.
the class IsolatedTruffleInlining method addTargetToDequeue0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static void addTargetToDequeue0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<? extends TruffleInliningData> providerHandle, ClientHandle<SubstrateCompilableTruffleAST> targetHandle) {
final IsolatedCompileClient isolatedCompileClient = IsolatedCompileClient.get();
TruffleInliningData truffleInliningData = isolatedCompileClient.unhand(providerHandle);
truffleInliningData.addTargetToDequeue(isolatedCompileClient.unhand(targetHandle));
}
use of com.oracle.svm.graal.isolated.IsolatedCompileClient in project graal by oracle.
the class IsolatedCompilableTruffleAST method dequeueInlined0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static void dequeueInlined0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<SubstrateCompilableTruffleAST> handle) {
final IsolatedCompileClient isolatedCompileClient = IsolatedCompileClient.get();
final SubstrateCompilableTruffleAST compilable = isolatedCompileClient.unhand(handle);
compilable.dequeueInlined();
}
Aggregations