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