changeset 4331:daaee28c65c6

Adding a few utility methods to Loop
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 26 Jan 2012 18:32:02 +0100
parents d13bfce7b3dd
children 9dbcdd6f1464
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java mx/sanitycheck.py
diffstat 3 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java	Thu Jan 26 12:23:00 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java	Thu Jan 26 18:32:02 2012 +0100
@@ -134,4 +134,27 @@
         }
         return loopVariant;
     }
+
+    public int depth() {
+        if (parent() == null) {
+            return 0;
+        }
+        return parent().depth() + 1;
+    }
+
+    public int directFixedNodesCount() {
+        return directCFGNodes.cardinality();
+    }
+
+    public int fixedNodesCount() {
+        int count = directFixedNodesCount();
+        for (Loop child : children()) {
+            count += child.directFixedNodesCount();
+        }
+        return count;
+    }
+
+    public int exitsCount() {
+        return exits().cardinality();
+    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Thu Jan 26 12:23:00 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Thu Jan 26 18:32:02 2012 +0100
@@ -36,7 +36,7 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        if (graph.getNodes(UnboxNode.class).iterator().hasNext()) {
+        if (graph.getNodes(UnboxNode.class).isNotEmpty()) {
 
             Map<PhiNode, PhiNode> phiReplacements = new HashMap<>();
             for (UnboxNode unboxNode : graph.getNodes(UnboxNode.class)) {
--- a/mx/sanitycheck.py	Thu Jan 26 12:23:00 2012 +0100
+++ b/mx/sanitycheck.py	Thu Jan 26 18:32:02 2012 +0100
@@ -27,7 +27,6 @@
 import re
 import mx
 import os
-import commands
 from os.path import isfile, join, exists
 
 dacapoSanityWarmup = {