Mercurial > hg > truffle
annotate graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java @ 7123:b914b9b4c578
graal.graph refactorings
Common out NodeInputsIterable and NodeSuccessorsIterable
Remove NodeUsagesList.size, use .count instead
Change return type of Node.usages to NodeIterable<Node>
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 03 Dec 2012 13:53:53 +0100 |
parents | 768793150bcd |
children | 9bee93f61522 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.graph; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
24 import java.lang.reflect.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.util.*; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
26 import java.util.Map.Entry; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
28 import com.oracle.graal.graph.Graph.DuplicationReplacement; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
29 import com.oracle.graal.graph.Node.Verbosity; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
30 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
31 public class NodeClass extends FieldIntrospection { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
32 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
33 public static final NodeClass get(Class<?> c) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
34 NodeClass clazz = (NodeClass) allClasses.get(c); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
35 if (clazz != null) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
36 return clazz; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
37 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
38 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
39 // We can have a race of multiple threads creating the LIRInstructionClass at the same time. |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
40 // However, only one will be put into the map, and this is the one returned by all threads. |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
41 clazz = new NodeClass(c); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
42 NodeClass oldClazz = (NodeClass) allClasses.putIfAbsent(c, clazz); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
43 if (oldClazz != null) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
44 return oldClazz; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
45 } else { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
46 return clazz; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
47 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
48 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 public static final int NOT_ITERABLE = -1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
53 private static final Class<?> NODE_CLASS = Node.class; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
54 private static final Class<?> INPUT_LIST_CLASS = NodeInputList.class; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
55 private static final Class<?> SUCCESSOR_LIST_CLASS = NodeSuccessorList.class; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 private static int nextIterableId = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 private final int directInputCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 private final long[] inputOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 private final int directSuccessorCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 private final long[] successorOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 private final Class<?>[] dataTypes; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 private final boolean canGVN; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 private final int startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 private final String shortName; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
67 private final String nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 private final int iterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
71 public NodeClass(Class<?> clazz) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
72 super(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 assert NODE_CLASS.isAssignableFrom(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 FieldScanner scanner = new FieldScanner(new DefaultCalcOffset()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 directInputCount = scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 inputOffsets = sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 directSuccessorCount = scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 successorOffsets = sortedLongCopy(scanner.successorOffsets, scanner.successorListOffsets); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
82 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
83 dataOffsets = sortedLongCopy(scanner.dataOffsets); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
84 dataTypes = new Class[dataOffsets.length]; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
85 for (int i = 0; i < dataOffsets.length; i++) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
86 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
88 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
89 fieldNames = scanner.fieldNames; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
90 fieldTypes = scanner.fieldTypes; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 startGVNNumber = clazz.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
95 String newShortName = clazz.getSimpleName(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
96 if (newShortName.endsWith("Node") && !newShortName.equals("StartNode") && !newShortName.equals("EndNode")) { |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
97 newShortName = newShortName.substring(0, newShortName.length() - 4); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
99 String newNameTemplate = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 NodeInfo info = clazz.getAnnotation(NodeInfo.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 if (info != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 if (!info.shortName().isEmpty()) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
103 newShortName = info.shortName(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
105 if (!info.nameTemplate().isEmpty()) { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
106 newNameTemplate = info.nameTemplate(); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
107 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
109 this.nameTemplate = newNameTemplate == null ? newShortName : newNameTemplate; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
110 this.shortName = newShortName; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 if (Node.IterableNodeType.class.isAssignableFrom(clazz)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 this.iterableId = nextIterableId++; |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4142
diff
changeset
|
113 // TODO (lstadler) add type hierarchy - based node iteration |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 // for (NodeClass nodeClass : nodeClasses.values()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 // if (clazz.isAssignableFrom(nodeClass.clazz)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 // throw new UnsupportedOperationException("iterable non-final Node classes not supported: " + clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 // } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 // } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 this.iterableId = NOT_ITERABLE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
124 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
125 protected void rescanFieldOffsets(CalcOffset calc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 FieldScanner scanner = new FieldScanner(calc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 assert directInputCount == scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 copyInto(inputOffsets, sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 assert directSuccessorCount == scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 copyInto(successorOffsets, sortedLongCopy(scanner.successorOffsets, scanner.successorListOffsets)); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
132 copyInto(dataOffsets, sortedLongCopy(scanner.dataOffsets)); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
133 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
134 for (int i = 0; i < dataOffsets.length; i++) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
135 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
138 fieldNames.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
139 fieldNames.putAll(scanner.fieldNames); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
140 fieldTypes.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
141 fieldTypes.putAll(scanner.fieldTypes); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 public String shortName() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 return shortName; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 public int iterableId() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 return iterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 public boolean valueNumberable() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 return canGVN; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 public static int cacheSize() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 return nextIterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
160 protected static class FieldScanner extends BaseFieldScanner { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
161 public final ArrayList<Long> inputOffsets = new ArrayList<>(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
162 public final ArrayList<Long> inputListOffsets = new ArrayList<>(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
163 public final ArrayList<Long> successorOffsets = new ArrayList<>(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
164 public final ArrayList<Long> successorListOffsets = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
166 protected FieldScanner(CalcOffset calc) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
167 super(calc); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
170 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
171 protected void scanField(Field field, Class<?> type, long offset) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
172 if (field.isAnnotationPresent(Node.Input.class)) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
173 assert !field.isAnnotationPresent(Node.Successor.class) : "field cannot be both input and successor"; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
174 if (INPUT_LIST_CLASS.isAssignableFrom(type)) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
175 inputListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
176 } else { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
177 assert NODE_CLASS.isAssignableFrom(type) : "invalid input type: " + type; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
178 inputOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
179 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
180 if (field.getAnnotation(Node.Input.class).notDataflow()) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
181 fieldNames.put(offset, field.getName() + "#NDF"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
183 } else if (field.isAnnotationPresent(Node.Successor.class)) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
184 if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
185 successorListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
186 } else { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
187 assert NODE_CLASS.isAssignableFrom(type) : "invalid successor type: " + type; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
188 successorOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
189 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
190 } else { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
191 assert !NODE_CLASS.isAssignableFrom(type) || field.getName().equals("Null") : "suspicious node field: " + field; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
192 assert !INPUT_LIST_CLASS.isAssignableFrom(type) : "suspicious node input list field: " + field; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
193 assert !SUCCESSOR_LIST_CLASS.isAssignableFrom(type) : "suspicious node successor list field: " + field; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
194 dataOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
195 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
199 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 StringBuilder str = new StringBuilder(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 str.append("NodeClass ").append(clazz.getSimpleName()).append(" ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 for (int i = 0; i < inputOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 str.append(i == 0 ? "" : ", ").append(inputOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 for (int i = 0; i < successorOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 str.append(i == 0 ? "" : ", ").append(successorOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 for (int i = 0; i < dataOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 str.append(i == 0 ? "" : ", ").append(dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 str.append("]"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 return str.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
219 /** |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
220 * Describes an edge slot for a {@link NodeClass}. |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
221 * @see NodeClass#get(Node, Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
222 * @see NodeClass#getName(Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
223 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 public static final class Position { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 public final boolean input; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 public final int index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 public final int subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 public Position(boolean input, int index, int subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 this.input = input; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 this.index = index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 this.subIndex = subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 return (input ? "input " : "successor ") + index + "/" + subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 public Node get(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 return node.getNodeClass().get(node, this); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 public void set(Node node, Node value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 node.getNodeClass().set(node, this, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 |
5214 | 248 public boolean isValidFor(Node node, Node from) { |
249 return node.getNodeClass().isValid(this, from.getNodeClass()); | |
250 } | |
251 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 public int hashCode() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 final int prime = 31; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 int result = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 result = prime * result + index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 result = prime * result + (input ? 1231 : 1237); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 result = prime * result + subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 public boolean equals(Object obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 if (this == obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 if (obj == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 if (getClass() != obj.getClass()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 Position other = (Position) obj; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 if (index != other.index) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 if (input != other.input) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 if (subIndex != other.subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 private static Node getNode(Node node, long offset) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
288 return (Node) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 @SuppressWarnings("unchecked") |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 private static NodeList<Node> getNodeList(Node node, long offset) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 return (NodeList<Node>) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 private static void putNode(Node node, long offset, Node value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 private static void putNodeList(Node node, long offset, NodeList value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
301 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 /** |
5711
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
305 * An iterator that will iterate over the fields given in {@link #offsets}. |
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
306 * The first {@link #directCount} offsets are treated as fields of type {@link Node}, |
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
307 * while the rest of the fields are treated as {@link NodeList}s. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 * All elements of these NodeLists will be visited by the iterator as well. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 * This iterator can be used to iterate over the inputs or successors of a node. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 * An iterator of this type will not return null values, unless the field values are modified concurrently. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 * Concurrent modifications are detected by an assertion on a best-effort basis. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
313 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 public static final class NodeClassIterator implements Iterator<Node> { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 private final Node node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 private final int modCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 private final int directCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 private final long[] offsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 private int index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 private int subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 * Creates an iterator that will iterate over fields in the given node. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
325 * @param node the node which contains the fields. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
326 * @param offsets the offsets of the fields. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 * @param directCount the number of fields that should be treated as fields of type {@link Node}, the rest are treated as {@link NodeList}s. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 private NodeClassIterator(Node node, long[] offsets, int directCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 this.node = node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
331 this.modCount = node.modCount(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 this.offsets = offsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
333 this.directCount = directCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 index = NOT_ITERABLE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
335 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
336 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
337 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
338 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 private void forward() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 if (index < directCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 while (index < directCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 Node element = getNode(node, offsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 if (element != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
351 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 while (index < offsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 NodeList<Node> list = getNodeList(node, offsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 while (subIndex < list.size()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 if (list.get(subIndex) != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
365 private Node nextElement() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 if (index < directCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 return getNode(node, offsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
368 } else if (index < offsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 NodeList<Node> list = getNodeList(node, offsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 return list.get(subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
372 return null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
373 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 public boolean hasNext() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 return index < offsets.length; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 assert modCount == node.modCount() : "must not be modified"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
382 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
385 public Node next() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 return nextElement(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 assert modCount == node.modCount(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 public Position nextPosition() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 if (index < directCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 return new Position(offsets == node.getNodeClass().inputOffsets, index, NOT_ITERABLE); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 return new Position(offsets == node.getNodeClass().inputOffsets, index, subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 assert modCount == node.modCount(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 public void remove() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 public int valueNumber(Node n) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 int number = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 if (canGVN) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 number = startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 for (int i = 0; i < dataOffsets.length; ++i) { |
6657
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
418 Class< ? > type = dataTypes[i]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 int intValue = unsafe.getInt(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 number += intValue; |
6657
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
423 } else if (type == Long.TYPE) { |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
424 long longValue = unsafe.getLong(n, dataOffsets[i]); |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
425 number += longValue ^ (longValue >>> 32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 boolean booleanValue = unsafe.getBoolean(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 if (booleanValue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 number += 7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 assert false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 Object o = unsafe.getObject(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 if (o != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 number += o.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 number *= 13; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 return number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 /** |
5711
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
447 * Populates a given map with the names and values of all data fields. |
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
448 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 * @param node the node from which to take the values. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
450 * @param properties a map that will be populated. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
451 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
452 public void getDebugProperties(Node node, Map<Object, Object> properties) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 for (int i = 0; i < dataOffsets.length; ++i) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
454 Class<?> type = fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
455 Object value = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 value = unsafe.getInt(node, dataOffsets[i]); |
5361
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
459 } else if (type == Long.TYPE) { |
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
460 value = unsafe.getLong(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 value = unsafe.getBoolean(node, dataOffsets[i]); |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
463 } else if (type == Long.TYPE) { |
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
464 value = unsafe.getLong(node, dataOffsets[i]); |
5287
e96c8d2925da
let NodeClass.getDebugProperties handle arrays and doubles
Lukas Stadler <lukas.stadler@jku.at>
parents:
5261
diff
changeset
|
465 } else if (type == Double.TYPE) { |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
466 value = unsafe.getDouble(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 } else { |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
468 assert false : "unhandled property type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
470 } else { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
471 value = unsafe.getObject(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
473 properties.put(fieldNames.get(dataOffsets[i]), value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 public boolean valueEqual(Node a, Node b) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 if (!canGVN || a.getNodeClass() != b.getNodeClass()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 return a == b; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 for (int i = 0; i < dataOffsets.length; ++i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 Class<?> type = dataTypes[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 int aInt = unsafe.getInt(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 int bInt = unsafe.getInt(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 if (aInt != bInt) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
489 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 boolean aBoolean = unsafe.getBoolean(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 boolean bBoolean = unsafe.getBoolean(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 if (aBoolean != bBoolean) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 } |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
496 } else if (type == Long.TYPE) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
497 long aLong = unsafe.getLong(a, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
498 long bLong = unsafe.getLong(b, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
499 if (aLong != bLong) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
500 return false; |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
501 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 } else { |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
503 assert false : "unhandled type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 Object objectA = unsafe.getObject(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
507 Object objectB = unsafe.getObject(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 if (objectA != objectB) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 if (objectA != null && objectB != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 if (!(objectA.equals(objectB))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
513 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
514 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
515 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
516 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
517 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
518 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 |
5214 | 522 public boolean isValid(Position pos, NodeClass from) { |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
523 if (this == from) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
524 return true; |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
525 } |
5214 | 526 long[] offsets = pos.input ? inputOffsets : successorOffsets; |
527 if (pos.index >= offsets.length) { | |
528 return false; | |
529 } | |
530 long[] fromOffsets = pos.input ? from.inputOffsets : from.successorOffsets; | |
531 if (pos.index >= fromOffsets.length) { | |
532 return false; | |
533 } | |
534 return offsets[pos.index] == fromOffsets[pos.index]; | |
535 } | |
536 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
537 public Node get(Node node, Position pos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 if (pos.subIndex == NOT_ITERABLE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
540 return getNode(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
541 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
542 return getNodeList(node, offset).get(pos.subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
543 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
544 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
545 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
546 public String getName(Position pos) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
547 return fieldNames.get(pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
548 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
549 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
550 private void set(Node node, Position pos, Node x) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
551 long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
552 if (pos.subIndex == NOT_ITERABLE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
553 Node old = getNode(node, offset); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
554 assert x == null || fieldTypes.get((pos.input ? inputOffsets : successorOffsets)[pos.index]).isAssignableFrom(x.getClass()) : this + ".set(node, pos, " + x + ")"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
555 putNode(node, offset, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
556 if (pos.input) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
557 node.updateUsages(old, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
558 } else { |
5487
9743ae819f73
Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5486
diff
changeset
|
559 node.updatePredecessor(old, x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
560 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
561 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
562 NodeList<Node> list = getNodeList(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
563 if (pos.subIndex < list.size()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
564 list.set(pos.subIndex, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
565 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
566 while (pos.subIndex < list.size() - 1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
567 list.add(null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
568 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
569 list.add(x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
570 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
571 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
573 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
574 public NodeClassIterable getInputIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
575 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
576 return new NodeClassIterable() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
578 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
579 public NodeClassIterator iterator() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
580 return new NodeClassIterator(node, inputOffsets, directInputCount); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
581 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
582 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
583 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
584 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
585 return inputContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
586 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
587 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
588 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
590 public NodeClassIterable getSuccessorIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
591 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
592 return new NodeClassIterable() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 public NodeClassIterator iterator() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 return new NodeClassIterator(node, successorOffsets, directSuccessorCount); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
599 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
600 return successorContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
601 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
602 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
603 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
604 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
605 public boolean replaceFirstInput(Node node, Node old, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
606 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
607 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
608 Node input = getNode(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
609 if (input == old) { |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5858
diff
changeset
|
610 assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + " in " + node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
611 putNode(node, inputOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
612 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
613 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
614 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
615 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
616 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
617 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
618 assert list != null : clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
619 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
620 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
621 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
622 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
623 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
624 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
625 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
626 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
627 public boolean replaceFirstSuccessor(Node node, Node old, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
628 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
629 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
630 Node successor = getNode(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
631 if (successor == old) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
632 assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()); // : successorTypes[index] + " is not compatible with " + other.getClass(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
633 putNode(node, successorOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
634 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
635 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
636 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
637 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
638 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
639 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
640 assert list != null : clazz + " " + successorOffsets[index] + " " + node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
641 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
642 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
643 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
644 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
645 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
646 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
647 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
648 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
649 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
650 * Clear all inputs in the given node. This is accomplished by setting input fields to null and replacing input lists with new lists. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
651 * (which is important so that this method can be used to clear the inputs of cloned nodes.) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
652 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
653 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
654 public void clearInputs(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
655 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
656 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
657 putNode(node, inputOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
658 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
659 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
660 long curOffset = inputOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
661 int size = (getNodeList(node, curOffset)).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
662 // replacing with a new list object is the expected behavior! |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
663 putNodeList(node, curOffset, new NodeInputList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
664 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
665 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
666 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
667 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
668 * Clear all successors in the given node. This is accomplished by setting successor fields to null and replacing successor lists with new lists. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
669 * (which is important so that this method can be used to clear the successors of cloned nodes.) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
670 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
671 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
672 public void clearSuccessors(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
673 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
674 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
675 putNode(node, successorOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
676 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
677 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
678 long curOffset = successorOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
679 int size = getNodeList(node, curOffset).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
680 // replacing with a new list object is the expected behavior! |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
681 putNodeList(node, curOffset, new NodeSuccessorList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
682 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
683 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
684 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
685 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
686 * Copies the inputs from node to newNode. The nodes are expected to be of the exact same NodeClass type. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
687 * @param node the node from which the inputs should be copied. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
688 * @param newNode the node to which the inputs should be copied. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
689 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
690 public void copyInputs(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
691 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
692 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
693 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
694 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
695 putNode(newNode, inputOffsets[index], getNode(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
696 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
697 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
698 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
699 NodeList<Node> list = getNodeList(newNode, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
700 list.copy(getNodeList(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
701 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
702 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
703 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
704 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
705 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
706 * Copies the successors from node to newNode. The nodes are expected to be of the exact same NodeClass type. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
707 * @param node the node from which the successors should be copied. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
708 * @param newNode the node to which the successors should be copied. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
709 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
710 public void copySuccessors(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
711 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
712 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
713 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
714 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
715 putNode(newNode, successorOffsets[index], getNode(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
716 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
717 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
718 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
719 NodeList<Node> list = getNodeList(newNode, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
720 list.copy(getNodeList(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
721 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
722 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
723 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
724 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
725 public boolean edgesEqual(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
726 assert node.getClass() == clazz && other.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
728 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
729 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
730 if (getNode(other, inputOffsets[index]) != getNode(node, inputOffsets[index])) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
731 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
732 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
733 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
734 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
735 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
736 NodeList<Node> list = getNodeList(other, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
737 if (!list.equals(getNodeList(node, inputOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
738 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
739 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
740 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
741 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
742 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
743 index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
744 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
745 if (getNode(other, successorOffsets[index]) != getNode(node, successorOffsets[index])) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
746 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
747 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
748 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
749 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
750 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
751 NodeList<Node> list = getNodeList(other, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
752 if (!list.equals(getNodeList(node, successorOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
753 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
754 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
755 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
756 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
757 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
758 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
759 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
760 public boolean inputContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
761 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
762 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
763 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
764 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
765 if (getNode(node, inputOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
766 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
767 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
768 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
769 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
770 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
771 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
772 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
773 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
774 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
775 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
776 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
777 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
778 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
779 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
780 public boolean successorContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
781 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
782 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
783 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
784 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
785 if (getNode(node, successorOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
786 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
787 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
788 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
789 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
790 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
791 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
792 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
794 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
795 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
796 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
797 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
798 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
799 |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
800 public List<Position> getFirstLevelInputPositions() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
801 List<Position> positions = new ArrayList<>(inputOffsets.length); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
802 for (int i = 0; i < inputOffsets.length; i++) { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
803 positions.add(new Position(true, i, NOT_ITERABLE)); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
804 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
805 return positions; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
806 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
807 |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
808 public List<Position> getFirstLevelSuccessorPositions() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
809 List<Position> positions = new ArrayList<>(successorOffsets.length); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
810 for (int i = 0; i < successorOffsets.length; i++) { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
811 positions.add(new Position(false, i, NOT_ITERABLE)); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
812 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
813 return positions; |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
814 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
815 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
816 public Class<?> getJavaClass() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
817 return clazz; |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
818 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
819 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
820 /** |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
821 * The template used to build the {@link Verbosity#Name} version. |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
822 * Variable part are specified using {i#inputName} or {p#propertyName}. |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
823 */ |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
824 public String getNameTemplate() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
825 return nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
826 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
827 |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
828 static Map<Node, Node> addGraphDuplicate(Graph graph, Iterable<Node> nodes, DuplicationReplacement replacements) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
829 Map<Node, Node> newNodes = new IdentityHashMap<>(); |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
830 Map<Node, Node> replacementsMap = new IdentityHashMap<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
831 // create node duplicates |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
832 for (Node node : nodes) { |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
833 if (node != null) { |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5858
diff
changeset
|
834 assert !node.isDeleted() : "trying to duplicate deleted node: " + node; |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
835 Node replacement = replacements.replacement(node); |
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
836 if (replacement != node) { |
5519
cedae73d9c2a
Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
837 assert replacement != null; |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
838 newNodes.put(node, replacement); |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
839 } else { |
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
840 Node newNode = node.clone(graph); |
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
841 assert newNode.getClass() == node.getClass(); |
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
842 newNodes.put(node, newNode); |
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
843 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
844 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
845 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
846 // re-wire inputs |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
847 for (Entry<Node, Node> entry : newNodes.entrySet()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
848 Node oldNode = entry.getKey(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
849 Node node = entry.getValue(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
850 for (NodeClassIterator iter = oldNode.inputs().iterator(); iter.hasNext();) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
851 Position pos = iter.nextPosition(); |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
852 if (!pos.isValidFor(node, oldNode)) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
853 continue; |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
854 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
855 Node input = oldNode.getNodeClass().get(oldNode, pos); |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
856 Node target = newNodes.get(input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
857 if (target == null) { |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
858 target = replacementsMap.get(input); |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
859 if (target == null) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
860 Node replacement = replacements.replacement(input); |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
861 if (replacement != input) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
862 replacementsMap.put(input, replacement); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
863 assert isAssignable(node.getNodeClass().fieldTypes.get(node.getNodeClass().inputOffsets[pos.index]), replacement); |
5486
85986efe747e
Check edge types for replacements in addDuplicate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5478
diff
changeset
|
864 target = replacement; |
5693
0356d95f01ba
While inlining, ensure proper anchoring of things that where anchored to the StartNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5519
diff
changeset
|
865 } else if (input.graph() == graph) { // patch to the outer world |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
866 target = input; |
5486
85986efe747e
Check edge types for replacements in addDuplicate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5478
diff
changeset
|
867 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
868 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
869 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
870 node.getNodeClass().set(node, pos, target); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
871 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
872 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
873 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
874 // re-wire successors |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
875 for (Entry<Node, Node> entry : newNodes.entrySet()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
876 Node oldNode = entry.getKey(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
877 Node node = entry.getValue(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
878 for (NodeClassIterator iter = oldNode.successors().iterator(); iter.hasNext();) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
879 Position pos = iter.nextPosition(); |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
880 if (!pos.isValidFor(node, oldNode)) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
881 continue; |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
882 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
883 Node succ = oldNode.getNodeClass().get(oldNode, pos); |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
884 Node target = newNodes.get(succ); |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
885 if (target == null) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
886 target = replacementsMap.get(succ); |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
887 if (target == null) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
888 Node replacement = replacements.replacement(succ); |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
889 if (replacement != succ) { |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
890 replacementsMap.put(succ, replacement); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
891 assert isAssignable(node.getNodeClass().fieldTypes.get(node.getNodeClass().successorOffsets[pos.index]), replacement); |
5489
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
892 target = replacement; |
5d0d72b37f88
Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5487
diff
changeset
|
893 } |
5486
85986efe747e
Check edge types for replacements in addDuplicate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5478
diff
changeset
|
894 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
895 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
896 node.getNodeClass().set(node, pos, target); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
897 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
898 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
899 return newNodes; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
900 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
901 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
902 private static boolean isAssignable(Class<?> fieldType, Node replacement) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
903 return replacement == null || !NODE_CLASS.isAssignableFrom(fieldType) || fieldType.isAssignableFrom(replacement.getClass()); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
904 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
905 } |