Search in sources :

Example 76 with CanonicalizerPhase

use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.

the class NodePropertiesTest method testFieldStore.

@Test
public void testFieldStore() {
    StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldStore"));
    HighTierContext htc = getDefaultHighTierContext();
    new CanonicalizerPhase().apply(g1, htc);
    GraphCostPhase gc1 = new GraphCostPhase();
    gc1.apply(g1, htc);
    Assert.assertEquals(15, gc1.finalCycles, 25);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) Test(org.junit.Test)

Example 77 with CanonicalizerPhase

use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.

the class NodePropertiesTest method testFieldLoad.

@Test
public void testFieldLoad() {
    StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldLoad"));
    HighTierContext htc = getDefaultHighTierContext();
    new CanonicalizerPhase().apply(g1, htc);
    GraphCostPhase gc1 = new GraphCostPhase();
    gc1.apply(g1, htc);
    Assert.assertEquals(15, gc1.finalCycles, 25);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) Test(org.junit.Test)

Example 78 with CanonicalizerPhase

use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.

the class NodePropertiesTest method testArrayStore.

@Test
public void testArrayStore() {
    StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("arrayStoreTest"));
    HighTierContext htc = getDefaultHighTierContext();
    new CanonicalizerPhase().apply(g1, htc);
    GraphCostPhase gc1 = new GraphCostPhase();
    gc1.apply(g1, htc);
    Assert.assertEquals(15, gc1.finalCycles, 25);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) Test(org.junit.Test)

Example 79 with CanonicalizerPhase

use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.

the class NodePropertiesTest method testCanonicalizationExample.

@Test
public void testCanonicalizationExample() {
    HighTierContext htc = getDefaultHighTierContext();
    ImprovementSavingCanonicalizer c1 = new ImprovementSavingCanonicalizer();
    StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("test1Snippet"));
    new CanonicalizerPhase(c1).apply(g1, htc);
    ImprovementSavingCanonicalizer c2 = new ImprovementSavingCanonicalizer();
    StructuredGraph g2 = parseForCompile(getResolvedJavaMethod("test2Snippet"));
    new CanonicalizerPhase(c2).apply(g2, htc);
    Assert.assertEquals(0, c1.savedCycles);
    Assert.assertEquals(0, c2.savedCycles);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) Test(org.junit.Test)

Example 80 with CanonicalizerPhase

use of org.graalvm.compiler.phases.common.CanonicalizerPhase in project graal by oracle.

the class NodePropertiesTest method testExpectUntrusted.

@Test
public void testExpectUntrusted() {
    StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("untrused01"));
    HighTierContext htc = getDefaultHighTierContext();
    new CanonicalizerPhase().apply(g1, htc);
    GraphCostPhase gc1 = new GraphCostPhase();
    gc1.apply(g1, htc);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) Test(org.junit.Test)

Aggregations

CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)114 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)98 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)60 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)48 DebugContext (org.graalvm.compiler.debug.DebugContext)34 Test (org.junit.Test)33 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)31 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)27 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)17 DeadCodeEliminationPhase (org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)16 PartialEscapePhase (org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase)14 Node (org.graalvm.compiler.graph.Node)12 FloatingReadPhase (org.graalvm.compiler.phases.common.FloatingReadPhase)12 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)10 OptionValues (org.graalvm.compiler.options.OptionValues)10 GuardLoweringPhase (org.graalvm.compiler.phases.common.GuardLoweringPhase)10 ConditionalEliminationPhase (org.graalvm.compiler.phases.common.ConditionalEliminationPhase)9 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)9 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)8 Invoke (org.graalvm.compiler.nodes.Invoke)8