use of org.graalvm.compiler.truffle.runtime.OptimizedCallTarget in project graal by oracle.
the class PerformanceTruffleInliningTest method testTangledGraph.
@Test
public void testTangledGraph() {
int depth = 15;
for (int i = 0; i < depth; i++) {
builder.target(Integer.toString(i));
for (int j = i; j < depth; j++) {
builder.calls(Integer.toString(j));
}
}
OptimizedCallTarget target = builder.target("main").calls("0").buildTarget();
assertRootCallsExplored(target, 1);
assertBudget(target);
}
use of org.graalvm.compiler.truffle.runtime.OptimizedCallTarget in project graal by oracle.
the class PerformanceTruffleInliningTest method testFourTangledRecursions.
@Test
public void testFourTangledRecursions() {
// @formatter:off
OptimizedCallTarget target = builder.target("four").calls("four").calls("three").calls("two").calls("one").target("three").calls("three").calls("two").calls("one").calls("four").target("two").calls("two").calls("one").calls("three").calls("four").target("one").calls("one").calls("two").calls("three").calls("four").buildTarget();
// @formatter:on
assertRootCallsExplored(target, 1);
assertBudget(target);
}
use of org.graalvm.compiler.truffle.runtime.OptimizedCallTarget in project graal by oracle.
the class SLDisableSplittingBuiltin method disableSplitting.
@Specialization
@TruffleBoundary
public SLFunction disableSplitting(SLFunction function) {
OptimizedCallTarget target = (OptimizedCallTarget) function.getCallTarget();
((SLRootNode) target.getRootNode()).setCloningAllowed(false);
return function;
}
use of org.graalvm.compiler.truffle.runtime.OptimizedCallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testOuterInvalidationTriggersOSR.
/*
* Test outer invalidation still triggers OSR.
*/
@Theory
public void testOuterInvalidationTriggersOSR(OSRLoopFactory factory) {
TestRepeatingNode repeating = new TestRepeatingNode();
TestRootNode rootNode = new TestRootNode(factory, repeating);
OptimizedCallTarget target = (OptimizedCallTarget) runtime.createCallTarget(rootNode);
// compile inner
target.call(OSR_THRESHOLD + 1);
OptimizedCallTarget osrTarget = rootNode.getOSRTarget();
assertCompiled(osrTarget);
int i;
for (i = 0; i < TruffleCompilerOptions.getValue(TruffleMinInvokeThreshold) - 2; i++) {
target.call(0);
assertNotCompiled(target);
assertCompiled(rootNode.getOSRTarget());
}
target.call(0);
assertCompiled(target);
assertCompiled(rootNode.getOSRTarget());
assertSame(rootNode.getOSRTarget(), osrTarget);
target.invalidate(this, "test");
assertNotCompiled(target);
assertCompiled(rootNode.getOSRTarget());
assertSame(rootNode.getOSRTarget(), osrTarget);
// after invalidating the outer method the osr target should still be valid and used
target.call(15);
// even though target is compiled it is invoked in interpreter
target.invalidate(this, "test");
assertCompiled(rootNode.getOSRTarget());
assertSame(rootNode.getOSRTarget(), osrTarget);
// assertNotCompiled(target);
// now externally invalidate the osr target and see if we compile again
rootNode.getOSRTarget().invalidate(this, "test");
target.call(OSR_THRESHOLD + 1);
assertCompiled(rootNode.getOSRTarget());
}
use of org.graalvm.compiler.truffle.runtime.OptimizedCallTarget in project graal by oracle.
the class PartialEvaluationTest method compileHelper.
protected OptimizedCallTarget compileHelper(String methodName, RootNode root, Object[] arguments) {
final OptimizedCallTarget compilable = (OptimizedCallTarget) (Truffle.getRuntime()).createCallTarget(root);
CompilationIdentifier compilationId = getCompilationId(compilable);
StructuredGraph actual = partialEval(compilable, arguments, AllowAssumptions.YES, compilationId);
truffleCompiler.compilePEGraph(actual, methodName, null, compilable, asCompilationRequest(compilationId), null);
return compilable;
}
Aggregations