< prev index next >

test/testlibrary/jittester/src/jdk/test/lib/jittester/loops/DoWhile.java

Print this page

        

@@ -40,22 +40,23 @@
     }
     public enum DoWhilePart {
         HEADER,
         BODY1,
         BODY2,
-    };
+    }
     private final Loop loop;
     // header;                  [subblock]
     // do {
     //      body1;              [subblock with breaks]
     //      mutate(counter);
     //      body2;              [subblock with breaks]
     // } while(condition);
     private long thisLoopIterLimit = 0;
 
-    public DoWhile(int level, Loop loop, long thisLoopIterLimit, IRNode header,
-            IRNode body1, IRNode body2) {
+    public DoWhile(int level, Loop loop, long thisLoopIterLimit, Block header,
+                   Block body1, Block body2) {
+        super(body1.getResultType());
         this.level = level;
         this.loop = loop;
         this.thisLoopIterLimit = thisLoopIterLimit;
         addChild(header);
         addChild(body1);

@@ -83,15 +84,14 @@
     @Override
     public boolean removeSelf() {
         IRNode header = getChildren().get(DoWhilePart.HEADER.ordinal());
         List<IRNode> siblings = getParent().getChildren();
         int index = siblings.indexOf(this);
+        siblings.set(index++, loop.initialization);
         if (header instanceof Block) {
-            siblings.remove(this);
             siblings.addAll(index, header.getChildren());
         } else {
-            siblings.set(index, header);
+            siblings.add(index, header);
         }
-        siblings.add(index + header.getChildren().size(), loop.initialization);
         return true;
     }
 }
< prev index next >