< prev index next >

test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/MainKlassFactory.java

Print this page

        

*** 115,131 **** private void ensureMaxDepth(List<IRNode> childs) { int maxDepth = ProductionParams.maxCfgDepth.value(); List<IRNode> filtered = childs.stream() .filter(c -> c.isCFDeviation() && c.countDepth() > maxDepth) .collect(Collectors.toList()); for (IRNode child : filtered) { ! List<IRNode> leaves; ! do { ! long depth = Math.max(child.countDepth(), maxDepth + 1); ! leaves = child.getDeviantBlocks(depth); ! leaves.get(0).removeSelf(); ! } while (!leaves.isEmpty() && child.countDepth() > maxDepth); } } private void ensureMinDepth(List<IRNode> childs, IRNodeBuilder builder) throws ProductionFailedException { --- 115,132 ---- private void ensureMaxDepth(List<IRNode> childs) { int maxDepth = ProductionParams.maxCfgDepth.value(); List<IRNode> filtered = childs.stream() .filter(c -> c.isCFDeviation() && 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 : filtered) { ! 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. ! } ! } } } private void ensureMinDepth(List<IRNode> childs, IRNodeBuilder builder) throws ProductionFailedException {
*** 134,143 **** --- 135,149 ---- addMoreChildren(filtered, minDepth, builder); } private void addMoreChildren(List<IRNode> childs, int minDepth, IRNodeBuilder builder) throws ProductionFailedException { + /* check when no stackable leaves available in all childs and skip addition for this case */ + if (childs.stream().filter(c -> c.getStackableLeaves().size() > 0).count() == 0) { + return; + } + /* now let's try to add children */ while (!childs.isEmpty() && IRNode.countDepth(childs) < minDepth) { IRNode randomChild = childs.get(PseudoRandom.randomNotNegative(childs.size())); List<IRNode> leaves = randomChild.getStackableLeaves(); if (!leaves.isEmpty()) { Block randomLeaf = (Block) leaves.get(PseudoRandom.randomNotNegative(leaves.size()));
< prev index next >