Mercurial > hg > truffle
changeset 19837:80d48cc80222
Small data structure optimizations in SchedulePhase.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 13 Mar 2015 22:59:50 +0100 |
parents | 6c1b2ae65d6c |
children | a9fbe23a602b c2124d859d91 |
files | graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Fri Mar 13 22:55:14 2015 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Fri Mar 13 22:59:50 2015 +0100 @@ -278,7 +278,8 @@ private static void sortNodesLatestWithinBlock(Block b, BlockMap<List<Node>> earliestBlockToNodesMap, BlockMap<List<Node>> latestBlockToNodesMap, NodeMap<Block> nodeMap, BlockMap<ArrayList<FloatingReadNode>> watchListMap, NodeBitMap unprocessed) { - ArrayList<Node> result = new ArrayList<>(); + List<Node> earliestSorting = earliestBlockToNodesMap.get(b); + ArrayList<Node> result = new ArrayList<>(earliestSorting.size()); ArrayList<FloatingReadNode> watchList = null; if (watchListMap != null) { watchList = watchListMap.get(b); @@ -296,7 +297,7 @@ } } FixedNode endNode = b.getEndNode(); - for (Node n : earliestBlockToNodesMap.get(b)) { + for (Node n : earliestSorting) { if (n != endNode) { if (n instanceof FixedNode) { assert nodeMap.get(n) == b; @@ -448,7 +449,7 @@ private static void scheduleEarliestIterative(ControlFlowGraph cfg, BlockMap<List<Node>> blockToNodes, NodeMap<Block> nodeToBlock, NodeBitMap visited, StructuredGraph graph) { - BlockMap<Boolean> floatingReads = new BlockMap<>(cfg); + BitSet floatingReads = new BitSet(cfg.getBlocks().size()); // Add begin nodes as the first entry and set the block for phi nodes. for (Block b : cfg.getBlocks()) { @@ -529,9 +530,11 @@ } } - for (Block b : cfg.getBlocks()) { - if (floatingReads.get(b) == Boolean.TRUE) { - resortEarliestWithinBlock(b, blockToNodes, nodeToBlock, visited); + if (!floatingReads.isEmpty()) { + for (Block b : cfg.getBlocks()) { + if (floatingReads.get(b.getId())) { + resortEarliestWithinBlock(b, blockToNodes, nodeToBlock, visited); + } } } } @@ -602,7 +605,7 @@ blockToNodes.get(b).add(endNode); } - private static void processStack(ControlFlowGraph cfg, BlockMap<List<Node>> blockToNodes, NodeMap<Block> nodeToBlock, NodeBitMap visited, BlockMap<Boolean> floatingReads, NodeStack stack) { + private static void processStack(ControlFlowGraph cfg, BlockMap<List<Node>> blockToNodes, NodeMap<Block> nodeToBlock, NodeBitMap visited, BitSet floatingReads, NodeStack stack) { Block startBlock = cfg.getStartBlock(); while (!stack.isEmpty()) { Node current = stack.peek(); @@ -665,7 +668,7 @@ if (current instanceof FloatingReadNode) { FloatingReadNode floatingReadNode = (FloatingReadNode) current; if (curBlock.canKill(floatingReadNode.getLocationIdentity())) { - floatingReads.put(curBlock, Boolean.TRUE); + floatingReads.set(curBlock.getId()); } } }