< prev index next >
test/testlibrary/jittester/src/jdk/test/lib/jittester/loops/For.java
Print this page
@@ -24,10 +24,11 @@
package jdk.test.lib.jittester.loops;
import java.util.List;
import jdk.test.lib.jittester.Block;
import jdk.test.lib.jittester.IRNode;
+import jdk.test.lib.jittester.Statement;
import jdk.test.lib.jittester.visitors.Visitor;
public class For extends IRNode {
@Override
@@ -43,11 +44,11 @@
STATEMENT1,
STATEMENT2,
BODY1,
BODY2,
BODY3,
- };
+ }
private final Loop loop;
// header; // [subblock]
// statement1, statement2; // for (statement; condition; statement) {
// body1; // [subblock with breaks]
@@ -55,12 +56,13 @@
// body2; // [subblock with breaks and continues]
// body3; // [subblock with breaks]
// }
private long thisLoopIterLimit = 0;
public For(int level, Loop loop, long thisLoopIterLimit,
- IRNode header, IRNode statement1,
- IRNode statement2, IRNode body1, IRNode body2, IRNode body3) {
+ Block header, Statement statement1,
+ Statement statement2, Block body1, Block body2, Block body3) {
+ super(body1.getResultType());
this.level = level;
this.loop = loop;
this.thisLoopIterLimit = thisLoopIterLimit;
resizeUpChildren(ForPart.values().length);
getChildren().set(ForPart.HEADER.ordinal(), header);
@@ -98,15 +100,14 @@
@Override
public boolean removeSelf() {
IRNode header = getChildren().get(ForPart.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 >