< prev index next >
test/testlibrary/jittester/src/jdk/test/lib/jittester/If.java
Print this page
*** 28,51 ****
public class If extends IRNode {
public enum IfPart {
CONDITION,
THEN,
ELSE,
! };
! public If(IRNode condition, IRNode thenBlock, IRNode elseBlock, int level) {
this.level = level;
resizeUpChildren(IfPart.values().length);
setChild(IfPart.CONDITION.ordinal(), condition);
setChild(IfPart.THEN.ordinal(), thenBlock);
setChild(IfPart.ELSE.ordinal(), elseBlock);
}
@Override
public long complexity() {
IRNode condition = getChild(IfPart.CONDITION.ordinal());
! IRNode thenBlock= getChild(IfPart.THEN.ordinal());
IRNode elseBlock = getChild(IfPart.ELSE.ordinal());
return (condition != null ? condition.complexity() : 0)
+ Math.max(thenBlock != null ? thenBlock.complexity() : 0,
elseBlock != null ? elseBlock.complexity() : 0);
--- 28,52 ----
public class If extends IRNode {
public enum IfPart {
CONDITION,
THEN,
ELSE,
! }
! public If(IRNode condition, Block thenBlock, Block elseBlock, int level) {
! super(thenBlock.getResultType());
this.level = level;
resizeUpChildren(IfPart.values().length);
setChild(IfPart.CONDITION.ordinal(), condition);
setChild(IfPart.THEN.ordinal(), thenBlock);
setChild(IfPart.ELSE.ordinal(), elseBlock);
}
@Override
public long complexity() {
IRNode condition = getChild(IfPart.CONDITION.ordinal());
! IRNode thenBlock = getChild(IfPart.THEN.ordinal());
IRNode elseBlock = getChild(IfPart.ELSE.ordinal());
return (condition != null ? condition.complexity() : 0)
+ Math.max(thenBlock != null ? thenBlock.complexity() : 0,
elseBlock != null ? elseBlock.complexity() : 0);
< prev index next >