Thu, 30 Oct 2008 17:08:48 -0700
6764622: IdealGraphVisualizer fixes
Reviewed-by: rasbold, jrose
1.1 --- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java Tue Oct 28 18:02:09 2008 -0700 1.2 +++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java Thu Oct 30 17:08:48 2008 -0700 1.3 @@ -28,6 +28,7 @@ 1.4 import com.sun.hotspot.igv.data.services.InputGraphProvider; 1.5 import java.awt.BorderLayout; 1.6 import java.io.Serializable; 1.7 +import javax.swing.SwingUtilities; 1.8 import org.openide.ErrorManager; 1.9 import org.openide.explorer.ExplorerManager; 1.10 import org.openide.explorer.ExplorerUtils; 1.11 @@ -151,14 +152,18 @@ 1.12 } 1.13 1.14 public void resultChanged(LookupEvent lookupEvent) { 1.15 - InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); 1.16 + final InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); 1.17 if (p != null) { 1.18 + SwingUtilities.invokeLater(new Runnable() { 1.19 + public void run() { 1.20 InputGraph graph = p.getGraph(); 1.21 if (graph != null) { 1.22 Group g = graph.getGroup(); 1.23 rootNode.update(graph, g.getMethod()); 1.24 } 1.25 } 1.26 + }); 1.27 + } 1.28 } 1.29 1.30 final static class ResolvableHelper implements Serializable {
2.1 --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java Tue Oct 28 18:02:09 2008 -0700 2.2 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java Thu Oct 30 17:08:48 2008 -0700 2.3 @@ -33,7 +33,7 @@ 2.4 import java.awt.Rectangle; 2.5 import java.util.ArrayList; 2.6 import java.util.HashSet; 2.7 -import java.util.Hashtable; 2.8 +import java.util.HashMap; 2.9 import java.util.Set; 2.10 import javax.swing.BorderFactory; 2.11 import org.netbeans.api.visual.action.ActionFactory; 2.12 @@ -44,7 +44,6 @@ 2.13 import org.netbeans.api.visual.action.WidgetAction; 2.14 import org.netbeans.api.visual.anchor.AnchorFactory; 2.15 import org.netbeans.api.visual.anchor.AnchorShape; 2.16 -import com.sun.hotspot.igv.controlflow.HierarchicalGraphLayout; 2.17 import org.netbeans.api.visual.layout.LayoutFactory; 2.18 import org.netbeans.api.visual.router.RouterFactory; 2.19 import org.netbeans.api.visual.widget.LayerWidget; 2.20 @@ -61,8 +60,8 @@ 2.21 */ 2.22 public class ControlFlowScene extends GraphScene<InputBlock, InputBlockEdge> implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider { 2.23 2.24 - private Set<BlockWidget> selection; 2.25 - private Hashtable<InputBlock, BlockWidget> blockMap; 2.26 + private HashSet<BlockWidget> selection; 2.27 + private HashMap<InputBlock, BlockWidget> blockMap; 2.28 private InputGraph oldGraph; 2.29 private LayerWidget edgeLayer; 2.30 private LayerWidget mainLayer;
3.1 --- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java Tue Oct 28 18:02:09 2008 -0700 3.2 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java Thu Oct 30 17:08:48 2008 -0700 3.3 @@ -28,6 +28,7 @@ 3.4 import java.awt.BorderLayout; 3.5 import java.io.Serializable; 3.6 import javax.swing.JScrollPane; 3.7 +import javax.swing.SwingUtilities; 3.8 import org.openide.ErrorManager; 3.9 import org.openide.util.Lookup; 3.10 import org.openide.util.LookupEvent; 3.11 @@ -143,13 +144,17 @@ 3.12 3.13 public void resultChanged(LookupEvent lookupEvent) { 3.14 3.15 - InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); 3.16 + final InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); 3.17 if (p != null) { 3.18 + SwingUtilities.invokeLater(new Runnable() { 3.19 + public void run() { 3.20 InputGraph g = p.getGraph(); 3.21 if (g != null) { 3.22 scene.setGraph(g); 3.23 } 3.24 } 3.25 + }); 3.26 + } 3.27 } 3.28 3.29 @Override
4.1 --- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Tue Oct 28 18:02:09 2008 -0700 4.2 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Thu Oct 30 17:08:48 2008 -0700 4.3 @@ -24,6 +24,7 @@ 4.4 package com.sun.hotspot.igv.coordinator; 4.5 4.6 import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; 4.7 +import com.sun.hotspot.igv.data.ChangedListener; 4.8 import com.sun.hotspot.igv.data.Group; 4.9 import com.sun.hotspot.igv.data.services.GroupOrganizer; 4.10 import com.sun.hotspot.igv.data.InputGraph; 4.11 @@ -50,17 +51,24 @@ 4.12 private List<String> subFolders; 4.13 private FolderChildren children; 4.14 4.15 - private static class FolderChildren extends Children.Keys { 4.16 + private static class FolderChildren extends Children.Keys implements ChangedListener<Group> { 4.17 4.18 private FolderNode parent; 4.19 + private List<Group> registeredGroups; 4.20 4.21 public void setParent(FolderNode parent) { 4.22 this.parent = parent; 4.23 + this.registeredGroups = new ArrayList<Group>(); 4.24 } 4.25 4.26 @Override 4.27 protected Node[] createNodes(Object arg0) { 4.28 4.29 + for(Group g : registeredGroups) { 4.30 + g.getChangedEvent().removeListener(this); 4.31 + } 4.32 + registeredGroups.clear(); 4.33 + 4.34 Pair<String, List<Group>> p = (Pair<String, List<Group>>) arg0; 4.35 if (p.getLeft().length() == 0) { 4.36 4.37 @@ -69,6 +77,8 @@ 4.38 for (InputGraph graph : g.getGraphs()) { 4.39 curNodes.add(new GraphNode(graph)); 4.40 } 4.41 + g.getChangedEvent().addListener(this); 4.42 + registeredGroups.add(g); 4.43 } 4.44 4.45 Node[] result = new Node[curNodes.size()]; 4.46 @@ -85,7 +95,13 @@ 4.47 @Override 4.48 public void addNotify() { 4.49 this.setKeys(parent.structure); 4.50 + } 4.51 4.52 + public void changed(Group source) { 4.53 + List<Pair<String, List<Group>>> newStructure = new ArrayList<Pair<String, List<Group>>>(); 4.54 + for(Pair<String, List<Group>> p : parent.structure) { 4.55 + refreshKey(p); 4.56 + } 4.57 } 4.58 } 4.59
5.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java Tue Oct 28 18:02:09 2008 -0700 5.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java Thu Oct 30 17:08:48 2008 -0700 5.3 @@ -31,7 +31,7 @@ 5.4 * 5.5 * @author Thomas Wuerthinger 5.6 */ 5.7 -public class GraphDocument extends Properties.Object implements ChangedEventProvider<GraphDocument> { 5.8 +public class GraphDocument extends Properties.Entity implements ChangedEventProvider<GraphDocument> { 5.9 5.10 private List<Group> groups; 5.11 private ChangedEvent<GraphDocument> changedEvent;
6.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Tue Oct 28 18:02:09 2008 -0700 6.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Thu Oct 30 17:08:48 2008 -0700 6.3 @@ -37,7 +37,7 @@ 6.4 * 6.5 * @author Thomas Wuerthinger 6.6 */ 6.7 -public class Group extends Properties.Object implements ChangedEventProvider<Group> { 6.8 +public class Group extends Properties.Entity implements ChangedEventProvider<Group> { 6.9 6.10 private List<InputGraph> graphs; 6.11 private transient ChangedEvent<Group> changedEvent;
7.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Tue Oct 28 18:02:09 2008 -0700 7.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Thu Oct 30 17:08:48 2008 -0700 7.3 @@ -23,26 +23,25 @@ 7.4 */ 7.5 package com.sun.hotspot.igv.data; 7.6 7.7 -import com.sun.hotspot.igv.data.Properties; 7.8 +import java.util.ArrayList; 7.9 import java.util.Collection; 7.10 import java.util.Collections; 7.11 import java.util.HashSet; 7.12 -import java.util.Hashtable; 7.13 +import java.util.HashMap; 7.14 import java.util.List; 7.15 -import java.util.Map; 7.16 import java.util.Set; 7.17 7.18 /** 7.19 * 7.20 * @author Thomas Wuerthinger 7.21 */ 7.22 -public class InputGraph extends Properties.Object { 7.23 +public class InputGraph extends Properties.Entity { 7.24 7.25 - private Map<Integer, InputNode> nodes; 7.26 - private Set<InputEdge> edges; 7.27 + private HashMap<Integer, InputNode> nodes; 7.28 + private ArrayList<InputEdge> edges; 7.29 private Group parent; 7.30 - private Map<String, InputBlock> blocks; 7.31 - private Map<Integer, InputBlock> nodeToBlock; 7.32 + private HashMap<String, InputBlock> blocks; 7.33 + private HashMap<Integer, InputBlock> nodeToBlock; 7.34 private boolean isDifferenceGraph; 7.35 7.36 public InputGraph(Group parent) { 7.37 @@ -61,10 +60,10 @@ 7.38 public InputGraph(Group parent, InputGraph last, String name) { 7.39 this.parent = parent; 7.40 setName(name); 7.41 - nodes = new Hashtable<Integer, InputNode>(); 7.42 - edges = new HashSet<InputEdge>(); 7.43 - blocks = new Hashtable<String, InputBlock>(); 7.44 - nodeToBlock = new Hashtable<Integer, InputBlock>(); 7.45 + nodes = new HashMap<Integer, InputNode>(); 7.46 + edges = new ArrayList<InputEdge>(); 7.47 + blocks = new HashMap<String, InputBlock>(); 7.48 + nodeToBlock = new HashMap<Integer, InputBlock>(); 7.49 if (last != null) { 7.50 7.51 for (InputNode n : last.getNodes()) { 7.52 @@ -182,8 +181,8 @@ 7.53 return nodes.remove(index); 7.54 } 7.55 7.56 - public Set<InputEdge> getEdges() { 7.57 - return Collections.unmodifiableSet(edges); 7.58 + public Collection<InputEdge> getEdges() { 7.59 + return Collections.unmodifiableList(edges); 7.60 } 7.61 7.62 public void removeEdge(InputEdge c) {
8.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java Tue Oct 28 18:02:09 2008 -0700 8.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java Thu Oct 30 17:08:48 2008 -0700 8.3 @@ -32,7 +32,7 @@ 8.4 * 8.5 * @author Thomas Wuerthinger 8.6 */ 8.7 -public class InputMethod extends Properties.Object { 8.8 +public class InputMethod extends Properties.Entity { 8.9 8.10 private String name; 8.11 private int bci;
9.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java Tue Oct 28 18:02:09 2008 -0700 9.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java Thu Oct 30 17:08:48 2008 -0700 9.3 @@ -27,7 +27,7 @@ 9.4 * 9.5 * @author Thomas Wuerthinger 9.6 */ 9.7 -public class InputNode extends Properties.Object { 9.8 +public class InputNode extends Properties.Entity { 9.9 9.10 private int id; 9.11
10.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java Tue Oct 28 18:02:09 2008 -0700 10.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java Thu Oct 30 17:08:48 2008 -0700 10.3 @@ -26,24 +26,22 @@ 10.4 import java.io.Serializable; 10.5 import java.util.ArrayList; 10.6 import java.util.Collection; 10.7 -import java.util.Collections; 10.8 -import java.util.HashMap; 10.9 +import java.util.Iterator; 10.10 import java.util.List; 10.11 -import java.util.Map; 10.12 import java.util.regex.Matcher; 10.13 import java.util.regex.Pattern; 10.14 10.15 + 10.16 /** 10.17 * 10.18 * @author Thomas Wuerthinger 10.19 */ 10.20 -public class Properties implements Serializable { 10.21 +public class Properties implements Serializable, Iterable<Property> { 10.22 10.23 public static final long serialVersionUID = 1L; 10.24 - private Map<String, Property> map; 10.25 + private String[] map = new String[4]; 10.26 10.27 public Properties() { 10.28 - map = new HashMap<String, Property>(5); 10.29 } 10.30 10.31 @Override 10.32 @@ -54,10 +52,7 @@ 10.33 10.34 Properties p = (Properties) o; 10.35 10.36 - if (getProperties().size() != p.getProperties().size()) { 10.37 - return false; 10.38 - } 10.39 - for (Property prop : getProperties()) { 10.40 + for (Property prop : this) { 10.41 String value = p.get(prop.getName()); 10.42 if (value == null || !value.equals(prop.getValue())) { 10.43 return false; 10.44 @@ -75,32 +70,33 @@ 10.45 10.46 public Properties(String name, String value) { 10.47 this(); 10.48 - this.add(new Property(name, value)); 10.49 + this.setProperty(name, value); 10.50 } 10.51 10.52 public Properties(String name, String value, String name1, String value1) { 10.53 this(name, value); 10.54 - this.add(new Property(name1, value1)); 10.55 + this.setProperty(name1, value1); 10.56 } 10.57 10.58 public Properties(String name, String value, String name1, String value1, String name2, String value2) { 10.59 this(name, value, name1, value1); 10.60 - this.add(new Property(name2, value2)); 10.61 + this.setProperty(name2, value2); 10.62 } 10.63 10.64 public Properties(Properties p) { 10.65 - map = new HashMap<String, Property>(p.map); 10.66 + map = new String[p.map.length]; 10.67 + System.arraycopy(map, 0, p.map, 0, p.map.length); 10.68 } 10.69 10.70 - public static class Object implements Provider { 10.71 + public static class Entity implements Provider { 10.72 10.73 private Properties properties; 10.74 10.75 - public Object() { 10.76 + public Entity() { 10.77 properties = new Properties(); 10.78 } 10.79 10.80 - public Object(Properties.Object object) { 10.81 + public Entity(Properties.Entity object) { 10.82 properties = new Properties(object.getProperties()); 10.83 } 10.84 10.85 @@ -109,6 +105,14 @@ 10.86 } 10.87 } 10.88 10.89 + private String getProperty(String key) { 10.90 + for (int i = 0; i < map.length; i += 2) 10.91 + if (map[i] != null && map[i].equals(key)) { 10.92 + return map[i + 1]; 10.93 + } 10.94 + return null; 10.95 + } 10.96 + 10.97 public interface PropertyMatcher { 10.98 10.99 String getName(); 10.100 @@ -173,13 +177,15 @@ 10.101 } 10.102 10.103 public Property selectSingle(PropertyMatcher matcher) { 10.104 - 10.105 - Property p = this.map.get(matcher.getName()); 10.106 - if (p == null) { 10.107 - return null; 10.108 + String value = null; 10.109 + for (int i = 0; i < map.length; i += 2) { 10.110 + if (map[i] != null && matcher.getName().equals(map[i])) { 10.111 + value = map[i + 1]; 10.112 + break; 10.113 + } 10.114 } 10.115 - if (matcher.match(p.getValue())) { 10.116 - return p; 10.117 + if (value != null && matcher.match(value)) { 10.118 + return new Property(matcher.getName(), value); 10.119 } else { 10.120 return null; 10.121 } 10.122 @@ -194,8 +200,11 @@ 10.123 public String toString() { 10.124 StringBuilder sb = new StringBuilder(); 10.125 sb.append("["); 10.126 - for (Property p : map.values()) { 10.127 - sb.append(p.toString()); 10.128 + for (int i = 0; i < map.length; i += 2) { 10.129 + if (map[i + 1] != null) { 10.130 + String p = map[i + 1]; 10.131 + sb.append(map[i] + " = " + map[i + 1] + "; "); 10.132 + } 10.133 } 10.134 return sb.append("]").toString(); 10.135 } 10.136 @@ -241,41 +250,51 @@ 10.137 } 10.138 10.139 public String get(String key) { 10.140 - Property p = map.get(key); 10.141 - if (p == null) { 10.142 - return null; 10.143 - } else { 10.144 - return p.getValue(); 10.145 + for (int i = 0; i < map.length; i += 2) { 10.146 + if (map[i] != null && map[i].equals(key)) { 10.147 + return map[i + 1]; 10.148 + } 10.149 } 10.150 + return null; 10.151 } 10.152 10.153 - public String getProperty(String string) { 10.154 - return get(string); 10.155 + public void setProperty(String name, String value) { 10.156 + for (int i = 0; i < map.length; i += 2) { 10.157 + if (map[i] != null && map[i].equals(name)) { 10.158 + String p = map[i + 1]; 10.159 + if (value == null) { 10.160 + // remove this property 10.161 + map[i] = null; 10.162 + map[i + 1] = null; 10.163 + } else { 10.164 + map[i + 1] = value; 10.165 + } 10.166 + return; 10.167 + } 10.168 + } 10.169 + if (value == null) { 10.170 + return; 10.171 + } 10.172 + for (int i = 0; i < map.length; i += 2) { 10.173 + if (map[i] == null) { 10.174 + map[i] = name; 10.175 + map[i + 1] = value; 10.176 + return; 10.177 + } 10.178 + } 10.179 + String[] newMap = new String[map.length + 4]; 10.180 + System.arraycopy(map, 0, newMap, 0, map.length); 10.181 + newMap[map.length] = name; 10.182 + newMap[map.length + 1] = value; 10.183 + map = newMap; 10.184 } 10.185 10.186 - public Property setProperty(String name, String value) { 10.187 - 10.188 - if (value == null) { 10.189 - // remove this property 10.190 - return map.remove(name); 10.191 - } else { 10.192 - Property p = map.get(name); 10.193 - if (p == null) { 10.194 - p = new Property(name, value); 10.195 - map.put(name, p); 10.196 - } else { 10.197 - p.setValue(value); 10.198 - } 10.199 - return p; 10.200 - } 10.201 - } 10.202 - 10.203 - public Collection<Property> getProperties() { 10.204 - return Collections.unmodifiableCollection(map.values()); 10.205 + public Iterator<Property> getProperties() { 10.206 + return iterator(); 10.207 } 10.208 10.209 public void add(Properties properties) { 10.210 - for (Property p : properties.getProperties()) { 10.211 + for (Property p : properties) { 10.212 add(p); 10.213 } 10.214 } 10.215 @@ -283,6 +302,35 @@ 10.216 public void add(Property property) { 10.217 assert property.getName() != null; 10.218 assert property.getValue() != null; 10.219 - map.put(property.getName(), property); 10.220 + setProperty(property.getName(), property.getValue()); 10.221 + } 10.222 + class PropertiesIterator implements Iterator<Property>, Iterable<Property> { 10.223 + public Iterator<Property> iterator() { 10.224 + return this; 10.225 + } 10.226 + 10.227 + int index; 10.228 + 10.229 + public boolean hasNext() { 10.230 + while (index < map.length && map[index + 1] == null) 10.231 + index += 2; 10.232 + return index < map.length; 10.233 + } 10.234 + 10.235 + public Property next() { 10.236 + if (index < map.length) { 10.237 + index += 2; 10.238 + return new Property(map[index - 2], map[index - 1]); 10.239 + } 10.240 + return null; 10.241 + } 10.242 + 10.243 + public void remove() { 10.244 + throw new UnsupportedOperationException("Not supported yet."); 10.245 + } 10.246 + 10.247 + } 10.248 + public Iterator<Property> iterator() { 10.249 + return new PropertiesIterator(); 10.250 } 10.251 }
11.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java Tue Oct 28 18:02:09 2008 -0700 11.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java Thu Oct 30 17:08:48 2008 -0700 11.3 @@ -32,18 +32,19 @@ 11.4 public class Property implements Serializable { 11.5 11.6 public static final long serialVersionUID = 1L; 11.7 + 11.8 private String name; 11.9 private String value; 11.10 11.11 - public Property() { 11.12 + private Property() { 11.13 this(null, null); 11.14 } 11.15 11.16 - public Property(Property p) { 11.17 + private Property(Property p) { 11.18 this(p.getName(), p.getValue()); 11.19 } 11.20 11.21 - public Property(String name) { 11.22 + private Property(String name) { 11.23 this(name, null); 11.24 } 11.25 11.26 @@ -60,16 +61,19 @@ 11.27 return value; 11.28 } 11.29 11.30 - public void setName(String s) { 11.31 - this.name = s; 11.32 - } 11.33 - 11.34 - public void setValue(String s) { 11.35 - this.value = s; 11.36 - } 11.37 - 11.38 @Override 11.39 public String toString() { 11.40 return name + " = " + value + "; "; 11.41 } 11.42 + 11.43 + @Override 11.44 + public boolean equals(Object o) { 11.45 + if (!(o instanceof Property)) return false; 11.46 + Property p2 = (Property)o; 11.47 + return name.equals(p2.name) && value.equals(p2.value); 11.48 + } 11.49 + @Override 11.50 + public int hashCode() { 11.51 + return name.hashCode() + value == null ? 0 : value.hashCode(); 11.52 + } 11.53 }
12.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Tue Oct 28 18:02:09 2008 -0700 12.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Thu Oct 30 17:08:48 2008 -0700 12.3 @@ -38,6 +38,7 @@ 12.4 import com.sun.hotspot.igv.data.serialization.XMLParser.ParseMonitor; 12.5 import com.sun.hotspot.igv.data.serialization.XMLParser.TopElementHandler; 12.6 import java.io.IOException; 12.7 +import java.util.HashMap; 12.8 import org.xml.sax.InputSource; 12.9 import org.xml.sax.SAXException; 12.10 import org.xml.sax.XMLReader; 12.11 @@ -88,6 +89,18 @@ 12.12 private TopElementHandler xmlDocument = new TopElementHandler(); 12.13 private boolean difference; 12.14 private GroupCallback groupCallback; 12.15 + private HashMap<String, Integer> idCache = new HashMap<String, Integer>(); 12.16 + private int maxId = 0; 12.17 + 12.18 + private int lookupID(String i) { 12.19 + Integer id = idCache.get(i); 12.20 + if (id == null) { 12.21 + id = maxId++; 12.22 + idCache.put(i, id); 12.23 + } 12.24 + return id.intValue(); 12.25 + } 12.26 + 12.27 // <graphDocument> 12.28 private ElementHandler<GraphDocument, Object> topHandler = new ElementHandler<GraphDocument, Object>(TOP_ELEMENT) { 12.29 12.30 @@ -187,13 +200,13 @@ 12.31 previous = null; 12.32 } 12.33 InputGraph curGraph = new InputGraph(getParentObject(), previous, name); 12.34 - getParentObject().addGraph(curGraph); 12.35 this.graph = curGraph; 12.36 return curGraph; 12.37 } 12.38 12.39 @Override 12.40 protected void end(String text) throws SAXException { 12.41 + getParentObject().addGraph(graph); 12.42 graph.resolveBlockLinks(); 12.43 } 12.44 }; 12.45 @@ -207,7 +220,7 @@ 12.46 @Override 12.47 protected InputBlock start() throws SAXException { 12.48 InputGraph graph = getParentObject(); 12.49 - String name = readRequiredAttribute(BLOCK_NAME_PROPERTY); 12.50 + String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern(); 12.51 InputBlock b = new InputBlock(getParentObject(), name); 12.52 graph.addBlock(b); 12.53 return b; 12.54 @@ -224,7 +237,7 @@ 12.55 12.56 int id = 0; 12.57 try { 12.58 - id = Integer.parseInt(s); 12.59 + id = lookupID(s); 12.60 } catch (NumberFormatException e) { 12.61 throw new SAXException(e); 12.62 } 12.63 @@ -252,7 +265,7 @@ 12.64 String s = readRequiredAttribute(NODE_ID_PROPERTY); 12.65 int id = 0; 12.66 try { 12.67 - id = Integer.parseInt(s); 12.68 + id = lookupID(s); 12.69 } catch (NumberFormatException e) { 12.70 throw new SAXException(e); 12.71 } 12.72 @@ -269,7 +282,7 @@ 12.73 String s = readRequiredAttribute(NODE_ID_PROPERTY); 12.74 int id = 0; 12.75 try { 12.76 - id = Integer.parseInt(s); 12.77 + id = lookupID(s); 12.78 } catch (NumberFormatException e) { 12.79 throw new SAXException(e); 12.80 } 12.81 @@ -280,7 +293,7 @@ 12.82 private HandoverElementHandler<InputGraph> edgesHandler = new HandoverElementHandler<InputGraph>(EDGES_ELEMENT); 12.83 12.84 // Local class for edge elements 12.85 - private static class EdgeElementHandler extends ElementHandler<InputEdge, InputGraph> { 12.86 + private class EdgeElementHandler extends ElementHandler<InputEdge, InputGraph> { 12.87 12.88 public EdgeElementHandler(String name) { 12.89 super(name); 12.90 @@ -298,8 +311,8 @@ 12.91 toIndex = Integer.parseInt(toIndexString); 12.92 } 12.93 12.94 - from = Integer.parseInt(readRequiredAttribute(FROM_PROPERTY)); 12.95 - to = Integer.parseInt(readRequiredAttribute(TO_PROPERTY)); 12.96 + from = lookupID(readRequiredAttribute(FROM_PROPERTY)); 12.97 + to = lookupID(readRequiredAttribute(TO_PROPERTY)); 12.98 } catch (NumberFormatException e) { 12.99 throw new SAXException(e); 12.100 } 12.101 @@ -344,18 +357,16 @@ 12.102 } 12.103 }; 12.104 // <property> 12.105 - private ElementHandler<Property, Properties.Provider> propertyHandler = new XMLParser.ElementHandler<Property, Properties.Provider>(PROPERTY_ELEMENT, true) { 12.106 + private ElementHandler<String, Properties.Provider> propertyHandler = new XMLParser.ElementHandler<String, Properties.Provider>(PROPERTY_ELEMENT, true) { 12.107 12.108 @Override 12.109 - public Property start() throws SAXException { 12.110 - String value = ""; 12.111 - String name = readRequiredAttribute(PROPERTY_NAME_PROPERTY).intern(); 12.112 - return getParentObject().getProperties().setProperty(name, value); 12.113 + public String start() throws SAXException { 12.114 + return readRequiredAttribute(PROPERTY_NAME_PROPERTY).intern(); 12.115 } 12.116 12.117 @Override 12.118 public void end(String text) { 12.119 - getObject().setValue(text.trim().intern()); 12.120 + getParentObject().getProperties().setProperty(getObject(), text.trim().intern()); 12.121 } 12.122 }; 12.123
13.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java Tue Oct 28 18:02:09 2008 -0700 13.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java Thu Oct 30 17:08:48 2008 -0700 13.3 @@ -67,7 +67,7 @@ 13.4 13.5 private void export(XMLWriter writer, Group g) throws IOException { 13.6 Properties attributes = new Properties(); 13.7 - attributes.add(new Property("difference", Boolean.toString(true))); 13.8 + attributes.setProperty("difference", Boolean.toString(true)); 13.9 writer.startTag(Parser.GROUP_ELEMENT, attributes); 13.10 writer.writeProperties(g.getProperties()); 13.11
14.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java Tue Oct 28 18:02:09 2008 -0700 14.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java Thu Oct 30 17:08:48 2008 -0700 14.3 @@ -25,7 +25,7 @@ 14.4 14.5 import com.sun.hotspot.igv.data.Property; 14.6 import com.sun.hotspot.igv.data.Properties; 14.7 -import java.util.Hashtable; 14.8 +import java.util.HashMap; 14.9 import java.util.Stack; 14.10 import org.xml.sax.Attributes; 14.11 import org.xml.sax.ContentHandler; 14.12 @@ -89,7 +89,7 @@ 14.13 private Attributes attr; 14.14 private StringBuilder currentText; 14.15 private ParseMonitor monitor; 14.16 - private Hashtable<String, ElementHandler<?, ? super T>> hashtable; 14.17 + private HashMap<String, ElementHandler<?, ? super T>> hashtable; 14.18 private boolean needsText; 14.19 private ElementHandler<P, ?> parentElement; 14.20 14.21 @@ -110,7 +110,7 @@ 14.22 } 14.23 14.24 public ElementHandler(String name, boolean needsText) { 14.25 - this.hashtable = new Hashtable<String, ElementHandler<?, ? super T>>(); 14.26 + this.hashtable = new HashMap<String, ElementHandler<?, ? super T>>(); 14.27 this.name = name; 14.28 this.needsText = needsText; 14.29 } 14.30 @@ -153,7 +153,7 @@ 14.31 for (int i = 0; i < length; i++) { 14.32 String val = attr.getValue(i).intern(); 14.33 String localName = attr.getLocalName(i).intern(); 14.34 - p.add(new Property(val, localName)); 14.35 + p.setProperty(val, localName); 14.36 } 14.37 } 14.38
15.1 --- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java Tue Oct 28 18:02:09 2008 -0700 15.2 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java Thu Oct 30 17:08:48 2008 -0700 15.3 @@ -89,7 +89,7 @@ 15.4 inner.write("<" + name); 15.5 elementStack.push(name); 15.6 15.7 - for (Property p : attributes.getProperties()) { 15.8 + for (Property p : attributes) { 15.9 inner.write(" " + p.getName() + "=\""); 15.10 write(p.getValue().toCharArray()); 15.11 inner.write("\""); 15.12 @@ -101,7 +101,7 @@ 15.13 public void simpleTag(String name, Properties attributes) throws IOException { 15.14 inner.write("<" + name); 15.15 15.16 - for (Property p : attributes.getProperties()) { 15.17 + for (Property p : attributes) { 15.18 inner.write(" " + p.getName() + "=\""); 15.19 write(p.getValue().toCharArray()); 15.20 inner.write("\""); 15.21 @@ -111,13 +111,13 @@ 15.22 } 15.23 15.24 public void writeProperties(Properties props) throws IOException { 15.25 - if (props.getProperties().size() == 0) { 15.26 + if (props.getProperties().hasNext() == false) { 15.27 return; 15.28 } 15.29 15.30 startTag(Parser.PROPERTIES_ELEMENT); 15.31 15.32 - for (Property p : props.getProperties()) { 15.33 + for (Property p : props) { 15.34 startTag(Parser.PROPERTY_ELEMENT, new Properties(Parser.PROPERTY_NAME_PROPERTY, p.getName())); 15.35 this.write(p.getValue().toCharArray()); 15.36 endTag();
16.1 --- a/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java Tue Oct 28 18:02:09 2008 -0700 16.2 +++ b/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java Thu Oct 30 17:08:48 2008 -0700 16.3 @@ -29,6 +29,7 @@ 16.4 import com.sun.hotspot.igv.data.InputGraph; 16.5 import com.sun.hotspot.igv.data.InputNode; 16.6 import com.sun.hotspot.igv.data.Property; 16.7 +import java.util.Collection; 16.8 import java.util.HashMap; 16.9 import java.util.HashSet; 16.10 import java.util.Map; 16.11 @@ -124,8 +125,8 @@ 16.12 inputNodeMap.put(n, n2); 16.13 } 16.14 16.15 - Set<InputEdge> edgesA = a.getEdges(); 16.16 - Set<InputEdge> edgesB = b.getEdges(); 16.17 + Collection<InputEdge> edgesA = a.getEdges(); 16.18 + Collection<InputEdge> edgesB = b.getEdges(); 16.19 16.20 Set<InputEdge> newEdges = new HashSet<InputEdge>(); 16.21 16.22 @@ -182,7 +183,7 @@ 16.23 public double getValue() { 16.24 16.25 double result = 0.0; 16.26 - for (Property p : n1.getProperties().getProperties()) { 16.27 + for (Property p : n1.getProperties()) { 16.28 double faktor = 1.0; 16.29 for (String forbidden : IGNORE_PROPERTIES) { 16.30 if (p.getName().equals(forbidden)) { 16.31 @@ -287,34 +288,34 @@ 16.32 private static void markAsChanged(InputNode n, InputNode firstNode, InputNode otherNode) { 16.33 16.34 boolean difference = false; 16.35 - for (Property p : otherNode.getProperties().getProperties()) { 16.36 - String s = firstNode.getProperties().getProperty(p.getName()); 16.37 + for (Property p : otherNode.getProperties()) { 16.38 + String s = firstNode.getProperties().get(p.getName()); 16.39 if (!p.getValue().equals(s)) { 16.40 difference = true; 16.41 - n.getProperties().add(new Property(OLD_PREFIX + p.getName(), p.getValue())); 16.42 + n.getProperties().setProperty(OLD_PREFIX + p.getName(), p.getValue()); 16.43 } 16.44 } 16.45 16.46 - for (Property p : firstNode.getProperties().getProperties()) { 16.47 - String s = otherNode.getProperties().getProperty(p.getName()); 16.48 + for (Property p : firstNode.getProperties()) { 16.49 + String s = otherNode.getProperties().get(p.getName()); 16.50 if (s == null && p.getValue().length() > 0) { 16.51 difference = true; 16.52 - n.getProperties().add(new Property(OLD_PREFIX + p.getName(), "")); 16.53 + n.getProperties().setProperty(OLD_PREFIX + p.getName(), ""); 16.54 } 16.55 } 16.56 16.57 if (difference) { 16.58 - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_CHANGED)); 16.59 + n.getProperties().setProperty(PROPERTY_STATE, VALUE_CHANGED); 16.60 } else { 16.61 - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_SAME)); 16.62 + n.getProperties().setProperty(PROPERTY_STATE, VALUE_SAME); 16.63 } 16.64 } 16.65 16.66 private static void markAsDeleted(InputNode n) { 16.67 - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_DELETED)); 16.68 + n.getProperties().setProperty(PROPERTY_STATE, VALUE_DELETED); 16.69 } 16.70 16.71 private static void markAsNew(InputNode n) { 16.72 - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_NEW)); 16.73 + n.getProperties().setProperty(PROPERTY_STATE, VALUE_NEW); 16.74 } 16.75 }
17.1 --- a/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf Tue Oct 28 18:02:09 2008 -0700 17.2 +++ b/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf Thu Oct 30 17:08:48 2008 -0700 17.3 @@ -1,6 +1,6 @@ 17.4 -Manifest-Version: 1.0 17.5 -OpenIDE-Module: com.sun.hotspot.igv.filter 17.6 -OpenIDE-Module-Layer: com/sun/hotspot/igv/filter/layer.xml 17.7 -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/filter/Bundle.properties 17.8 -OpenIDE-Module-Specification-Version: 1.0 17.9 - 17.10 +Manifest-Version: 1.0 17.11 +OpenIDE-Module: com.sun.hotspot.igv.filter 17.12 +OpenIDE-Module-Layer: com/sun/hotspot/igv/filter/layer.xml 17.13 +OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/filter/Bundle.properties 17.14 +OpenIDE-Module-Specification-Version: 1.0 17.15 +
18.1 --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java Tue Oct 28 18:02:09 2008 -0700 18.2 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java Thu Oct 30 17:08:48 2008 -0700 18.3 @@ -25,7 +25,6 @@ 18.4 package com.sun.hotspot.igv.filter; 18.5 18.6 import com.sun.hotspot.igv.graph.Diagram; 18.7 -import com.sun.hotspot.igv.data.Property; 18.8 import java.io.BufferedReader; 18.9 import java.io.IOException; 18.10 import java.io.InputStream; 18.11 @@ -56,7 +55,7 @@ 18.12 public CustomFilter(String name, String code) { 18.13 this.name = name; 18.14 this.code = code; 18.15 - getProperties().add(new Property("name", name)); 18.16 + getProperties().setProperty("name", name); 18.17 } 18.18 18.19 public String getName() {
19.1 --- a/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java Tue Oct 28 18:02:09 2008 -0700 19.2 +++ b/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java Thu Oct 30 17:08:48 2008 -0700 19.3 @@ -56,8 +56,8 @@ 19.4 for (OutputSlot os : f.getOutputSlots()) { 19.5 for (Connection c : os.getConnections()) { 19.6 InputSlot is = c.getInputSlot(); 19.7 - is.setName(f.getProperties().getProperty("dump_spec")); 19.8 - String s = f.getProperties().getProperty("short_name"); 19.9 + is.setName(f.getProperties().get("dump_spec")); 19.10 + String s = f.getProperties().get("short_name"); 19.11 if (s != null) { 19.12 is.setShortName(s); 19.13 }
20.1 --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java Tue Oct 28 18:02:09 2008 -0700 20.2 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java Thu Oct 30 17:08:48 2008 -0700 20.3 @@ -35,7 +35,7 @@ 20.4 import java.util.Comparator; 20.5 import java.util.HashMap; 20.6 import java.util.HashSet; 20.7 -import java.util.Hashtable; 20.8 +import java.util.HashMap; 20.9 import java.util.List; 20.10 import java.util.Map; 20.11 import java.util.Set; 20.12 @@ -126,7 +126,7 @@ 20.13 d.updateBlocks(); 20.14 20.15 Collection<InputNode> nodes = graph.getNodes(); 20.16 - Hashtable<Integer, Figure> figureHash = new Hashtable<Integer, Figure>(); 20.17 + HashMap<Integer, Figure> figureHash = new HashMap<Integer, Figure>(); 20.18 for (InputNode n : nodes) { 20.19 Figure f = d.createFigure(); 20.20 f.getSource().addSourceNode(n);
21.1 --- a/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java Tue Oct 28 18:02:09 2008 -0700 21.2 +++ b/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java Thu Oct 30 17:08:48 2008 -0700 21.3 @@ -42,7 +42,7 @@ 21.4 * 21.5 * @author Thomas Wuerthinger 21.6 */ 21.7 -public class Figure extends Properties.Object implements Source.Provider, Vertex { 21.8 +public class Figure extends Properties.Entity implements Source.Provider, Vertex { 21.9 21.10 public static final int INSET = 6; 21.11 public static final int SLOT_WIDTH = 10;
22.1 --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java Tue Oct 28 18:02:09 2008 -0700 22.2 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java Thu Oct 30 17:08:48 2008 -0700 22.3 @@ -26,7 +26,7 @@ 22.4 import java.util.ArrayList; 22.5 import java.util.Collection; 22.6 import java.util.Collections; 22.7 -import java.util.Hashtable; 22.8 +import java.util.HashMap; 22.9 import java.util.LinkedList; 22.10 import java.util.List; 22.11 import java.util.Queue; 22.12 @@ -37,13 +37,13 @@ 22.13 */ 22.14 public class Graph<N, E> { 22.15 22.16 - private Hashtable<Object, Node<N, E>> nodes; 22.17 - private Hashtable<Object, Edge<N, E>> edges; 22.18 + private HashMap<Object, Node<N, E>> nodes; 22.19 + private HashMap<Object, Edge<N, E>> edges; 22.20 private List<Node<N, E>> nodeList; 22.21 22.22 public Graph() { 22.23 - nodes = new Hashtable<Object, Node<N, E>>(); 22.24 - edges = new Hashtable<Object, Edge<N, E>>(); 22.25 + nodes = new HashMap<Object, Node<N, E>>(); 22.26 + edges = new HashMap<Object, Edge<N, E>>(); 22.27 nodeList = new ArrayList<Node<N, E>>(); 22.28 } 22.29
23.1 --- a/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java Tue Oct 28 18:02:09 2008 -0700 23.2 +++ b/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java Thu Oct 30 17:08:48 2008 -0700 23.3 @@ -25,7 +25,7 @@ 23.4 23.5 import java.awt.Point; 23.6 import java.awt.Rectangle; 23.7 -import java.util.Hashtable; 23.8 +import java.util.HashMap; 23.9 import java.util.List; 23.10 import java.util.Set; 23.11 import java.util.ArrayList; 23.12 @@ -69,19 +69,19 @@ 23.13 23.14 assert graph.verify(); 23.15 23.16 - Hashtable<Cluster, List<Vertex>> lists = new Hashtable<Cluster, List<Vertex>>(); 23.17 - Hashtable<Cluster, List<Link>> listsConnection = new Hashtable<Cluster, List<Link>>(); 23.18 - Hashtable<Cluster, Hashtable<Port, ClusterInputSlotNode>> clusterInputSlotHash = new Hashtable<Cluster, Hashtable<Port, ClusterInputSlotNode>>(); 23.19 - Hashtable<Cluster, Hashtable<Port, ClusterOutputSlotNode>> clusterOutputSlotHash = new Hashtable<Cluster, Hashtable<Port, ClusterOutputSlotNode>>(); 23.20 + HashMap<Cluster, List<Vertex>> lists = new HashMap<Cluster, List<Vertex>>(); 23.21 + HashMap<Cluster, List<Link>> listsConnection = new HashMap<Cluster, List<Link>>(); 23.22 + HashMap<Cluster, HashMap<Port, ClusterInputSlotNode>> clusterInputSlotHash = new HashMap<Cluster, HashMap<Port, ClusterInputSlotNode>>(); 23.23 + HashMap<Cluster, HashMap<Port, ClusterOutputSlotNode>> clusterOutputSlotHash = new HashMap<Cluster, HashMap<Port, ClusterOutputSlotNode>>(); 23.24 23.25 - Hashtable<Cluster, ClusterNode> clusterNodes = new Hashtable<Cluster, ClusterNode>(); 23.26 - Hashtable<Cluster, Set<ClusterInputSlotNode>> clusterInputSlotSet = new Hashtable<Cluster, Set<ClusterInputSlotNode>>(); 23.27 - Hashtable<Cluster, Set<ClusterOutputSlotNode>> clusterOutputSlotSet = new Hashtable<Cluster, Set<ClusterOutputSlotNode>>(); 23.28 + HashMap<Cluster, ClusterNode> clusterNodes = new HashMap<Cluster, ClusterNode>(); 23.29 + HashMap<Cluster, Set<ClusterInputSlotNode>> clusterInputSlotSet = new HashMap<Cluster, Set<ClusterInputSlotNode>>(); 23.30 + HashMap<Cluster, Set<ClusterOutputSlotNode>> clusterOutputSlotSet = new HashMap<Cluster, Set<ClusterOutputSlotNode>>(); 23.31 Set<Link> clusterEdges = new HashSet<Link>(); 23.32 Set<Link> interClusterEdges = new HashSet<Link>(); 23.33 - Hashtable<Link, ClusterOutgoingConnection> linkClusterOutgoingConnection = new Hashtable<Link, ClusterOutgoingConnection>(); 23.34 - Hashtable<Link, InterClusterConnection> linkInterClusterConnection = new Hashtable<Link, InterClusterConnection>(); 23.35 - Hashtable<Link, ClusterIngoingConnection> linkClusterIngoingConnection = new Hashtable<Link, ClusterIngoingConnection>(); 23.36 + HashMap<Link, ClusterOutgoingConnection> linkClusterOutgoingConnection = new HashMap<Link, ClusterOutgoingConnection>(); 23.37 + HashMap<Link, InterClusterConnection> linkInterClusterConnection = new HashMap<Link, InterClusterConnection>(); 23.38 + HashMap<Link, ClusterIngoingConnection> linkClusterIngoingConnection = new HashMap<Link, ClusterIngoingConnection>(); 23.39 Set<ClusterNode> clusterNodeSet = new HashSet<ClusterNode>(); 23.40 23.41 Set<Cluster> cluster = graph.getClusters(); 23.42 @@ -89,8 +89,8 @@ 23.43 for (Cluster c : cluster) { 23.44 lists.put(c, new ArrayList<Vertex>()); 23.45 listsConnection.put(c, new ArrayList<Link>()); 23.46 - clusterInputSlotHash.put(c, new Hashtable<Port, ClusterInputSlotNode>()); 23.47 - clusterOutputSlotHash.put(c, new Hashtable<Port, ClusterOutputSlotNode>()); 23.48 + clusterInputSlotHash.put(c, new HashMap<Port, ClusterInputSlotNode>()); 23.49 + clusterOutputSlotHash.put(c, new HashMap<Port, ClusterOutputSlotNode>()); 23.50 clusterOutputSlotSet.put(c, new TreeSet<ClusterOutputSlotNode>()); 23.51 clusterInputSlotSet.put(c, new TreeSet<ClusterInputSlotNode>()); 23.52 ClusterNode cn = new ClusterNode(c, "" + z);
24.1 --- a/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java Tue Oct 28 18:02:09 2008 -0700 24.2 +++ b/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java Thu Oct 30 17:08:48 2008 -0700 24.3 @@ -24,7 +24,7 @@ 24.4 package com.sun.hotspot.igv.layout; 24.5 24.6 import java.util.HashSet; 24.7 -import java.util.Hashtable; 24.8 +import java.util.HashMap; 24.9 import java.util.Set; 24.10 import java.util.SortedSet; 24.11 import java.util.TreeSet; 24.12 @@ -37,9 +37,9 @@ 24.13 24.14 private Set<? extends Link> links; 24.15 private SortedSet<Vertex> vertices; 24.16 - private Hashtable<Vertex, Set<Port>> inputPorts; 24.17 - private Hashtable<Vertex, Set<Port>> outputPorts; 24.18 - private Hashtable<Port, Set<Link>> portLinks; 24.19 + private HashMap<Vertex, Set<Port>> inputPorts; 24.20 + private HashMap<Vertex, Set<Port>> outputPorts; 24.21 + private HashMap<Port, Set<Link>> portLinks; 24.22 24.23 public LayoutGraph(Set<? extends Link> links) { 24.24 this(links, new HashSet<Vertex>()); 24.25 @@ -50,9 +50,9 @@ 24.26 assert verify(); 24.27 24.28 vertices = new TreeSet<Vertex>(); 24.29 - portLinks = new Hashtable<Port, Set<Link>>(); 24.30 - inputPorts = new Hashtable<Vertex, Set<Port>>(); 24.31 - outputPorts = new Hashtable<Vertex, Set<Port>>(); 24.32 + portLinks = new HashMap<Port, Set<Link>>(); 24.33 + inputPorts = new HashMap<Vertex, Set<Port>>(); 24.34 + outputPorts = new HashMap<Vertex, Set<Port>>(); 24.35 24.36 for (Link l : links) { 24.37 Port p = l.getFrom();
25.1 --- a/src/share/tools/IdealGraphVisualizer/README Tue Oct 28 18:02:09 2008 -0700 25.2 +++ b/src/share/tools/IdealGraphVisualizer/README Thu Oct 30 17:08:48 2008 -0700 25.3 @@ -5,21 +5,16 @@ 25.4 was the primary target of the tool. The tool itself is fairly general 25.5 with only a few modules that contain C2 specific elements. 25.6 25.7 -The tool is built on top of the NetBeans 6.0 rich client 25.8 +The tool is built on top of the NetBeans 6.1 rich client 25.9 infrastructure and so requires NetBeans to build. It currently 25.10 requires Java 6 to run as it needs support for JavaScript for its 25.11 filtering mechanism and assumes it's built into the platform. It 25.12 -should build out of the box whit NetBeans 6 and Java 6 or later. It's 25.13 -possible to run it on 1.5 by including Rhino on the classpath though 25.14 -that currently isn't working correctly. Support for exporting graphs 25.15 -as SVG can be enabled by adding batik to the classpath which isn't 25.16 -included by default. 25.17 - 25.18 -It can be built on top of NetBeans 6.1 if you change the required 25.19 -modules to be platform8 instead of platform7. The tool could run on 25.20 -JDK 1.5 with some reworking of the how the JavaScript support is 25.21 -enabled but currently it requires some tweaking of the setup. This 25.22 -will be fixed in a later setup. 25.23 +should build out of the box with NetBeans 6.1 and Java 6 or later. 25.24 +It's possible to run it on 1.5 by including Rhino on the classpath 25.25 +though that currently isn't working correctly. Support for exporting 25.26 +graphs as SVG can be enabled by adding batik to the classpath which 25.27 +isn't included by default. It can be built on top of NetBeans 6.0 if 25.28 +you change the required modules to be platform7 instead of platform8. 25.29 25.30 The JVM support is controlled by the flag -XX:PrintIdealGraphLevel=# 25.31 where # is:
26.1 --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java Tue Oct 28 18:02:09 2008 -0700 26.2 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java Thu Oct 30 17:08:48 2008 -0700 26.3 @@ -36,11 +36,11 @@ 26.4 */ 26.5 public class PropertiesSheet { 26.6 26.7 - public static void initializeSheet(Properties properties, Sheet s) { 26.8 + public static void initializeSheet(final Properties properties, Sheet s) { 26.9 26.10 Sheet.Set set1 = Sheet.createPropertiesSet(); 26.11 set1.setDisplayName("Properties"); 26.12 - for (final Property p : properties.getProperties()) { 26.13 + for (final Property p : properties) { 26.14 Node.Property<String> prop = new Node.Property<String>(String.class) { 26.15 26.16 @Override 26.17 @@ -60,7 +60,7 @@ 26.18 26.19 @Override 26.20 public void setValue(String arg0) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { 26.21 - p.setValue(arg0); 26.22 + properties.setProperty(p.getName(), arg0); 26.23 } 26.24 }; 26.25 prop.setName(p.getName());
27.1 --- a/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Tue Oct 28 18:02:09 2008 -0700 27.2 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java Thu Oct 30 17:08:48 2008 -0700 27.3 @@ -65,13 +65,19 @@ 27.4 27.5 public RangeSliderModel(List<String> positions) { 27.6 assert positions.size() > 0; 27.7 - this.positions = positions; 27.8 this.changedEvent = new ChangedEvent<RangeSliderModel>(this); 27.9 this.colorChangedEvent = new ChangedEvent<RangeSliderModel>(this); 27.10 + setPositions(positions); 27.11 + } 27.12 + 27.13 + protected void setPositions(List<String> positions) { 27.14 + this.positions = positions; 27.15 colors = new ArrayList<Color>(); 27.16 for (int i = 0; i < positions.size(); i++) { 27.17 colors.add(Color.black); 27.18 } 27.19 + changedEvent.fire(); 27.20 + colorChangedEvent.fire(); 27.21 } 27.22 27.23 public void setColors(List<Color> colors) {
28.1 --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Tue Oct 28 18:02:09 2008 -0700 28.2 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Thu Oct 30 17:08:48 2008 -0700 28.3 @@ -63,7 +63,7 @@ 28.4 import java.util.Collection; 28.5 import java.util.HashMap; 28.6 import java.util.HashSet; 28.7 -import java.util.Hashtable; 28.8 +import java.util.HashMap; 28.9 import java.util.List; 28.10 import java.util.Map; 28.11 import java.util.Set; 28.12 @@ -104,10 +104,10 @@ 28.13 */ 28.14 public class DiagramScene extends Scene implements ChangedListener<DiagramViewModel> { 28.15 28.16 - private Hashtable<Figure, FigureWidget> figureWidgets; 28.17 - private Hashtable<Slot, SlotWidget> slotWidgets; 28.18 - private Hashtable<Connection, ConnectionWidget> connectionWidgets; 28.19 - private Hashtable<InputBlock, BlockWidget> blockWidgets; 28.20 + private HashMap<Figure, FigureWidget> figureWidgets; 28.21 + private HashMap<Slot, SlotWidget> slotWidgets; 28.22 + private HashMap<Connection, ConnectionWidget> connectionWidgets; 28.23 + private HashMap<InputBlock, BlockWidget> blockWidgets; 28.24 private Widget hoverWidget; 28.25 private WidgetAction hoverAction; 28.26 private List<FigureWidget> selectedWidgets; 28.27 @@ -414,7 +414,7 @@ 28.28 this.addChild(selectLayer); 28.29 this.getActions().addAction(ActionFactory.createRectangularSelectAction(rectangularSelectDecorator, selectLayer, rectangularSelectProvider)); 28.30 28.31 - blockWidgets = new Hashtable<InputBlock, BlockWidget>(); 28.32 + blockWidgets = new HashMap<InputBlock, BlockWidget>(); 28.33 28.34 boolean b = this.getUndoRedoEnabled(); 28.35 this.setUndoRedoEnabled(false); 28.36 @@ -543,9 +543,9 @@ 28.37 blockLayer.removeChildren(); 28.38 28.39 blockWidgets.clear(); 28.40 - figureWidgets = new Hashtable<Figure, FigureWidget>(); 28.41 - slotWidgets = new Hashtable<Slot, SlotWidget>(); 28.42 - connectionWidgets = new Hashtable<Connection, ConnectionWidget>(); 28.43 + figureWidgets = new HashMap<Figure, FigureWidget>(); 28.44 + slotWidgets = new HashMap<Slot, SlotWidget>(); 28.45 + connectionWidgets = new HashMap<Connection, ConnectionWidget>(); 28.46 28.47 WidgetAction selectAction = new ExtendedSelectAction(selectProvider); 28.48 Diagram d = getModel().getDiagramToView();
29.1 --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java Tue Oct 28 18:02:09 2008 -0700 29.2 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java Thu Oct 30 17:08:48 2008 -0700 29.3 @@ -55,6 +55,7 @@ 29.4 private FilterChain filterChain; 29.5 private FilterChain sequenceFilterChain; 29.6 private Diagram diagram; 29.7 + private ChangedEvent<DiagramViewModel> groupChangedEvent; 29.8 private ChangedEvent<DiagramViewModel> diagramChangedEvent; 29.9 private ChangedEvent<DiagramViewModel> viewChangedEvent; 29.10 private ChangedEvent<DiagramViewModel> viewPropertiesChangedEvent; 29.11 @@ -67,6 +68,7 @@ 29.12 } 29.13 }; 29.14 29.15 + @Override 29.16 public DiagramViewModel copy() { 29.17 DiagramViewModel result = new DiagramViewModel(group, filterChain, sequenceFilterChain); 29.18 result.setData(this); 29.19 @@ -79,6 +81,7 @@ 29.20 boolean viewChanged = false; 29.21 boolean viewPropertiesChanged = false; 29.22 29.23 + boolean groupChanged = (group == newModel.group); 29.24 this.group = newModel.group; 29.25 diagramChanged |= (filterChain != newModel.filterChain); 29.26 this.filterChain = newModel.filterChain; 29.27 @@ -97,6 +100,10 @@ 29.28 viewPropertiesChanged |= (showNodeHull != newModel.showNodeHull); 29.29 this.showNodeHull = newModel.showNodeHull; 29.30 29.31 + if(groupChanged) { 29.32 + groupChangedEvent.fire(); 29.33 + } 29.34 + 29.35 if (diagramChanged) { 29.36 diagramChangedEvent.fire(); 29.37 } 29.38 @@ -143,11 +150,38 @@ 29.39 diagramChangedEvent = new ChangedEvent<DiagramViewModel>(this); 29.40 viewChangedEvent = new ChangedEvent<DiagramViewModel>(this); 29.41 viewPropertiesChangedEvent = new ChangedEvent<DiagramViewModel>(this); 29.42 + groupChangedEvent = new ChangedEvent<DiagramViewModel>(this); 29.43 + groupChangedEvent.addListener(groupChangedListener); 29.44 + groupChangedEvent.fire(); 29.45 29.46 filterChain.getChangedEvent().addListener(filterChainChangedListener); 29.47 sequenceFilterChain.getChangedEvent().addListener(filterChainChangedListener); 29.48 } 29.49 29.50 + private final ChangedListener<DiagramViewModel> groupChangedListener = new ChangedListener<DiagramViewModel>() { 29.51 + 29.52 + private Group oldGroup; 29.53 + 29.54 + public void changed(DiagramViewModel source) { 29.55 + if(oldGroup != null) { 29.56 + oldGroup.getChangedEvent().removeListener(groupContentChangedListener); 29.57 + } 29.58 + group.getChangedEvent().addListener(groupContentChangedListener); 29.59 + oldGroup = group; 29.60 + } 29.61 + }; 29.62 + 29.63 + 29.64 + private final ChangedListener<Group> groupContentChangedListener = new ChangedListener<Group>() { 29.65 + 29.66 + public void changed(Group source) { 29.67 + assert source == group; 29.68 + setPositions(calculateStringList(source)); 29.69 + setSelectedNodes(selectedNodes); 29.70 + } 29.71 + 29.72 + }; 29.73 + 29.74 public ChangedEvent<DiagramViewModel> getDiagramChangedEvent() { 29.75 return diagramChangedEvent; 29.76 } 29.77 @@ -268,7 +302,10 @@ 29.78 } 29.79 29.80 public InputGraph getSecondGraph() { 29.81 - return group.getGraphs().get(getSecondPosition()); 29.82 + List<InputGraph> graphs = group.getGraphs(); 29.83 + if (graphs.size() >= getSecondPosition()) 29.84 + return group.getGraphs().get(getSecondPosition()); 29.85 + return getFirstGraph(); 29.86 } 29.87 29.88 public void selectGraph(InputGraph g) {
30.1 --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java Tue Oct 28 18:02:09 2008 -0700 30.2 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java Thu Oct 30 17:08:48 2008 -0700 30.3 @@ -67,7 +67,7 @@ 30.4 30.5 for (Figure f : figures) { 30.6 Properties prop = f.getProperties(); 30.7 - for (Property p : prop.getProperties()) { 30.8 + for (Property p : prop) { 30.9 if (!propertyNames.contains(p.getName())) { 30.10 propertyNames.add(p.getName()); 30.11 }
31.1 --- a/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties Tue Oct 28 18:02:09 2008 -0700 31.2 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties Thu Oct 30 17:08:48 2008 -0700 31.3 @@ -1,16 +1,16 @@ 31.4 # Deprecated since 5.0u1; for compatibility with 5.0: 31.5 disabled.clusters=\ 31.6 apisupport1,\ 31.7 + gsf1,\ 31.8 harness,\ 31.9 - ide8,\ 31.10 - java1,\ 31.11 - nb6.0,\ 31.12 - profiler2 31.13 + ide9,\ 31.14 + java2,\ 31.15 + nb6.1,\ 31.16 + profiler3 31.17 disabled.modules=\ 31.18 org.netbeans.core.execution,\ 31.19 org.netbeans.core.multiview,\ 31.20 org.netbeans.core.output2,\ 31.21 - org.netbeans.modules.applemenu,\ 31.22 org.netbeans.modules.autoupdate.services,\ 31.23 org.netbeans.modules.autoupdate.ui,\ 31.24 org.netbeans.modules.core.kit,\ 31.25 @@ -24,6 +24,6 @@ 31.26 org.openide.execution,\ 31.27 org.openide.util.enumerations 31.28 enabled.clusters=\ 31.29 - platform7 31.30 + platform8 31.31 nbjdk.active=default 31.32 nbplatform.active=default
32.1 --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Tue Oct 28 18:02:09 2008 -0700 32.2 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Thu Oct 30 17:08:48 2008 -0700 32.3 @@ -15,7 +15,6 @@ 32.4 ${project.com.sun.hotspot.igv.difference}:\ 32.5 ${project.com.sun.hotspot.igv.settings}:\ 32.6 ${project.com.sun.hotspot.igv.util}:\ 32.7 - ${project.com.sun.hotspot.igv.rhino}:\ 32.8 ${project.com.sun.hotspot.igv.svg}:\ 32.9 ${project.com.sun.hotspot.connection}:\ 32.10 ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ 32.11 @@ -31,10 +30,10 @@ 32.12 project.com.sun.hotspot.igv.graph=Graph 32.13 project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout 32.14 project.com.sun.hotspot.igv.layout=Layout 32.15 -project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy 32.16 project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler 32.17 project.com.sun.hotspot.igv.settings=Settings 32.18 project.com.sun.hotspot.igv.svg=BatikSVGProxy 32.19 project.com.sun.hotspot.igv.view=View 32.20 project.com.sun.hotspot.igv.util=Util 32.21 -run.args = -server -J-Xms64m -J-Xmx512m -J-da 32.22 +run.args = -J-server -J-Xms64m -J-Xmx1g -J-da 32.23 +run.args.extra = -J-server -J-Xms64m -J-Xmx1g -J-da
33.1 --- a/src/share/vm/adlc/output_h.cpp Tue Oct 28 18:02:09 2008 -0700 33.2 +++ b/src/share/vm/adlc/output_h.cpp Thu Oct 30 17:08:48 2008 -0700 33.3 @@ -377,7 +377,7 @@ 33.4 ++i; 33.5 } 33.6 else if (!strcmp(ideal_type, "ConN")) { 33.7 - fprintf(fp," _c%d->dump();\n", i); 33.8 + fprintf(fp," _c%d->dump_on(st);\n", i); 33.9 ++i; 33.10 } 33.11 else if (!strcmp(ideal_type, "ConL")) {
34.1 --- a/src/share/vm/opto/compile.cpp Tue Oct 28 18:02:09 2008 -0700 34.2 +++ b/src/share/vm/opto/compile.cpp Thu Oct 30 17:08:48 2008 -0700 34.3 @@ -551,7 +551,7 @@ 34.4 rethrow_exceptions(kit.transfer_exceptions_into_jvms()); 34.5 } 34.6 34.7 - print_method("Before RemoveUseless"); 34.8 + print_method("Before RemoveUseless", 3); 34.9 34.10 // Remove clutter produced by parsing. 34.11 if (!failing()) {
35.1 --- a/src/share/vm/opto/type.cpp Tue Oct 28 18:02:09 2008 -0700 35.2 +++ b/src/share/vm/opto/type.cpp Thu Oct 30 17:08:48 2008 -0700 35.3 @@ -3541,7 +3541,7 @@ 35.4 35.5 #ifndef PRODUCT 35.6 void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { 35.7 - tty->print("narrowoop: "); 35.8 + st->print("narrowoop: "); 35.9 _ooptype->dump2(d, depth, st); 35.10 } 35.11 #endif
36.1 --- a/src/share/vm/runtime/frame.cpp Tue Oct 28 18:02:09 2008 -0700 36.2 +++ b/src/share/vm/runtime/frame.cpp Thu Oct 30 17:08:48 2008 -0700 36.3 @@ -83,12 +83,12 @@ 36.4 intptr_t* src = (intptr_t*) location(r); 36.5 if (src != NULL) { 36.6 36.7 - r->print(); 36.8 - tty->print(" [" INTPTR_FORMAT "] = ", src); 36.9 + r->print_on(st); 36.10 + st->print(" [" INTPTR_FORMAT "] = ", src); 36.11 if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { 36.12 - tty->print_cr("<misaligned>"); 36.13 + st->print_cr("<misaligned>"); 36.14 } else { 36.15 - tty->print_cr(INTPTR_FORMAT, *src); 36.16 + st->print_cr(INTPTR_FORMAT, *src); 36.17 } 36.18 } 36.19 }