< prev index next >
test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/ClassDefinitionBlockFactory.java
Print this page
*** 102,111 ****
--- 102,116 ----
addMoreChildren(childs, content, minDepth);
}
private void addMoreChildren(List<IRNode> childs, Collection<IRNode> content, int minDepth)
throws ProductionFailedException {
+ /* check situation when no stackable leaves available in all childs */
+ if (childs.stream().filter(c -> c.getStackableLeaves().size() > 0).count() == 0) {
+ return;
+ }
+ /* not let's try to add children */
while (!childs.isEmpty() && IRNode.countDepth(content) < minDepth) {
PseudoRandom.shuffle(childs);
IRNode randomChild = childs.get(0);
List<IRNode> leaves = randomChild.getStackableLeaves();
if (!leaves.isEmpty()) {
*** 129,148 ****
}
}
private void ensureMaxDepth(Collection<IRNode> content) {
int maxDepth = ProductionParams.maxCfgDepth.value();
! List<IRNode> childs = content.stream()
.filter(c -> c instanceof Klass && c.countDepth() > maxDepth)
.collect(Collectors.toList());
! for (IRNode ch : childs) {
! List<IRNode> leaves;
! do {
! long depth = Math.max(ch.countDepth(), maxDepth + 1);
! leaves = ch.getDeviantBlocks(depth);
! if(leaves.size() > 0) {
! leaves.get(0).removeSelf();
}
- } while (!leaves.isEmpty() && ch.countDepth() > maxDepth);
}
}
}
--- 134,152 ----
}
}
private void ensureMaxDepth(Collection<IRNode> content) {
int maxDepth = ProductionParams.maxCfgDepth.value();
! List<IRNode> childClasses = content.stream()
.filter(c -> c instanceof Klass && c.countDepth() > maxDepth)
.collect(Collectors.toList());
! /* Now attempt to reduce depth by removing optional parts of control deviation
! blocks in case IRTree has oversized depth */
! for (IRNode child : childClasses) {
! for (IRNode leaf : child.getDeviantBlocks(Math.max(child.countDepth(), maxDepth + 1))) {
! if (child.countDepth() > maxDepth) {
! leaf.removeSelf(); // Doesn't remove control deviation block. Just some parts.
! }
}
}
}
}
< prev index next >