Mercurial > hg > graal-compiler
changeset 23320:8be28ce060cc
TraceRA: do not use streams in TraceBuilder asserts.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 19 Jan 2016 10:24:05 +0100 |
parents | cde2f72cb163 |
children | ae00ceec23d7 |
files | graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/TraceBuilder.java |
diffstat | 1 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/TraceBuilder.java Tue Jan 19 10:05:58 2016 +0100 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/TraceBuilder.java Tue Jan 19 10:24:05 2016 +0100 @@ -150,7 +150,7 @@ } private boolean verify(ArrayList<List<T>> traces) { - assert traces.stream().flatMap(l -> l.stream()).distinct().count() == blocked.length : "Not all blocks assigned to traces!"; + assert verifyAllBlocksScheduled(traces, blocked.length) : "Not all blocks assigned to traces!"; for (List<T> trace : traces) { T last = null; for (T current : trace) { @@ -161,6 +161,16 @@ return true; } + private static <T extends AbstractBlockBase<T>> boolean verifyAllBlocksScheduled(ArrayList<List<T>> traces, int expectedLength) { + BitSet handled = new BitSet(expectedLength); + for (List<T> trace : traces) { + for (T block : trace) { + handled.set(block.getId()); + } + } + return handled.cardinality() == expectedLength; + } + protected ArrayList<List<T>> buildTraces(T startBlock) { ArrayList<List<T>> traces = new ArrayList<>(); // add start block @@ -181,7 +191,7 @@ */ @SuppressWarnings("try") private List<T> startTrace(T block, int traceNumber) { - assert block.getPredecessors().stream().allMatch(this::processed) : "Predecessor unscheduled: " + block.getPredecessors().stream().filter(this::processed).findFirst().get(); + assert checkPredecessorsProcessed(block); ArrayList<T> trace = new ArrayList<>(); int blockNumber = 0; try (Indent i = Debug.logAndIndent("StartTrace: " + block)) { @@ -197,6 +207,18 @@ return trace; } + private boolean checkPredecessorsProcessed(T block) { + List<T> predecessors = block.getPredecessors(); + for (T pred : predecessors) { + if (!processed(pred)) { + assert false : "Predecessor unscheduled: " + pred; + return false; + } + + } + return true; + } + /** * Decrease the {@link #blocked} count for all predecessors and add them to the worklist once * the count reaches 0.