# HG changeset patch # User Thomas Wuerthinger # Date 1328388062 -3600 # Node ID b995eee3697062fd6b611d691e349fe094d03c96 # Parent de4e6eb7265b94bec33ca79f821a71e80b8699c1 Remove server compiler project. Create new lookup utility. diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java --- a/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java Sat Feb 04 21:12:50 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Outline/src/com/oracle/graal/visualizer/outline/OutlineTopComponent.java Sat Feb 04 21:41:02 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,10 +50,6 @@ import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; -/** - * - * @author Thomas Wuerthinger - */ public final class OutlineTopComponent extends TopComponent implements ExplorerManager.Provider, LookupListener { public static final String GLOBAL_ACTIONS_FOLDER = "Actions/Outline/Global"; diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/build.xml --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/build.xml Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.servercompilerscheduler. - - diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/manifest.mf Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.servercompiler -OpenIDE-Module-Layer: com/sun/hotspot/igv/servercompiler/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/servercompiler/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/build-impl.xml Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/genfiles.properties Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -build.xml.data.CRC32=d1360a65 -build.xml.script.CRC32=a9d94ef8 -build.xml.stylesheet.CRC32=79c3b980 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=d1360a65 -nbproject/build-impl.xml.script.CRC32=52847236 -nbproject/build-impl.xml.stylesheet.CRC32=deb65f65 diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/platform.properties --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/platform.properties Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -# Deprecated since 5.0u1; for compatibility with 5.0: -disabled.clusters=\ - apisupport1,\ - harness,\ - ide8,\ - java1,\ - nb6.0,\ - profiler2 -disabled.modules=\ - org.netbeans.core.execution,\ - org.netbeans.core.multiview,\ - org.netbeans.core.output2,\ - org.netbeans.modules.applemenu,\ - org.netbeans.modules.autoupdate.services,\ - org.netbeans.modules.autoupdate.ui,\ - org.netbeans.modules.core.kit,\ - org.netbeans.modules.favorites,\ - org.netbeans.modules.javahelp,\ - org.netbeans.modules.masterfs,\ - org.netbeans.modules.options.keymap,\ - org.netbeans.modules.sendopts,\ - org.netbeans.modules.templates,\ - org.openide.compat,\ - org.openide.execution,\ - org.openide.util.enumerations -enabled.clusters=\ - platform7 -nbjdk.active=JDK_1.6 -nbplatform.active=default diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.properties Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.7 -javac.compilerargs=-Xlint -Xlint:-serial diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/project.xml Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.servercompiler - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - com.sun.hotspot.igv.graph - - - - 1.0 - - - - - - - diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/nbproject/suite.properties Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.data.services.Scheduler --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/META-INF/services/com.sun.hotspot.igv.data.services.Scheduler Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.hotspot.igv.servercompiler.ServerCompilerScheduler diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/Bundle.properties Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=ServerCompiler diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,624 +0,0 @@ -/* - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.hotspot.igv.servercompiler; - -import com.sun.hotspot.igv.data.InputBlock; -import com.sun.hotspot.igv.data.InputEdge; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; -import com.sun.hotspot.igv.data.services.Scheduler; -import java.util.*; - -/** - * - * @author Thomas Wuerthinger - */ -public class ServerCompilerScheduler implements Scheduler { - - private static class Node { - - public InputNode inputNode; - public Set succs = new HashSet<>(); - public List preds = new ArrayList<>(); - public InputBlock block; - public boolean isBlockProjection; - public boolean isBlockStart; - } - private InputGraph graph; - private Collection nodes; - private Map inputNodeToNode; - private Vector blocks; - private Map dominatorMap; - private Map blockIndex; - private InputBlock[][] commonDominator; - private static final Comparator edgeComparator = new Comparator() { - - @Override - public int compare(InputEdge o1, InputEdge o2) { - return o1.getToIndex() - o2.getToIndex(); - } - }; - - public void buildBlocks() { - - blocks = new Vector<>(); - Node root = findRoot(); - if (root == null) { - return; - } - Stack stack = new Stack<>(); - Set visited = new HashSet<>(); - stack.add(root); - int blockCount = 0; - InputBlock rootBlock = null; - - - while (!stack.isEmpty()) { - Node proj = stack.pop(); - Node parent = proj; - if (proj.isBlockProjection && proj.preds.size() > 0) { - parent = proj.preds.get(0); - } - - if (!visited.contains(parent)) { - visited.add(parent); - InputBlock block = graph.addBlock(Integer.toString(blockCount)); - blocks.add(block); - if (parent == root) { - rootBlock = block; - } - blockCount++; - parent.block = block; - if (proj != parent && proj.succs.size() == 1 && proj.succs.contains(root)) { - // Special treatment of Halt-nodes - proj.block = block; - } - - Node p = proj; - do { - if (p.preds.size() == 0 || p.preds.get(0) == null) { - p = parent; - break; - } - - p = p.preds.get(0); - if (p == proj) { - // Cycle, stop - break; - } - - if (p.block == null) { - p.block = block; - } - } while (!p.isBlockProjection && !p.isBlockStart); - - if (block != rootBlock) { - for (Node n : p.preds) { - if (n != null && n != p) { - if (n.isBlockProjection) { - n = n.preds.get(0); - } - if (n.block != null) { - graph.addBlockEdge(n.block, block); - } - } - } - } - - for (Node n : parent.succs) { - if (n != root && n.isBlockProjection) { - for (Node n2 : n.succs) { - - if (n2 != parent && n2.block != null && n2.block != rootBlock) { - graph.addBlockEdge(block, n2.block); - } - } - } else { - if (n != parent && n.block != null && n.block != rootBlock) { - graph.addBlockEdge(block, n.block); - } - } - } - - int num_preds = p.preds.size(); - int bottom = -1; - if (isRegion(p) || isPhi(p)) { - bottom = 0; - } - - int pushed = 0; - for (int i = num_preds - 1; i > bottom; i--) { - if (p.preds.get(i) != null && p.preds.get(i) != p) { - stack.push(p.preds.get(i)); - pushed++; - } - } - - if (pushed == 0 && p == root) { - // TODO: special handling when root backedges are not built yet - } - } - } - - for (Node n : nodes) { - InputBlock block = n.block; - if (block != null) { - block.addNode(n.inputNode.getId()); - } - } - - int z = 0; - blockIndex = new HashMap<>(blocks.size()); - for (InputBlock b : blocks) { - blockIndex.put(b, z); - z++; - } - } - - private String getBlockName(InputNode n) { - return n.getProperties().get("block"); - } - - @Override - public Collection schedule(InputGraph graph) { - if (graph.getNodes().isEmpty()) { - return Collections.emptyList(); - } - - if (graph.getBlocks().size() > 0) { - Collection tmpNodes = new ArrayList<>(graph.getNodes()); - for (InputNode n : tmpNodes) { - String block = getBlockName(n); - if (graph.getBlock(n) == null) { - graph.getBlock(block).addNode(n.getId()); - assert graph.getBlock(n) != null; - } - } - return graph.getBlocks(); - } else { - nodes = new ArrayList<>(); - inputNodeToNode = new HashMap<>(graph.getNodes().size()); - - this.graph = graph; - buildUpGraph(); - buildBlocks(); - buildDominators(); - buildCommonDominators(); - scheduleLatest(); - - InputBlock noBlock = null; - for (InputNode n : graph.getNodes()) { - if (graph.getBlock(n) == null) { - if (noBlock == null) { - noBlock = graph.addBlock("(no block)"); - blocks.add(noBlock); - } - - graph.setBlock(n, noBlock); - } - assert graph.getBlock(n) != null; - } - - return blocks; - } - } - - private void scheduleLatest() { - Node root = findRoot(); - if(root == null) { - assert false : "No root found!"; - return; - } - - // Mark all nodes reachable in backward traversal from root - Set reachable = new HashSet<>(); - reachable.add(root); - Stack stack = new Stack<>(); - stack.push(root); - while (!stack.isEmpty()) { - Node cur = stack.pop(); - for (Node n : cur.preds) { - if (!reachable.contains(n)) { - reachable.add(n); - stack.push(n); - } - } - } - - Set unscheduled = new HashSet<>(); - for (Node n : this.nodes) { - if (n.block == null && reachable.contains(n)) { - unscheduled.add(n); - } - } - - while (unscheduled.size() > 0) { - boolean progress = false; - - Set newUnscheduled = new HashSet<>(); - for (Node n : unscheduled) { - - InputBlock block = null; - if (this.isPhi(n) && n.preds.get(0) != null) { - // Phi nodes in same block as region nodes - block = n.preds.get(0).block; - } else { - for (Node s : n.succs) { - if (reachable.contains(s)) { - if (s.block == null) { - block = null; - break; - } else { - if (block == null) { - block = s.block; - } else { - block = commonDominator[this.blockIndex.get(block)][blockIndex.get(s.block)]; - } - } - } - } - } - - if (block != null) { - n.block = block; - block.addNode(n.inputNode.getId()); - progress = true; - } else { - newUnscheduled.add(n); - } - } - - unscheduled = newUnscheduled; - - if (!progress) { - break; - } - } - - Set curReachable = new HashSet<>(reachable); - for (Node n : curReachable) { - if (n.block != null) { - for (Node s : n.succs) { - if (!reachable.contains(s)) { - markWithBlock(s, n.block, reachable); - } - } - } - } - - } - - private void markWithBlock(Node n, InputBlock b, Set reachable) { - assert !reachable.contains(n); - Stack stack = new Stack<>(); - stack.push(n); - n.block = b; - b.addNode(n.inputNode.getId()); - reachable.add(n); - - while (!stack.isEmpty()) { - Node cur = stack.pop(); - for (Node s : cur.succs) { - if (!reachable.contains(s)) { - reachable.add(s); - s.block = b; - b.addNode(s.inputNode.getId()); - stack.push(s); - } - } - - for (Node s : cur.preds) { - if (!reachable.contains(s)) { - reachable.add(s); - s.block = b; - b.addNode(s.inputNode.getId()); - stack.push(s); - } - } - } - } - - private class BlockIntermediate { - - InputBlock block; - int index; - int dominator; - int semi; - int parent; - int label; - int ancestor; - List pred; - List bucket; - } - - public void buildCommonDominators() { - commonDominator = new InputBlock[this.blocks.size()][this.blocks.size()]; - for (int i = 0; i < blocks.size(); i++) { - for (int j = 0; j < blocks.size(); j++) { - commonDominator[i][j] = getCommonDominator(i, j); - } - } - } - - public InputBlock getCommonDominator(int a, int b) { - InputBlock ba = blocks.get(a); - InputBlock bb = blocks.get(b); - if (ba == bb) { - return ba; - } - Set visited = new HashSet<>(); - while (ba != null) { - visited.add(ba); - ba = dominatorMap.get(ba); - } - - while (bb != null) { - if (visited.contains(bb)) { - return bb; - } - bb = dominatorMap.get(bb); - } - - assert false; - return null; - } - - public void buildDominators() { - dominatorMap = new HashMap<>(graph.getBlocks().size()); - if (blocks.size() == 0) { - return; - } - Vector intermediate = new Vector<>(graph.getBlocks().size()); - Map map = new HashMap<>(graph.getBlocks().size()); - int z = 0; - for (InputBlock b : blocks) { - BlockIntermediate bi = new BlockIntermediate(); - bi.block = b; - bi.index = z; - bi.dominator = -1; - bi.semi = -1; - bi.parent = -1; - bi.label = z; - bi.ancestor = -1; - bi.pred = new ArrayList<>(); - bi.bucket = new ArrayList<>(); - intermediate.add(bi); - map.put(b, bi); - z++; - } - Stack stack = new Stack<>(); - stack.add(0); - - Vector array = new Vector<>(); - intermediate.get(0).dominator = 0; - - int n = 0; - while (!stack.isEmpty()) { - int index = stack.pop(); - BlockIntermediate ib = intermediate.get(index); - ib.semi = n; - array.add(ib); - n = n + 1; - for (InputBlock b : ib.block.getSuccessors()) { - BlockIntermediate succ = map.get(b); - if (succ.semi == -1) { - succ.parent = index; - stack.push(succ.index); // TODO: check if same node could be pushed twice - } - succ.pred.add(index); - } - } - - for (int i = n - 1; i > 0; i--) { - BlockIntermediate block = array.get(i); - int block_index = block.index; - for (int predIndex : block.pred) { - int curIndex = eval(predIndex, intermediate); - BlockIntermediate curBlock = intermediate.get(curIndex); - if (curBlock.semi < block.semi) { - block.semi = curBlock.semi; - } - } - - - int semiIndex = block.semi; - BlockIntermediate semiBlock = array.get(semiIndex); - semiBlock.bucket.add(block_index); - - link(block.parent, block_index, intermediate); - BlockIntermediate parentBlock = intermediate.get(block.parent); - - for (int j = 0; j < parentBlock.bucket.size(); j++) { - for (int curIndex : parentBlock.bucket) { - int newIndex = eval(curIndex, intermediate); - BlockIntermediate curBlock = intermediate.get(curIndex); - BlockIntermediate newBlock = intermediate.get(newIndex); - int dom = block.parent; - if (newBlock.semi < curBlock.semi) { - dom = newIndex; - } - - curBlock.dominator = dom; - } - } - - - parentBlock.bucket.clear(); - } - - for (int i = 1; i < n; i++) { - - BlockIntermediate block = array.get(i); - int block_index = block.index; - - int semi_index = block.semi; - BlockIntermediate semi_block = array.get(semi_index); - - if (block.dominator != semi_block.index) { - int new_dom = intermediate.get(block.dominator).dominator; - block.dominator = new_dom; - } - } - - for (BlockIntermediate ib : intermediate) { - if (ib.dominator == -1) { - ib.dominator = 0; - } - } - - for (BlockIntermediate bi : intermediate) { - InputBlock b = bi.block; - int dominator = bi.dominator; - InputBlock dominatorBlock = null; - if (dominator != -1) { - dominatorBlock = intermediate.get(dominator).block; - } - - if (dominatorBlock == b) { - dominatorBlock = null; - } - this.dominatorMap.put(b, dominatorBlock); - } - } - - private void compress(int index, Vector blocks) { - BlockIntermediate block = blocks.get(index); - - int ancestor = block.ancestor; - assert ancestor != -1; - - BlockIntermediate ancestor_block = blocks.get(ancestor); - if (ancestor_block.ancestor != -1) { - compress(ancestor, blocks); - - int label = block.label; - BlockIntermediate label_block = blocks.get(label); - - int ancestor_label = ancestor_block.label; - BlockIntermediate ancestor_label_block = blocks.get(label); - if (ancestor_label_block.semi < label_block.semi) { - block.label = ancestor_label; - } - - block.ancestor = ancestor_block.ancestor; - } - } - - private int eval(int index, Vector blocks) { - BlockIntermediate block = blocks.get(index); - if (block.ancestor == -1) { - return index; - } else { - compress(index, blocks); - return block.label; - } - } - - private void link(int index1, int index2, Vector blocks) { - BlockIntermediate block2 = blocks.get(index2); - block2.ancestor = index1; - } - - private boolean isRegion(Node n) { - return n.inputNode.getProperties().get("name").equals("Region"); - } - - private boolean isPhi(Node n) { - return n.inputNode.getProperties().get("name").equals("Phi"); - } - - private Node findRoot() { - Node minNode = null; - Node alternativeRoot = null; - - for (Node node : nodes) { - InputNode inputNode = node.inputNode; - String s = inputNode.getProperties().get("name"); - if (s != null && s.equals("Root")) { - return node; - } - - if (alternativeRoot == null && node.preds.isEmpty()) { - alternativeRoot = node; - } - - if (minNode == null || node.inputNode.getId() < minNode.inputNode.getId()) { - minNode = node; - } - } - - if (alternativeRoot != null) { - return alternativeRoot; - } else { - return minNode; - } - } - - public void buildUpGraph() { - - for (InputNode n : graph.getNodes()) { - Node node = new Node(); - node.inputNode = n; - nodes.add(node); - String p = n.getProperties().get("is_block_proj"); - node.isBlockProjection = (p != null && p.equals("true")); - p = n.getProperties().get("is_block_start"); - node.isBlockStart = (p != null && p.equals("true")); - inputNodeToNode.put(n, node); - } - - Map> edgeMap = new HashMap<>(graph.getEdges().size()); - for (InputEdge e : graph.getEdges()) { - - int to = e.getTo(); - if (!edgeMap.containsKey(to)) { - edgeMap.put(to, new ArrayList()); - } - - - List list = edgeMap.get(to); - list.add(e); - } - - - for (Integer i : edgeMap.keySet()) { - - List list = edgeMap.get(i); - Collections.sort(list, edgeComparator); - - int to = i; - InputNode toInputNode = graph.getNode(to); - Node toNode = inputNodeToNode.get(toInputNode); - for (InputEdge e : list) { - assert to == e.getTo(); - int from = e.getFrom(); - InputNode fromInputNode = graph.getNode(from); - Node fromNode = inputNodeToNode.get(fromInputNode); - fromNode.succs.add(toNode); - toNode.preds.add(fromNode); - } - } - } -} diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/color.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/color.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -colorize("name", ".*", yellow); -colorize("name", "Catch.*", blue); -colorize("name", "Region|Loop|CountedLoop|Root", red); -colorize("name", "CProj|IfFalse|IfTrue|JProj|CatchProj", magenta); -colorize("name", "Con.*", orange); -colorize("name", "Parm|Proj", lightGray); - -// Nodes with bci -colorize("bci", "..*", magenta); - -// Line style -var f = new ColorFilter("Line Style filter"); -f.addRule(new ColorFilter.ColorRule(new MatcherSelector(new Properties.StringPropertyMatcher("type", "int:")), null, Color.BLUE, null)); -f.addRule(new ColorFilter.ColorRule(new MatcherSelector(new Properties.StringPropertyMatcher("type", "control")), null, Color.RED, null)); -f.addRule(new ColorFilter.ColorRule(new MatcherSelector(new Properties.StringPropertyMatcher("type", "memory")), null, Color.GREEN, null)); -f.addRule(new ColorFilter.ColorRule(new MatcherSelector(new Properties.StringPropertyMatcher("type", "tuple:")), null, Color.MAGENTA, null)); -f.addRule(new ColorFilter.ColorRule(new MatcherSelector(new Properties.StringPropertyMatcher("type", "bottom")), null, Color.LIGHT_GRAY, null)); -f.apply(graph); \ No newline at end of file diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/difference.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/difference.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -colorize("state", "same", white); -colorize("state", "changed", orange); -colorize("state", "new", green); -colorize("state", "deleted", red); diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/matchingFlags.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/matchingFlags.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -colorize("is_dontcare", "false", white); -colorize("is_shared", "true", green); -colorize("is_dontcare", "true", red); diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/onlyControlFlow.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/onlyControlFlow.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -var f = new RemoveFilter("Show only control flow"); -f.addRule( - new RemoveFilter.RemoveRule( - new InvertSelector( - new OrSelector( - new OrSelector( - new SuccessorSelector( - new MatcherSelector( - new Properties.StringPropertyMatcher("type", "control") - ) - ), - new MatcherSelector( - new Properties.StringPropertyMatcher("type", "control") - ) - ), - new MatcherSelector( - new Properties.StringPropertyMatcher("name", "Start") - ) - ) - ), false - ) -); -f.addRule(new RemoveFilter.RemoveRule(new MatcherSelector(new Properties.RegexpPropertyMatcher("name", "Phi|Store.")))); -f.apply(graph); \ No newline at end of file diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/register.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/register.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -// Register coloring -colorize("reg", "EAX", green); -colorize("reg", "EFLAGS", gray); -colorize("reg", "EBP", orange); -colorize("reg", "ECX", cyan); \ No newline at end of file diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/remove.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/remove.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -remove("dump_spec", "FramePtr|ReturnAdr|I_O"); -removeInputs("name", "Root"); -var f = new RemoveSelfLoopsFilter("Remove Self-Loops"); -f.apply(graph); -removeInputs("name", "SafePoint|CallStaticJava|CallDynamicJava|CallJava|CallLeaf|CallRuntime|AbstractLock|CallLeafNoFP|Call|CallStaticJavaDirect", 5); -removeInputs("name", "Unlock|Lock", 7); -removeInputs("name", "Allocate", 7); -removeInputs("name", "AllocateArray", 9); \ No newline at end of file diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/structural.filter --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/filters/structural.filter Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -var f = new CombineFilter("Combine Filter"); -f.addRule(new CombineFilter.CombineRule(new Properties.RegexpPropertyMatcher("name", ".*"), new Properties.RegexpPropertyMatcher("name", "Proj|IfFalse|IfTrue|JProj|MachProj|JumpProj|CatchProj"))); -f.addRule(new CombineFilter.CombineRule(new Properties.RegexpPropertyMatcher("name", "Cmp.*"), new Properties.RegexpPropertyMatcher("name", "Bool"))); -f.apply(graph); -split("name", "BoxLock"); -split("name", "(Con.*)|(loadCon.*)", "[dump_spec]"); \ No newline at end of file diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/layer.xml --- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/layer.xml Sat Feb 04 21:12:50 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Snapshots/manifest.mf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Snapshots/manifest.mf Sat Feb 04 21:41:02 2012 +0100 @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: com.oracle.graal.visualizer.snapshots +OpenIDE-Module-Localizing-Bundle: com/oracle/graal/visualizer/snapshots/Bundle.properties +OpenIDE-Module-Requires: org.openide.windows.WindowManager +OpenIDE-Module-Specification-Version: 1.0 + diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/Bundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/Bundle.properties Sat Feb 04 21:41:02 2012 +0100 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Snapshots diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/SnapshotTopComponent.form --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/SnapshotTopComponent.form Sat Feb 04 21:41:02 2012 +0100 @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/SnapshotTopComponent.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Snapshots/src/com/oracle/graal/visualizer/snapshots/SnapshotTopComponent.java Sat Feb 04 21:41:02 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +package com.oracle.graal.visualizer.snapshots; + +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.windows.TopComponent; + +@TopComponent.Description(preferredID = "SnapshotTopComponent", +persistenceType = TopComponent.PERSISTENCE_NEVER) +@TopComponent.Registration(mode = "output", openAtStartup = true) +@ActionID(category = "Window", id = "com.oracle.graal.visualizer.snapshots.SnapshotTopComponent") +@ActionReference(path = "Menu/Window") +@TopComponent.OpenActionRegistration(displayName = "Snapshot", preferredID = "SnapshotTopComponent") +public final class SnapshotTopComponent extends TopComponent { + + public SnapshotTopComponent() { + initComponents(); + setName("Snapshot Window"); + setToolTipText("This is a Snapshot window"); + } + + /** + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml Sat Feb 04 21:12:50 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/Util/nbproject/project.xml Sat Feb 04 21:41:02 2012 +0100 @@ -1,55 +1,63 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.util - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - org.netbeans.api.visual - - - - 2.27.1 - - - - org.openide.nodes - - - - 7.20.1 - - - - org.openide.util - - - - 8.14.1 - - - - org.openide.util.lookup - - - - 8.6.1 - - - - - com.sun.hotspot.igv.util - - - - + + + org.netbeans.modules.apisupport.project + + + com.sun.hotspot.igv.util + + + + com.sun.hotspot.igv.data + + + + 1.0 + + + + org.netbeans.api.visual + + + + 2.27.1 + + + + org.openide.nodes + + + + 7.20.1 + + + + org.openide.util + + + + 8.14.1 + + + + org.openide.util.lookup + + + + 8.6.1 + + + + org.openide.windows + + + + 6.48.1 + + + + + com.sun.hotspot.igv.util + + + + diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/Util/src/com/oracle/graal/visualizer/util/LookupUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Util/src/com/oracle/graal/visualizer/util/LookupUtils.java Sat Feb 04 21:41:02 2012 +0100 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package com.oracle.graal.visualizer.util; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.openide.util.Lookup; +import org.openide.util.Lookup.Provider; +import org.openide.util.lookup.Lookups; +import org.openide.windows.TopComponent; + +/** + * Utilities that build upon the Lookup API. + */ +public class LookupUtils { + + + /** + * Creates a new lookup that will delegate to the last open window of a specified top component class. If the window is closed, the lookup will be empty. + * @param clazz the class identifying the top component type + * @return a delegating lookup + */ + public static Lookup getLastActiveDelegatingLookup(Class clazz) { + final TopComponentLookup topComponentLookupImpl = new TopComponentLookup(clazz); + TopComponent.getRegistry().addPropertyChangeListener(topComponentLookupImpl); + return topComponentLookupImpl.lookup; + } + + private static class TopComponentLookup implements PropertyChangeListener { + private final Class clazz; + private final Lookup lookup; + private TopComponent lastActive; + + private final Provider lookupProvider = new Provider() { + + @Override + public Lookup getLookup() { + if (lastActive == null) { + return Lookup.EMPTY; + } else { + return lastActive.getLookup(); + } + } + }; + + public TopComponentLookup(Class clazz) { + this.clazz = clazz; + lookup = Lookups.proxy(lookupProvider); + update(); + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + update(); + } + + private void update() { + TopComponent curActivated = TopComponent.getRegistry().getActivated(); + if (curActivated != lastActive) { + if (clazz.isAssignableFrom(curActivated.getClass())) { + // We have a new top component for our lookup. + lastActive = curActivated; + refreshLookup(); + } else { + // We have no new top component. Check if the old one is still opened. + if (lastActive != null && !TopComponent.getRegistry().getOpened().contains(lastActive)) { + // The top component was closed => Remove lookup. + lastActive = null; + refreshLookup(); + } + } + } + } + + private void refreshLookup() { + lookup.lookup(Object.class); + } + }; +} diff -r de4e6eb7265b -r b995eee36970 src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Sat Feb 04 21:12:50 2012 +0100 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Sat Feb 04 21:41:02 2012 +0100 @@ -15,14 +15,15 @@ ${project.com.sun.hotspot.igv.settings}:\ ${project.com.sun.hotspot.igv.util}:\ ${project.com.sun.hotspot.igv.svg}:\ - ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ ${project.com.sun.hotspot.igv.filterwindow}:\ ${project.com.sun.hotspot.igv.graal}:\ ${project.at.ssw.visualizer.cfg}:\ ${project.org.eclipse.draw2d}:\ - ${project.com.oracle.graal.visualizer.editor} + ${project.com.oracle.graal.visualizer.editor}:\ + ${project.com.oracle.graal.visualizer.snapshots} project.at.ssw.visualizer.cfg=ControlFlowEditor project.com.oracle.graal.visualizer.editor=Editor +project.com.oracle.graal.visualizer.snapshots=Snapshots project.com.sun.hotspot.igv.bytecodes=Bytecodes project.com.oracle.graal.visualizer.outline=Outline project.com.sun.hotspot.igv.data=Data @@ -33,7 +34,6 @@ project.com.sun.hotspot.igv.graph=Graph project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler project.com.sun.hotspot.igv.settings=Settings project.com.sun.hotspot.igv.svg=BatikSVGProxy project.com.sun.hotspot.igv.view=View