comparison graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java @ 9360:412f6e6dad73

Allow FixedGuard usages for InstanceOf nodes.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 27 Apr 2013 01:09:57 +0200
parents 21bf57680185
children 0c5bb7eb1a48
comparison
equal deleted inserted replaced
9349:0fccad3ce40d 9360:412f6e6dad73
76 return; 76 return;
77 } else if (deoptBegin.predecessor() instanceof IfNode) { 77 } else if (deoptBegin.predecessor() instanceof IfNode) {
78 IfNode ifNode = (IfNode) deoptBegin.predecessor(); 78 IfNode ifNode = (IfNode) deoptBegin.predecessor();
79 BeginNode otherBegin = ifNode.trueSuccessor(); 79 BeginNode otherBegin = ifNode.trueSuccessor();
80 LogicNode conditionNode = ifNode.condition(); 80 LogicNode conditionNode = ifNode.condition();
81 if (!(conditionNode instanceof InstanceOfNode) && !(conditionNode instanceof InstanceOfDynamicNode)) { 81 FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), deoptBegin == ifNode.trueSuccessor()));
82 // TODO The lowering currently does not support a FixedGuard as the usage of an 82 FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor();
83 // InstanceOfNode. Relax this restriction. 83 if (deoptBegin == ifNode.trueSuccessor()) {
84 FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), deoptBegin == ifNode.trueSuccessor())); 84 graph.removeSplitPropagate(ifNode, ifNode.falseSuccessor());
85 FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor(); 85 } else {
86 if (deoptBegin == ifNode.trueSuccessor()) { 86 graph.removeSplitPropagate(ifNode, ifNode.trueSuccessor());
87 graph.removeSplitPropagate(ifNode, ifNode.falseSuccessor());
88 } else {
89 graph.removeSplitPropagate(ifNode, ifNode.trueSuccessor());
90 }
91 Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);
92 FixedNode next = pred.next();
93 pred.setNext(guard);
94 guard.setNext(next);
95 return;
96 } 87 }
88 Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);
89 FixedNode next = pred.next();
90 pred.setNext(guard);
91 guard.setNext(next);
92 return;
97 } 93 }
98 94
99 // We could not convert the control split - at least cut off control flow after the split. 95 // We could not convert the control split - at least cut off control flow after the split.
100 FixedWithNextNode deoptPred = deoptBegin; 96 FixedWithNextNode deoptPred = deoptBegin;
101 FixedNode next = deoptPred.next(); 97 FixedNode next = deoptPred.next();