Search in sources :

Example 16 with LoopsData

use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.

the class LoopsDataTest method testInnerFirst.

@Test
public void testInnerFirst() {
    LoopsData loops = getLoopsData();
    Set<LoopEx> seen = new HashSet<>();
    for (LoopEx loop : reversed(loops.outerFirst())) {
        assertFalse(seen.contains(loop), "%s has already been seen", loop);
        if (loop.parent() != null) {
            assertFalse(seen.contains(loop.parent()), "%s's parent (%s) should not have already been seen", loop, loop.parent());
        }
        seen.add(loop);
    }
}
Also used : LoopsData(org.graalvm.compiler.loop.LoopsData) LoopEx(org.graalvm.compiler.loop.LoopEx) HashSet(java.util.HashSet) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 17 with LoopsData

use of org.graalvm.compiler.loop.LoopsData in project graal by oracle.

the class LoopsDataTest method sanityTests.

@Test
public void sanityTests() {
    LoopsData loops = getLoopsData();
    Assert.assertEquals(8, loops.outerFirst().size());
    Assert.assertEquals(1, loops.outerFirst().get(0).loop().getDepth());
    Assert.assertEquals(1, loops.outerFirst().get(1).loop().getDepth());
    Assert.assertEquals(2, loops.outerFirst().get(2).loop().getDepth());
    Assert.assertEquals(3, loops.outerFirst().get(3).loop().getDepth());
    Assert.assertEquals(2, loops.outerFirst().get(4).loop().getDepth());
    Assert.assertEquals(2, loops.outerFirst().get(5).loop().getDepth());
    Assert.assertEquals(3, loops.outerFirst().get(6).loop().getDepth());
    Assert.assertEquals(4, loops.outerFirst().get(7).loop().getDepth());
    for (LoopEx loop : loops.loops()) {
        if (loop.parent() != null) {
            Assert.assertEquals(loop.parent().loop().getDepth() + 1, loop.loop().getDepth());
        }
    }
}
Also used : LoopsData(org.graalvm.compiler.loop.LoopsData) LoopEx(org.graalvm.compiler.loop.LoopEx) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Aggregations

LoopsData (org.graalvm.compiler.loop.LoopsData)17 LoopEx (org.graalvm.compiler.loop.LoopEx)14 DebugContext (org.graalvm.compiler.debug.DebugContext)6 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)3 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)3 Block (org.graalvm.compiler.nodes.cfg.Block)3 HashSet (java.util.HashSet)2 Node (org.graalvm.compiler.graph.Node)2 FixedNode (org.graalvm.compiler.nodes.FixedNode)2 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)2 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)2 DeadCodeEliminationPhase (org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)2 Test (org.junit.Test)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)1 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)1 PermanentBailoutException (org.graalvm.compiler.core.common.PermanentBailoutException)1 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)1 Stamp (org.graalvm.compiler.core.common.type.Stamp)1