changeset 18902:b7cb27a82d51

Don't allow guards with action == None to float
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 21 Jan 2015 10:20:41 -0800
parents 06536c3846e7
children 11ec0a5c5518
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Wed Jan 21 10:19:33 2015 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Wed Jan 21 10:20:41 2015 -0800
@@ -69,7 +69,14 @@
 
     @Override
     public void lower(LoweringTool tool) {
-        if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FLOATING_GUARDS) {
+        /*
+         * Don't allow guards with action None to float. In cases where 2 guards are testing
+         * equivalent conditions they might be lowered at the same location. If the guard with the
+         * None action is lowered before the the other guard then the code will be stuck repeatedly
+         * deoptimizing without invalidating the code. Conditional elimination will eliminate the
+         * guard if it's truly redundant in this case.
+         */
+        if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FLOATING_GUARDS && getAction() != DeoptimizationAction.None) {
             ValueNode guard = tool.createGuard(this, condition(), getReason(), getAction(), isNegated()).asNode();
             this.replaceAtUsages(guard);
             ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(guard.asNode()));