src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/PushThroughIfTest.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52910 583fd71c47d6
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28 import org.graalvm.compiler.nodes.FrameState;
    28 import org.graalvm.compiler.nodes.FrameState;
    29 import org.graalvm.compiler.nodes.StructuredGraph;
    29 import org.graalvm.compiler.nodes.StructuredGraph;
    30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
    30 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
    31 import org.graalvm.compiler.nodes.util.GraphUtil;
    31 import org.graalvm.compiler.nodes.util.GraphUtil;
    32 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    32 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    33 import org.graalvm.compiler.phases.tiers.PhaseContext;
       
    34 import org.junit.Test;
    33 import org.junit.Test;
    35 
    34 
    36 public class PushThroughIfTest extends GraalCompilerTest {
    35 public class PushThroughIfTest extends GraalCompilerTest {
    37 
    36 
    38     public int field1;
    37     public int field1;
    64         debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
    63         debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
    65         for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
    64         for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
    66             fs.replaceAtUsages(null);
    65             fs.replaceAtUsages(null);
    67             GraphUtil.killWithUnusedFloatingInputs(fs);
    66             GraphUtil.killWithUnusedFloatingInputs(fs);
    68         }
    67         }
    69         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
    68         new CanonicalizerPhase().apply(graph, getProviders());
    70         new CanonicalizerPhase().apply(graph, new PhaseContext(getProviders()));
    69         new CanonicalizerPhase().apply(graph, getProviders());
    71 
    70 
    72         StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES);
    71         StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES);
    73         for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) {
    72         for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) {
    74             fs.replaceAtUsages(null);
    73             fs.replaceAtUsages(null);
    75             GraphUtil.killWithUnusedFloatingInputs(fs);
    74             GraphUtil.killWithUnusedFloatingInputs(fs);
    76         }
    75         }
    77         new CanonicalizerPhase().apply(referenceGraph, new PhaseContext(getProviders()));
    76         new CanonicalizerPhase().apply(referenceGraph, getProviders());
    78         assertEquals(referenceGraph, graph);
    77         assertEquals(referenceGraph, graph);
    79     }
    78     }
    80 }
    79 }