# HG changeset patch # User Josef Eisl # Date 1422707389 -3600 # Node ID fb4344ad6cd202e32eac3681dd0b38b33f0a91c2 # Parent d6b4eaeff50b6fe0a736927d35b9487841e0b26d LSStackSlotAllocator: make unhandled, active and sortedBlocks final. diff -r d6b4eaeff50b -r fb4344ad6cd2 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Sat Jan 31 13:23:40 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Sat Jan 31 13:29:49 2015 +0100 @@ -66,15 +66,21 @@ private final LIR lir; private final FrameMapBuilderTool frameMapBuilder; private final StackInterval[] stackSlotMap; - private PriorityQueue unhandled; - private PriorityQueue active; + private final PriorityQueue unhandled; + private final PriorityQueue active; - private List> sortedBlocks; + private final List> sortedBlocks; private Allocator(LIR lir, FrameMapBuilderTool frameMapBuilder) { this.lir = lir; this.frameMapBuilder = frameMapBuilder; this.stackSlotMap = new StackInterval[frameMapBuilder.getNumberOfStackSlots()]; + this.sortedBlocks = lir.getControlFlowGraph().getBlocks(); + + // insert by from + this.unhandled = new PriorityQueue<>((a, b) -> a.from() - b.from()); + // insert by to + this.active = new PriorityQueue<>((a, b) -> a.to() - b.to()); } private void allocate() { @@ -82,7 +88,6 @@ List> blocks = lir.getControlFlowGraph().getBlocks(); assert blocks.size() > 0; - sortedBlocks = lir.getControlFlowGraph().getBlocks(); numberInstructions(lir, sortedBlocks); Debug.dump(lir, "After StackSlot numbering"); @@ -136,11 +141,6 @@ } private void createUnhandled() { - Comparator insertByFrom = (a, b) -> a.from() - b.from(); - Comparator insertByTo = (a, b) -> a.to() - b.to(); - - unhandled = new PriorityQueue<>(insertByFrom); - active = new PriorityQueue<>(insertByTo); // add all intervals to unhandled list forEachInterval(unhandled::add);