Mercurial > hg > truffle
annotate graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java @ 2994:7ed943d4d730
Fix checkstyle issues.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Thu, 16 Jun 2011 13:44:57 +0200 |
parents | cbece91420af |
children | 53dcb0794619 |
rev | line source |
---|---|
2549
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
1 /* |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2549
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
4 * |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
7 * published by the Free Software Foundation. |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
8 * |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
13 * accompanied this code). |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
14 * |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
18 * |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
21 * questions. |
c12715ca2cc7
Added Oracle header. Moved author declaration into package-info.java file.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2542
diff
changeset
|
22 */ |
2874
d90bf514d647
Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2872
diff
changeset
|
23 package com.oracle.max.graal.graph; |
2542
7a0e1bd2bb64
Draft for graph classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff
changeset
|
24 |
7a0e1bd2bb64
Draft for graph classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff
changeset
|
25 import java.util.ArrayList; |
7a0e1bd2bb64
Draft for graph classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff
changeset
|
26 import java.util.Collections; |
2787
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
27 import java.util.HashMap; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
28 import java.util.List; |
2787
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
29 import java.util.Map; |
2542
7a0e1bd2bb64
Draft for graph classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff
changeset
|
30 |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2674
diff
changeset
|
31 public abstract class Node { |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
32 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
33 public static final Node Null = null; |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
34 public static final int DeletedID = -1; |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
35 |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
36 final Graph graph; |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
37 private int id; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
38 final NodeArray inputs; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
39 final NodeArray successors; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
40 final ArrayList<Node> usages; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
41 final ArrayList<Node> predecessors; |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
42 |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
43 public Node(int inputCount, int successorCount, Graph graph) { |
2875
3570f1f7903e
Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
44 assert graph != null : "cannot create a node for a null graph"; |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
45 this.graph = graph; |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
46 this.id = graph.register(this); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
47 this.inputs = new NodeArray(this, inputCount); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
48 this.successors = new NodeArray(this, successorCount); |
2973
ca2d8e027110
Adjusted default capacity of predecessor and usage array.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2972
diff
changeset
|
49 this.predecessors = new ArrayList<Node>(1); |
ca2d8e027110
Adjusted default capacity of predecessor and usage array.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2972
diff
changeset
|
50 this.usages = new ArrayList<Node>(4); |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
51 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
52 |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
53 public List<Node> predecessors() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
54 return Collections.unmodifiableList(predecessors); |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
55 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
56 |
2758
0c5791bc90fb
More on scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
57 public List<Node> usages() { |
0c5791bc90fb
More on scheduling.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
58 return Collections.unmodifiableList(usages); |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
59 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
60 |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
61 public NodeArray inputs() { |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
62 return inputs; |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
63 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
64 |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
65 public NodeArray successors() { |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
66 return successors; |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
67 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
68 |
2554
9db994445118
more tests for GraalGraph, some changes and fixes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2550
diff
changeset
|
69 public int id() { |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
70 return id; |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
71 } |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
72 |
2554
9db994445118
more tests for GraalGraph, some changes and fixes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2550
diff
changeset
|
73 public Graph graph() { |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
74 return graph; |
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
75 } |
2542
7a0e1bd2bb64
Draft for graph classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff
changeset
|
76 |
2839
87018b9c8304
Added Op and Phase class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2831
diff
changeset
|
77 public <T extends Op> T lookup(Class<T> clazz) { |
2831
f072013daba9
Added lookup method.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2792
diff
changeset
|
78 return null; |
f072013daba9
Added lookup method.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2792
diff
changeset
|
79 } |
f072013daba9
Added lookup method.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2792
diff
changeset
|
80 |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2584
diff
changeset
|
81 public String shortName() { |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2584
diff
changeset
|
82 return getClass().getSimpleName(); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2584
diff
changeset
|
83 } |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2584
diff
changeset
|
84 |
2791
6d14aa4fbf90
Gotos removed (except for exception dispatch chains and edge splitting).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2790
diff
changeset
|
85 public Node replace(Node other) { |
6d14aa4fbf90
Gotos removed (except for exception dispatch chains and edge splitting).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2790
diff
changeset
|
86 assert !isDeleted() && (other == null || !other.isDeleted()); |
2558
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
87 assert other == null || other.graph == graph; |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
88 for (Node usage : usages) { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
89 usage.inputs.replaceFirstOccurrence(this, other); |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
90 } |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2759
diff
changeset
|
91 int z = 0; |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
92 for (Node predecessor : predecessors) { |
2994
7ed943d4d730
Fix checkstyle issues.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2975
diff
changeset
|
93 for (int i = 0; i < predecessor.successors.size(); i++) { |
2972
c7ce8d00c33f
Removed predecessorIndex array from the Node base class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2969
diff
changeset
|
94 if (predecessor.successors.get(i) == this) { |
c7ce8d00c33f
Removed predecessorIndex array from the Node base class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2969
diff
changeset
|
95 predecessor.successors.silentSet(i, other); |
c7ce8d00c33f
Removed predecessorIndex array from the Node base class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2969
diff
changeset
|
96 } |
c7ce8d00c33f
Removed predecessorIndex array from the Node base class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2969
diff
changeset
|
97 } |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2759
diff
changeset
|
98 ++z; |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
99 } |
2558
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
100 if (other != null) { |
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
101 other.usages.addAll(usages); |
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
102 other.predecessors.addAll(predecessors); |
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
103 } |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
104 usages.clear(); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
105 predecessors.clear(); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
106 delete(); |
2791
6d14aa4fbf90
Gotos removed (except for exception dispatch chains and edge splitting).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2790
diff
changeset
|
107 return other; |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
108 } |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
109 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
110 public boolean isDeleted() { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
111 return id == DeletedID; |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
112 } |
2888
224412c24426
Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2880
diff
changeset
|
113 |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
114 public void forceDelete() { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
115 for (Node n : usages) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
116 n.inputs.silentRemove(this); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
117 } |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
118 for (Node n : predecessors) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
119 n.successors.silentRemove(this); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
120 } |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
121 usages.clear(); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
122 predecessors.clear(); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2875
diff
changeset
|
123 } |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
124 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
125 public void delete() { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
126 assert !isDeleted(); |
2966
0048537e3cd7
Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2961
diff
changeset
|
127 assert checkDeletion() : "Could not delete " + this; |
2975 | 128 |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
129 for (int i = 0; i < inputs.size(); ++i) { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
130 inputs.set(i, Null); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
131 } |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
132 for (int i = 0; i < successors.size(); ++i) { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
133 successors.set(i, Null); |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
134 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2616
diff
changeset
|
135 assert predecessors().size() == 0 && usages().size() == 0; |
2558
98eef19a381c
Fixed delete() method
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2557
diff
changeset
|
136 // make sure its not connected. pred usages |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
137 graph.unregister(this); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
138 id = DeletedID; |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
139 assert isDeleted(); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
140 } |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
141 |
2935
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
142 private boolean checkDeletion() { |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
143 if (usages.size() != 0 || predecessors.size() != 0) { |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
144 System.out.println(this.shortName() + ", id: " + id + ", usages: " + usages.size() + ", predecessors: " + predecessors().size()); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
145 System.out.println("usages:"); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
146 for (Node n : usages()) { |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
147 System.out.print(n.id() + " (" + n.shortName() + ") "); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
148 } |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
149 System.out.println("\npreds:"); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
150 for (Node n : predecessors()) { |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
151 System.out.print(n.id() + " (" + n.shortName() + ") "); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
152 } |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
153 System.out.println(); |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
154 return false; |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
155 } |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
156 return true; |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
157 } |
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2888
diff
changeset
|
158 |
2557
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
159 public Node copy() { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
160 return copy(graph); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
161 } |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
162 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
163 /** |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
164 * |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
165 * @param into |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
166 * @return |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
167 */ |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
168 public abstract Node copy(Graph into); |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
169 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
170 /** |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
171 * |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
172 * @return |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
173 */ |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
174 protected int inputCount() { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
175 return 0; |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
176 } |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
177 |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
178 /** |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
179 * |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
180 * @return |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
181 */ |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
182 protected int successorCount() { |
f14f8c24f77d
Node and Graph design changes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2556
diff
changeset
|
183 return 0; |
2550
d9b2a8653054
Enabled checkstyle for the GraalGraph project. Fixed checkstyle errors. Set correct code formatter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2549
diff
changeset
|
184 } |
2556
590c2f6a0c4f
Checkstyle fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2554
diff
changeset
|
185 |
2787
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
186 /** |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
187 * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the ideal graph |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
188 * visualizer). Subclasses overriding this method should add to the map returned by their superclass. |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
189 */ |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
190 public Map<Object, Object> getDebugProperties() { |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
191 Map<Object, Object> map = new HashMap<Object, Object>(); |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
192 map.put("inputCount", inputCount()); |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
193 map.put("usageCount", usages.size()); |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
194 map.put("successorCount", successorCount()); |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
195 map.put("predecessorCount", predecessors.size()); |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
196 return map; |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
197 } |
9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
Peter Hofer <peter.hofer@jku.at>
parents:
2759
diff
changeset
|
198 |
2559
46eab5817cc2
Modified assert in NodeArray.set method (also helps with a compilation issue in ECJ)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2558
diff
changeset
|
199 @Override |
46eab5817cc2
Modified assert in NodeArray.set method (also helps with a compilation issue in ECJ)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2558
diff
changeset
|
200 public String toString() { |
46eab5817cc2
Modified assert in NodeArray.set method (also helps with a compilation issue in ECJ)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2558
diff
changeset
|
201 return this.getClass().getSimpleName() + "-" + this.id(); |
46eab5817cc2
Modified assert in NodeArray.set method (also helps with a compilation issue in ECJ)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2558
diff
changeset
|
202 } |
2556
590c2f6a0c4f
Checkstyle fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2554
diff
changeset
|
203 } |