changeset 3643:ce5841053fc9

Make CFG filter work better in cooperation with Begin-End reduction
author Gilles Duboscq <gilles.m.duboscq@gmail.com>
date Wed, 16 Nov 2011 15:13:29 +0100
parents d7e8627a1016
children 441d68905702
files src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java	Wed Nov 16 13:30:33 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java	Wed Nov 16 15:13:29 2011 +0100
@@ -41,28 +41,34 @@
     }
 
     public void apply(Diagram d) {
-        List<Figure> figures = d.getFigures();
         Set<Figure> figuresToRemove = new HashSet<Figure>();
         Set<Connection> connectionsToRemove = new HashSet<Connection>();
-        for (Figure f : figures) {
-            Properties p = f.getProperties();
-            final String prop = p.get("probability");
+        for (Figure f : d.getFigures()) {
+            final String prop = f.getProperties().get("probability");
             
             if (prop == null) {
                 figuresToRemove.add(f);
             }
-            
+        }
+        d.removeAllFigures(figuresToRemove);
+        
+        for (Figure f : d.getFigures()) {
+            Properties p = f.getProperties();
             int predCount = Integer.parseInt(p.get("predecessorCount"));
             for (InputSlot is : f.getInputSlots()) {
-                Color color;
-                if (is.getPosition() >= predCount) {
-                    connectionsToRemove.addAll(is.getConnections());
+                if (is.getPosition() >= predCount && !"EndNode".equals(is.getProperties().get("class"))) {
+                    for (Connection c : is.getConnections()) {
+                        if (!"EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))) {
+                            connectionsToRemove.add(c);
+                        }
+                    }
                 }
             }
         }
-        d.removeAllFigures(figuresToRemove);
+        
         for (Connection c : connectionsToRemove) {
             c.remove();
+            System.out.println("rm " + c);
         }
     }
 }