annotate agent/src/share/classes/sun/jvm/hotspot/opto/Node.java @ 17467:55fb97c4c58d hs25-b65

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
author mikael
date Tue, 24 Dec 2013 11:48:39 -0800
parents 79f492f184d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3939
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
1 /*
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
4 *
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
7 * published by the Free Software Foundation.
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
8 *
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
13 * accompanied this code).
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
14 *
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
18 *
7440
79f492f184d0 8004982: JDK8 source with GPL header errors
katleman
parents: 3939
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
79f492f184d0 8004982: JDK8 source with GPL header errors
katleman
parents: 3939
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
79f492f184d0 8004982: JDK8 source with GPL header errors
katleman
parents: 3939
diff changeset
21 * questions.
3939
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
22 *
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
23 */
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
24
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
25 package sun.jvm.hotspot.opto;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
26
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
27 import java.io.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
28 import java.lang.reflect.Constructor;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
29 import java.util.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
30 import sun.jvm.hotspot.debugger.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
31 import sun.jvm.hotspot.runtime.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
32 import sun.jvm.hotspot.oops.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
33 import sun.jvm.hotspot.types.*;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
34
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
35 public class Node extends VMObject {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
36 static {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
37 VM.registerVMInitializedObserver(new Observer() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
38 public void update(Observable o, Object data) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
39 initialize(VM.getVM().getTypeDataBase());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
40 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
41 });
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
42 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
43
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
44 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
45 Type type = db.lookupType("Node");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
46 outmaxField = new CIntField(type.getCIntegerField("_outmax"), 0);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
47 outcntField = new CIntField(type.getCIntegerField("_outcnt"), 0);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
48 maxField = new CIntField(type.getCIntegerField("_max"), 0);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
49 cntField = new CIntField(type.getCIntegerField("_cnt"), 0);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
50 idxField = new CIntField(type.getCIntegerField("_idx"), 0);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
51 outField = type.getAddressField("_out");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
52 inField = type.getAddressField("_in");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
53
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
54 nodeType = db.lookupType("Node");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
55
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
56 virtualConstructor = new VirtualBaseConstructor(db, nodeType, "sun.jvm.hotspot.opto", Node.class);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
57 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
58
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
59 private static CIntField outmaxField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
60 private static CIntField outcntField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
61 private static CIntField maxField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
62 private static CIntField cntField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
63 private static CIntField idxField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
64 private static AddressField outField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
65 private static AddressField inField;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
66
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
67 private static VirtualBaseConstructor virtualConstructor;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
68
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
69 private static Type nodeType;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
70
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
71 static HashMap nodes = new HashMap();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
72
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
73 static HashMap constructors = new HashMap();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
74
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
75 static abstract class Instantiator {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
76 abstract Node create(Address addr);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
77 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
78
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
79 static public Node create(Address addr) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
80 if (addr == null) return null;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
81 Node result = (Node)nodes.get(addr);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
82 if (result == null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
83 result = (Node)virtualConstructor.instantiateWrapperFor(addr);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
84 nodes.put(addr, result);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
85 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
86 return result;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
87 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
88
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
89 public Node(Address addr) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
90 super(addr);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
91 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
92
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
93 public int outcnt() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
94 return (int)outcntField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
95 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
96
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
97 public int req() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
98 return (int)cntField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
99 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
100
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
101 public int len() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
102 return (int)maxField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
103 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
104
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
105 public int idx() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
106 return (int)idxField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
107 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
108
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
109 private Node[] _out;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
110 private Node[] _in;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
111
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
112 public Node rawOut(int i) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
113 if (_out == null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
114 int addressSize = (int)VM.getVM().getAddressSize();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
115 _out = new Node[outcnt()];
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
116 Address ptr = outField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
117 for (int j = 0; j < outcnt(); j++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
118 _out[j] = Node.create(ptr.getAddressAt(j * addressSize));
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
119 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
120 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
121 return _out[i];
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
122 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
123
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
124 public Node in(int i) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
125 if (_in == null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
126 int addressSize = (int)VM.getVM().getAddressSize();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
127 _in = new Node[len()];
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
128 Address ptr = inField.getValue(this.getAddress());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
129 for (int j = 0; j < len(); j++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
130 _in[j] = Node.create(ptr.getAddressAt(j * addressSize));
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
131 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
132 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
133 return _in[i];
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
134 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
135
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
136 public ArrayList collect(int d, boolean onlyCtrl) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
137 int depth = Math.abs(d);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
138 ArrayList nstack = new ArrayList();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
139 BitSet set = new BitSet();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
140
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
141 nstack.add(this);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
142 set.set(idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
143 int begin = 0;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
144 int end = 0;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
145 for (int i = 0; i < depth; i++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
146 end = nstack.size();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
147 for(int j = begin; j < end; j++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
148 Node tp = (Node)nstack.get(j);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
149 int limit = d > 0 ? tp.len() : tp.outcnt();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
150 for(int k = 0; k < limit; k++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
151 Node n = d > 0 ? tp.in(k) : tp.rawOut(k);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
152
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
153 // if (NotANode(n)) continue;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
154 if (n == null) continue;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
155 // do not recurse through top or the root (would reach unrelated stuff)
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
156 // if (n.isRoot() || n.isTop()) continue;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
157 // if (onlyCtrl && !n.isCfg()) continue;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
158
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
159 if (!set.get(n.idx())) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
160 nstack.add(n);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
161 set.set(n.idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
162 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
163 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
164 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
165 begin = end;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
166 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
167 return nstack;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
168 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
169
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
170 protected void dumpNodes(Node s, int d, boolean onlyCtrl, PrintStream out) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
171 if (s == null) return;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
172
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
173 ArrayList nstack = s.collect(d, onlyCtrl);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
174 int end = nstack.size();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
175 if (d > 0) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
176 for(int j = end-1; j >= 0; j--) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
177 ((Node)nstack.get(j)).dump(out);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
178 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
179 } else {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
180 for(int j = 0; j < end; j++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
181 ((Node)nstack.get(j)).dump(out);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
182 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
183 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
184 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
185
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
186 public void dump(int depth, PrintStream out) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
187 dumpNodes(this, depth, false, out);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
188 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
189
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
190 public String Name() {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
191 Type t = VM.getVM().getTypeDataBase().findDynamicTypeForAddress(getAddress(), nodeType);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
192 String name = null;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
193 if (t != null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
194 name = t.toString();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
195 } else {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
196 Class c = getClass();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
197 if (c == Node.class) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
198 // couldn't identify class type
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
199 return "UnknownNode<" + getAddress().getAddressAt(0) + ">";
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
200 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
201 name = getClass().getName();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
202 if (name.startsWith("sun.jvm.hotspot.opto.")) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
203 name = name.substring("sun.jvm.hotspot.opto.".length());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
204 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
205 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
206 if (name.endsWith("Node")) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
207 return name.substring(0, name.length() - 4);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
208 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
209 return name;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
210 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
211
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
212 public void dump(PrintStream out) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
213 out.print(" ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
214 out.print(idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
215 out.print("\t");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
216 out.print(Name());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
217 out.print("\t=== ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
218 int i = 0;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
219 for (i = 0; i < req(); i++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
220 Node n = in(i);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
221 if (n != null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
222 out.print(' ');
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
223 out.print(in(i).idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
224 } else {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
225 out.print("_");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
226 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
227 out.print(" ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
228 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
229 if (len() != req()) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
230 int prec = 0;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
231 for (; i < len(); i++) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
232 Node n = in(i);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
233 if (n != null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
234 if (prec++ == 0) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
235 out.print("| ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
236 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
237 out.print(in(i).idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
238 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
239 out.print(" ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
240 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
241 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
242 dumpOut(out);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
243 dumpSpec(out);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
244 out.println();
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
245 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
246
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
247 void dumpOut(PrintStream out) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
248 // Delimit the output edges
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
249 out.print(" [[");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
250 // Dump the output edges
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
251 for (int i = 0; i < outcnt(); i++) { // For all outputs
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
252 Node u = rawOut(i);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
253 if (u == null) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
254 out.print("_ ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
255 // } else if (NotANode(u)) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
256 // out.print("NotANode ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
257 } else {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
258 // out.print("%c%d ", Compile::current()->nodeArena()->contains(u) ? ' ' : 'o', u->_idx);
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
259 out.print(' ');
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
260 out.print(u.idx());
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
261 out.print(' ');
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
262 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
263 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
264 out.print("]] ");
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
265 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
266
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
267 public void dumpSpec(PrintStream out) {
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
268 }
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents:
diff changeset
269 }