use of com.oracle.truffle.api.RootCallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testNoInvalidationWithoutFirstExecution.
/*
* Test that if osr compilation is forced without any execution we do not deoptimize on first
* execution.
*/
@Theory
public void testNoInvalidationWithoutFirstExecution(OSRLoopFactory factory) {
TestRootNode rootNode = new TestRootNode(factory, new TestRepeatingNode());
RootCallTarget target = runtime.createCallTarget(rootNode);
rootNode.forceOSR();
assertCompiled(rootNode.getOSRTarget());
// should not invalidate OSR
target.call(1);
assertCompiled(rootNode.getOSRTarget());
Assert.assertTrue(rootNode.wasRepeatingCalledCompiled());
}
use of com.oracle.truffle.api.RootCallTarget in project graal by oracle.
the class TruffleBoundaryInliningTest method runTest.
private void runTest() {
RootNode n1 = createRootNodeAllowInline();
RootCallTarget c1 = runtime.createCallTarget(n1);
StructuredGraph allowInline = partialEval((OptimizedCallTarget) c1, new Object[] {}, StructuredGraph.AllowAssumptions.YES, CompilationIdentifier.INVALID_COMPILATION_ID);
RootNode n2 = createRootNodeNoInline();
RootCallTarget c2 = runtime.createCallTarget(n2);
StructuredGraph noInline = partialEval((OptimizedCallTarget) c2, new Object[] {}, StructuredGraph.AllowAssumptions.YES, CompilationIdentifier.INVALID_COMPILATION_ID);
checkHasTestMethod(allowInline);
checkHasTestMethod(noInline);
}
use of com.oracle.truffle.api.RootCallTarget in project graal by oracle.
the class Context method parse.
@Override
protected CallTarget parse(ParsingRequest request) throws Exception {
Source code = request.getSource();
SourceSection outer = code.createSection(0, code.getLength());
BaseNode node;
try {
node = parse(code);
} catch (LanguageError e) {
throw new IOException(e);
}
RootCallTarget afterTarget = getContextReference().get().afterTarget;
return Truffle.getRuntime().createCallTarget(new InstrumentationTestRootNode(this, "", outer, afterTarget, node));
}
use of com.oracle.truffle.api.RootCallTarget in project graal by oracle.
the class GraalTruffleRuntime method createCallTarget.
@Override
public RootCallTarget createCallTarget(RootNode rootNode) {
CompilerAsserts.neverPartOfCompilation();
final RootCallTarget newCallTarget = createClonedCallTarget(null, rootNode);
TruffleSplittingStrategy.newTargetCreated(tvmci, newCallTarget);
return newCallTarget;
}
use of com.oracle.truffle.api.RootCallTarget in project graal by oracle.
the class TruffleTreeDumpHandler method dumpInlinedTrees.
private static void dumpInlinedTrees(GraphOutput<AST, ?> output, final RootCallTarget callTarget, TruffleInlining inlining, List<RootCallTarget> dumped) throws IOException {
for (DirectCallNode callNode : NodeUtil.findAllNodeInstances(callTarget.getRootNode(), DirectCallNode.class)) {
CallTarget inlinedCallTarget = callNode.getCurrentCallTarget();
if (inlinedCallTarget instanceof RootCallTarget && callNode instanceof OptimizedDirectCallNode) {
TruffleInliningDecision decision = inlining.findByCall((OptimizedDirectCallNode) callNode);
if (decision != null && decision.shouldInline()) {
final RootCallTarget rootCallTarget = (RootCallTarget) inlinedCallTarget;
if (!dumped.contains(rootCallTarget)) {
AST ast = new AST(rootCallTarget);
output.beginGroup(ast, inlinedCallTarget.toString(), rootCallTarget.getRootNode().getName(), null, 0, DebugContext.addVersionProperties(null));
output.print(ast, Collections.emptyMap(), 0, AFTER_PROFILING);
output.endGroup();
dumped.add(rootCallTarget);
dumpInlinedTrees(output, (OptimizedCallTarget) inlinedCallTarget, decision, dumped);
}
}
}
}
}
Aggregations