use of com.oracle.svm.graal.isolated.IsolatedCompileContext in project graal by oracle.
the class IsolateAwareTruffleCompiler method doCompile0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static ClientHandle<String> doCompile0(@SuppressWarnings("unused") @CEntryPoint.IsolateThreadContext CompilerIsolateThread context, ClientIsolateThread client, ImageHeapRef<SubstrateTruffleCompiler> delegateRef, ClientHandle<TruffleCompilationIdentifier> compilationIdentifierHandle, ClientHandle<SubstrateCompilableTruffleAST> compilableHandle, ClientHandle<byte[]> encodedOptionsHandle, int encodedOptionsLength, ClientHandle<TruffleCompilationTask> taskHandle, ClientHandle<IsolatedEventContext> eventContextHandle, boolean firstCompilation) {
IsolatedCompileContext.set(new IsolatedCompileContext(client));
try {
SubstrateTruffleCompiler delegate = ImageHeapObjects.deref(delegateRef);
Map<String, Object> options = decodeOptions(client, encodedOptionsHandle, encodedOptionsLength);
IsolatedCompilableTruffleAST compilable = new IsolatedCompilableTruffleAST(compilableHandle);
delegate.initialize(options, compilable, firstCompilation);
TruffleCompilation compilation = new IsolatedCompilationIdentifier(compilationIdentifierHandle, compilable);
TruffleCompilationTask task = null;
if (taskHandle.notEqual(IsolatedHandles.nullHandle())) {
task = new IsolatedTruffleCompilationTask(taskHandle);
}
TruffleCompilerListener listener = null;
if (eventContextHandle.notEqual(IsolatedHandles.nullHandle())) {
listener = new IsolatedTruffleCompilerEventForwarder(eventContextHandle);
}
delegate.doCompile(null, compilation, options, task, listener);
// no exception
return IsolatedHandles.nullHandle();
} catch (Throwable t) {
StringWriter writer = new StringWriter();
t.printStackTrace(new PrintWriter(writer));
return IsolatedCompileContext.get().createStringInClient(writer.toString());
} finally {
/*
* Compilation isolate do not use a dedicated reference handler thread, so we trigger
* the reference handling manually when a compilation finishes.
*/
Heap.getHeap().doReferenceHandling();
IsolatedCompileContext.set(null);
}
}
use of com.oracle.svm.graal.isolated.IsolatedCompileContext in project graal by oracle.
the class IsolatedCompilableTruffleAST method dequeueInlined.
@Override
public void dequeueInlined() {
final IsolatedCompileContext context = IsolatedCompileContext.get();
dequeueInlined0(context.getClient(), handle);
}
Aggregations