changeset 7498:600f7bad141c

Small clean up of the Block class.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 17 Jan 2013 17:49:00 +0100
parents 0f8c6dbf68be
children ca3e5df0e6cf
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java
diffstat 4 files changed, 3 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Jan 17 17:21:16 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Jan 17 17:49:00 2013 +0100
@@ -807,9 +807,8 @@
                     // block has successors
                     if (n > 0) {
                         liveOut.clear();
-                        liveOut.or(blockData.get(block.getFirstSuccessor()).liveIn);
-                        for (int j = 1; j < n; j++) {
-                            liveOut.or(blockData.get(block.suxAt(j)).liveIn);
+                        for (Block successor : block.getSuccessors()) {
+                            liveOut.or(blockData.get(successor).liveIn);
                         }
                     } else {
                         liveOut.clear();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Thu Jan 17 17:21:16 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Thu Jan 17 17:49:00 2013 +0100
@@ -62,7 +62,7 @@
         assert instructions.size() >= 2 : "block must have label and branch";
         assert instructions.get(0) instanceof StandardOp.LabelOp : "first instruction must always be a label";
         assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "last instruction must always be a branch";
-        assert ((StandardOp.JumpOp) instructions.get(instructions.size() - 1)).destination().label() == ((StandardOp.LabelOp) ir.lir(block.suxAt(0)).get(0)).getLabel() : "branch target must be the successor";
+        assert ((StandardOp.JumpOp) instructions.get(instructions.size() - 1)).destination().label() == ((StandardOp.LabelOp) ir.lir(block.getFirstSuccessor()).get(0)).getLabel() : "branch target must be the successor";
 
         // Block must have exactly one successor.
         return instructions.size() == 2 && !instructions.get(instructions.size() - 1).hasState();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Thu Jan 17 17:21:16 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Thu Jan 17 17:49:00 2013 +0100
@@ -34,7 +34,6 @@
     protected BeginNode beginNode;
     protected FixedNode endNode;
     protected Loop loop;
-    protected double probability;
 
     protected List<Block> predecessors;
     protected List<Block> successors;
@@ -186,11 +185,6 @@
         return getSuccessors().size();
     }
 
-    public Block suxAt(int i) {
-        return getSuccessors().get(i);
-    }
-// end to be inlined later on
-
     public boolean dominates(Block block) {
         return block.isDominatedBy(this);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Jan 17 17:21:16 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Jan 17 17:49:00 2013 +0100
@@ -131,13 +131,6 @@
                         }
                     }
 
-                    if (cur instanceof FixedNode) {
-                        double probability = ((FixedNode) cur).probability();
-                        if (probability > block.probability) {
-                            block.probability = probability;
-                        }
-                    }
-
                     last = cur;
                     cur = cur.successors().first();
                 } while (cur != null && !(cur instanceof BeginNode));