6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.phases.common;
24
25 import org.graalvm.compiler.core.common.cfg.Loop;
26 import org.graalvm.compiler.debug.Debug;
27 import org.graalvm.compiler.debug.DebugCloseable;
28 import org.graalvm.compiler.graph.Node;
29 import org.graalvm.compiler.nodes.AbstractBeginNode;
30 import org.graalvm.compiler.nodes.BeginNode;
31 import org.graalvm.compiler.nodes.DeoptimizeNode;
32 import org.graalvm.compiler.nodes.FixedWithNextNode;
33 import org.graalvm.compiler.nodes.GuardNode;
34 import org.graalvm.compiler.nodes.IfNode;
35 import org.graalvm.compiler.nodes.LoopBeginNode;
36 import org.graalvm.compiler.nodes.LoopExitNode;
37 import org.graalvm.compiler.nodes.StructuredGraph;
38 import org.graalvm.compiler.nodes.StructuredGraph.GuardsStage;
39 import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
40 import org.graalvm.compiler.nodes.cfg.Block;
41 import org.graalvm.compiler.phases.BasePhase;
42 import org.graalvm.compiler.phases.graph.ScheduledNodeIterator;
43 import org.graalvm.compiler.phases.schedule.SchedulePhase;
44 import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy;
45 import org.graalvm.compiler.phases.tiers.MidTierContext;
46
47 /**
122 if (graph.getGuardsStage().allowsFloatingGuards()) {
123 SchedulePhase schedulePhase = new SchedulePhase(SchedulingStrategy.EARLIEST);
124 schedulePhase.apply(graph);
125 ScheduleResult schedule = graph.getLastSchedule();
126
127 for (Block block : schedule.getCFG().getBlocks()) {
128 processBlock(block, schedule);
129 }
130 graph.setGuardsStage(GuardsStage.FIXED_DEOPTS);
131 }
132
133 assert assertNoGuardsLeft(graph);
134 }
135
136 private static boolean assertNoGuardsLeft(StructuredGraph graph) {
137 assert graph.getNodes().filter(GuardNode.class).isEmpty();
138 return true;
139 }
140
141 private static void processBlock(Block block, ScheduleResult schedule) {
142 new LowerGuards(block, Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod()).processNodes(block, schedule);
143 }
144 }
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package org.graalvm.compiler.phases.common;
24
25 import org.graalvm.compiler.core.common.cfg.Loop;
26 import org.graalvm.compiler.debug.DebugCloseable;
27 import org.graalvm.compiler.debug.DebugContext;
28 import org.graalvm.compiler.graph.Node;
29 import org.graalvm.compiler.nodes.AbstractBeginNode;
30 import org.graalvm.compiler.nodes.BeginNode;
31 import org.graalvm.compiler.nodes.DeoptimizeNode;
32 import org.graalvm.compiler.nodes.FixedWithNextNode;
33 import org.graalvm.compiler.nodes.GuardNode;
34 import org.graalvm.compiler.nodes.IfNode;
35 import org.graalvm.compiler.nodes.LoopBeginNode;
36 import org.graalvm.compiler.nodes.LoopExitNode;
37 import org.graalvm.compiler.nodes.StructuredGraph;
38 import org.graalvm.compiler.nodes.StructuredGraph.GuardsStage;
39 import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
40 import org.graalvm.compiler.nodes.cfg.Block;
41 import org.graalvm.compiler.phases.BasePhase;
42 import org.graalvm.compiler.phases.graph.ScheduledNodeIterator;
43 import org.graalvm.compiler.phases.schedule.SchedulePhase;
44 import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy;
45 import org.graalvm.compiler.phases.tiers.MidTierContext;
46
47 /**
122 if (graph.getGuardsStage().allowsFloatingGuards()) {
123 SchedulePhase schedulePhase = new SchedulePhase(SchedulingStrategy.EARLIEST);
124 schedulePhase.apply(graph);
125 ScheduleResult schedule = graph.getLastSchedule();
126
127 for (Block block : schedule.getCFG().getBlocks()) {
128 processBlock(block, schedule);
129 }
130 graph.setGuardsStage(GuardsStage.FIXED_DEOPTS);
131 }
132
133 assert assertNoGuardsLeft(graph);
134 }
135
136 private static boolean assertNoGuardsLeft(StructuredGraph graph) {
137 assert graph.getNodes().filter(GuardNode.class).isEmpty();
138 return true;
139 }
140
141 private static void processBlock(Block block, ScheduleResult schedule) {
142 DebugContext debug = block.getBeginNode().getDebug();
143 new LowerGuards(block, debug.isDumpEnabledForMethod() || debug.isLogEnabledForMethod()).processNodes(block, schedule);
144 }
145 }
|