< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragmentInside.java

Print this page




 374                         AbstractBeginNode newValue = graph.add(new BeginNode());
 375                         seenNode.put(original, newValue);
 376                         return newValue;
 377                     }
 378                     if (original instanceof LoopEndNode && ((LoopEndNode) original).loopBegin() == loopBegin) {
 379                         Node value = seenNode.get(original);
 380                         if (value != null) {
 381                             return value;
 382                         }
 383                         EndNode newValue = graph.add(new EndNode());
 384                         seenNode.put(original, newValue);
 385                         return newValue;
 386                     }
 387                     return original;
 388                 }
 389             }
 390         };
 391     }
 392 
 393     @Override
 394     protected void finishDuplication() {
 395         // TODO (gd) ?
 396     }
 397 
 398     @Override
 399     protected void beforeDuplication() {
 400         // Nothing to do
 401     }
 402 
 403     private static PhiNode patchPhi(StructuredGraph graph, PhiNode phi, AbstractMergeNode merge) {
 404         PhiNode ret;
 405         if (phi instanceof ValuePhiNode) {
 406             ret = new ValuePhiNode(phi.stamp(NodeView.DEFAULT), merge);
 407         } else if (phi instanceof GuardPhiNode) {
 408             ret = new GuardPhiNode(merge);
 409         } else if (phi instanceof MemoryPhiNode) {
 410             ret = new MemoryPhiNode(merge, ((MemoryPhiNode) phi).getLocationIdentity());
 411         } else {
 412             throw GraalError.shouldNotReachHere();
 413         }
 414         return graph.addWithoutUnique(ret);
 415     }
 416 
 417     private void patchPeeling(LoopFragmentInside peel) {
 418         LoopBeginNode loopBegin = loop().loopBegin();




 374                         AbstractBeginNode newValue = graph.add(new BeginNode());
 375                         seenNode.put(original, newValue);
 376                         return newValue;
 377                     }
 378                     if (original instanceof LoopEndNode && ((LoopEndNode) original).loopBegin() == loopBegin) {
 379                         Node value = seenNode.get(original);
 380                         if (value != null) {
 381                             return value;
 382                         }
 383                         EndNode newValue = graph.add(new EndNode());
 384                         seenNode.put(original, newValue);
 385                         return newValue;
 386                     }
 387                     return original;
 388                 }
 389             }
 390         };
 391     }
 392 
 393     @Override





 394     protected void beforeDuplication() {
 395         // Nothing to do
 396     }
 397 
 398     private static PhiNode patchPhi(StructuredGraph graph, PhiNode phi, AbstractMergeNode merge) {
 399         PhiNode ret;
 400         if (phi instanceof ValuePhiNode) {
 401             ret = new ValuePhiNode(phi.stamp(NodeView.DEFAULT), merge);
 402         } else if (phi instanceof GuardPhiNode) {
 403             ret = new GuardPhiNode(merge);
 404         } else if (phi instanceof MemoryPhiNode) {
 405             ret = new MemoryPhiNode(merge, ((MemoryPhiNode) phi).getLocationIdentity());
 406         } else {
 407             throw GraalError.shouldNotReachHere();
 408         }
 409         return graph.addWithoutUnique(ret);
 410     }
 411 
 412     private void patchPeeling(LoopFragmentInside peel) {
 413         LoopBeginNode loopBegin = loop().loopBegin();


< prev index next >