Mercurial > hg > truffle
comparison visualizer/Graal/src/com/sun/hotspot/igv/graal/filters/GraalCFGFilter.java @ 4512:015fb895586b
Moved visualizer to new directory.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 07 Feb 2012 22:41:09 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4511:6cb549627941 | 4512:015fb895586b |
---|---|
1 /* | |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 package com.sun.hotspot.igv.graal.filters; | |
25 | |
26 import com.sun.hotspot.igv.data.Properties; | |
27 import com.sun.hotspot.igv.filter.AbstractFilter; | |
28 import com.sun.hotspot.igv.graph.Connection; | |
29 import com.sun.hotspot.igv.graph.Diagram; | |
30 import com.sun.hotspot.igv.graph.Figure; | |
31 import com.sun.hotspot.igv.graph.InputSlot; | |
32 import java.util.HashSet; | |
33 import java.util.Set; | |
34 | |
35 public class GraalCFGFilter extends AbstractFilter { | |
36 | |
37 @Override | |
38 public String getName() { | |
39 return "Graal CFG Filter"; | |
40 } | |
41 | |
42 @Override | |
43 public void apply(Diagram d) { | |
44 Set<Figure> figuresToRemove = new HashSet<>(); | |
45 Set<Connection> connectionsToRemove = new HashSet<>(); | |
46 for (Figure f : d.getFigures()) { | |
47 final String prop = f.getProperties().get("probability"); | |
48 | |
49 if (prop == null) { | |
50 figuresToRemove.add(f); | |
51 } | |
52 } | |
53 d.removeAllFigures(figuresToRemove); | |
54 | |
55 for (Figure f : d.getFigures()) { | |
56 Properties p = f.getProperties(); | |
57 int predCount = Integer.parseInt(p.get("predecessorCount")); | |
58 for (InputSlot is : f.getInputSlots()) { | |
59 if (is.getPosition() >= predCount && !"EndNode".equals(is.getProperties().get("class"))) { | |
60 for (Connection c : is.getConnections()) { | |
61 if (!"EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))) { | |
62 connectionsToRemove.add(c); | |
63 } | |
64 } | |
65 } | |
66 } | |
67 } | |
68 | |
69 for (Connection c : connectionsToRemove) { | |
70 c.remove(); | |
71 System.out.println("rm " + c); | |
72 } | |
73 } | |
74 } |