use of org.graalvm.compiler.truffle.common.TruffleInliningData in project graal by oracle.
the class IsolatedTruffleInlining method getPosition0.
@CEntryPoint(include = CEntryPoint.NotIncludedAutomatically.class)
@CEntryPointOptions(publishAs = CEntryPointOptions.Publish.NotPublished)
private static CompilerHandle<TruffleSourceLanguagePosition> getPosition0(@SuppressWarnings("unused") ClientIsolateThread client, ClientHandle<? extends TruffleInliningData> inliningHandle, ClientHandle<?> callNodeConstantHandle) {
TruffleInliningData inlining = IsolatedCompileClient.get().unhand(inliningHandle);
JavaConstant callNodeConstant = SubstrateObjectConstant.forObject(IsolatedCompileClient.get().unhand(callNodeConstantHandle));
TruffleSourceLanguagePosition position = inlining.getPosition(callNodeConstant);
if (position == null) {
return IsolatedHandles.nullHandle();
}
return createPositionInCompiler(IsolatedCompileClient.get().getCompiler(), IsolatedCompileClient.get().hand(position), position.getLineNumber(), position.getOffsetStart(), position.getOffsetEnd(), position.getNodeId());
}
use of org.graalvm.compiler.truffle.common.TruffleInliningData 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 org.graalvm.compiler.truffle.common.TruffleInliningData 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 org.graalvm.compiler.truffle.common.TruffleInliningData in project graal by oracle.
the class AgnosticInliningPhaseTest method runLanguageAgnosticInliningPhase.
protected StructuredGraph runLanguageAgnosticInliningPhase(OptimizedCallTarget callTarget) {
final PartialEvaluator partialEvaluator = getTruffleCompiler(callTarget).getPartialEvaluator();
final CompilationIdentifier compilationIdentifier = new CompilationIdentifier() {
@Override
public String toString(Verbosity verbosity) {
return "";
}
};
final PartialEvaluator.Request request = partialEvaluator.new Request(callTarget.getOptionValues(), getDebugContext(), callTarget, partialEvaluator.rootForCallTarget(callTarget), compilationIdentifier, getSpeculationLog(), new TruffleCompilerImpl.CancellableTruffleCompilationTask(new TruffleCompilationTask() {
private TruffleInliningData inlining = new TruffleInlining();
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isLastTier() {
return true;
}
@Override
public TruffleInliningData inliningData() {
return inlining;
}
@Override
public boolean hasNextTier() {
return false;
}
}));
final AgnosticInliningPhase agnosticInliningPhase = new AgnosticInliningPhase(partialEvaluator, request);
agnosticInliningPhase.apply(request.graph, getTruffleCompiler(callTarget).getPartialEvaluator().getProviders());
return request.graph;
}
use of org.graalvm.compiler.truffle.common.TruffleInliningData in project graal by oracle.
the class PerformanceWarningTest method testHelper.
@SuppressWarnings("try")
private void testHelper(RootNode rootNode, boolean expectException, String... outputStrings) {
// Compile and capture output to logger's stream.
boolean seenException = false;
try {
OptimizedCallTarget target = (OptimizedCallTarget) rootNode.getCallTarget();
DebugContext debug = new Builder(GraalTruffleRuntime.getRuntime().getGraalOptions(OptionValues.class)).build();
try (DebugCloseable d = debug.disableIntercept();
DebugContext.Scope s = debug.scope("PerformanceWarningTest")) {
final OptimizedCallTarget compilable = target;
CompilationIdentifier compilationId = getTruffleCompiler(target).createCompilationIdentifier(compilable);
getTruffleCompiler(target).compileAST(compilable.getOptionValues(), debug, compilable, compilationId, new TruffleCompilerImpl.CancellableTruffleCompilationTask(new TruffleCompilationTask() {
private TruffleInliningData inlining = new TruffleInlining();
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isLastTier() {
return true;
}
@Override
public TruffleInliningData inliningData() {
return inlining;
}
@Override
public boolean hasNextTier() {
return false;
}
}), null);
assertTrue(compilable.isValid());
}
} catch (AssertionError e) {
seenException = true;
if (!expectException) {
throw new AssertionError("Unexpected exception caught." + (outContent.size() > 0 ? '\n' + outContent.toString() : ""), e);
}
}
if (expectException && !seenException) {
Assert.assertTrue("Expected exception not caught.", false);
}
// Check output on TTY.
String output = outContent.toString();
if (outputStrings == EMPTY_PERF_WARNINGS) {
Assert.assertEquals("", output);
} else {
for (String s : outputStrings) {
Assert.assertTrue(String.format("Root node class %s: \"%s\" not found in output \"%s\"", rootNode.getClass().getName(), s, output), output.contains(s));
}
}
}
Aggregations