Mercurial > hg > truffle
comparison graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java @ 18993:480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 28 Jan 2015 00:50:31 +0100 |
parents | edf3a7fdd067 |
children | a2cb19764970 |
comparison
equal
deleted
inserted
replaced
18992:b1c03c2bfa40 | 18993:480bd3b1adcd |
---|---|
120 if (merge.phis().isEmpty()) { | 120 if (merge.phis().isEmpty()) { |
121 for (AbstractEndNode end : merge.cfgPredecessors().snapshot()) { | 121 for (AbstractEndNode end : merge.cfgPredecessors().snapshot()) { |
122 checkPredecessor(deopt, end.predecessor(), deoptimizationReason); | 122 checkPredecessor(deopt, end.predecessor(), deoptimizationReason); |
123 } | 123 } |
124 } | 124 } |
125 } else if (predecessor instanceof BeginNode) { | 125 } else if (predecessor instanceof AbstractBeginNode) { |
126 checkPredecessor(deopt, predecessor, deoptimizationReason); | 126 checkPredecessor(deopt, predecessor, deoptimizationReason); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 private static void checkPredecessor(AbstractDeoptimizeNode deopt, Node predecessor, DeoptimizationReason deoptimizationReason) { | 130 private static void checkPredecessor(AbstractDeoptimizeNode deopt, Node predecessor, DeoptimizationReason deoptimizationReason) { |
131 Node current = predecessor; | 131 Node current = predecessor; |
132 BeginNode branch = null; | 132 AbstractBeginNode branch = null; |
133 while (current instanceof BeginNode) { | 133 while (current instanceof AbstractBeginNode) { |
134 branch = (BeginNode) current; | 134 branch = (AbstractBeginNode) current; |
135 if (branch.anchored().isNotEmpty()) { | 135 if (branch.anchored().isNotEmpty()) { |
136 // some input of the deopt framestate is anchored to this branch | 136 // some input of the deopt framestate is anchored to this branch |
137 return; | 137 return; |
138 } | 138 } |
139 current = current.predecessor(); | 139 current = current.predecessor(); |
157 } | 157 } |
158 if (deoptimizationReason == DeoptimizationReason.UnreachedCode) { | 158 if (deoptimizationReason == DeoptimizationReason.UnreachedCode) { |
159 metricTrappingNullCheckUnreached.increment(); | 159 metricTrappingNullCheckUnreached.increment(); |
160 } | 160 } |
161 IsNullNode isNullNode = (IsNullNode) condition; | 161 IsNullNode isNullNode = (IsNullNode) condition; |
162 BeginNode nonTrappingContinuation = ifNode.falseSuccessor(); | 162 AbstractBeginNode nonTrappingContinuation = ifNode.falseSuccessor(); |
163 BeginNode trappingContinuation = ifNode.trueSuccessor(); | 163 AbstractBeginNode trappingContinuation = ifNode.trueSuccessor(); |
164 NullCheckNode trappingNullCheck = deopt.graph().add(new NullCheckNode(isNullNode.getValue())); | 164 NullCheckNode trappingNullCheck = deopt.graph().add(new NullCheckNode(isNullNode.getValue())); |
165 trappingNullCheck.setStateBefore(deopt.stateBefore()); | 165 trappingNullCheck.setStateBefore(deopt.stateBefore()); |
166 deopt.graph().replaceSplit(ifNode, trappingNullCheck, nonTrappingContinuation); | 166 deopt.graph().replaceSplit(ifNode, trappingNullCheck, nonTrappingContinuation); |
167 | 167 |
168 /* | 168 /* |
169 * We now have the pattern NullCheck/BeginNode/... It's possible some node is using the | 169 * We now have the pattern NullCheck/BeginNode/... It's possible some node is using the |
170 * BeginNode as a guard input, so replace guard users of the Begin with the NullCheck and | 170 * BeginNode as a guard input, so replace guard users of the Begin with the NullCheck and |
171 * then remove the Begin from the graph. | 171 * then remove the Begin from the graph. |
172 */ | 172 */ |
173 nonTrappingContinuation.replaceAtUsages(InputType.Guard, trappingNullCheck); | 173 nonTrappingContinuation.replaceAtUsages(InputType.Guard, trappingNullCheck); |
174 if (nonTrappingContinuation.getClass() == BeginNode.class) { | 174 if (nonTrappingContinuation.getClass() == AbstractBeginNode.class) { |
175 FixedNode next = nonTrappingContinuation.next(); | 175 FixedNode next = nonTrappingContinuation.next(); |
176 nonTrappingContinuation.clearSuccessors(); | 176 nonTrappingContinuation.clearSuccessors(); |
177 trappingNullCheck.setNext(next); | 177 trappingNullCheck.setNext(next); |
178 nonTrappingContinuation.safeDelete(); | 178 nonTrappingContinuation.safeDelete(); |
179 } else { | 179 } else { |