Mercurial > hg > truffle
annotate graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java @ 15241:c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 17 Apr 2014 10:26:13 +0200 |
parents | 96bb07a5d667 |
children | 21663230ba88 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
9720
d30cc6543973
fix concurrency issue in NodeClass.get
Lukas Stadler <lukas.stadler@jku.at>
parents:
9716
diff
changeset
|
2 * Copyright (c) 2011, 2013, 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; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
24 |
11524
dede53632f3e
removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents:
11434
diff
changeset
|
25 import static com.oracle.graal.graph.Graph.*; |
dede53632f3e
removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents:
11434
diff
changeset
|
26 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
27 import java.lang.reflect.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15186
diff
changeset
|
30 import com.oracle.graal.compiler.common.*; |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
31 import com.oracle.graal.debug.*; |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
32 import com.oracle.graal.graph.Graph.DuplicationReplacement; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14616
diff
changeset
|
33 import com.oracle.graal.graph.Node.Input; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14616
diff
changeset
|
34 import com.oracle.graal.graph.Node.Successor; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14616
diff
changeset
|
35 import com.oracle.graal.graph.Node.Verbosity; |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
36 import com.oracle.graal.graph.spi.*; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
37 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
38 /** |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
39 * Metadata for every {@link Node} type. The metadata includes: |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
40 * <ul> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
41 * <li>The offsets of fields annotated with {@link Input} and {@link Successor} as well as methods |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
42 * for iterating over such fields.</li> |
11631
1aed684853f6
refactored IterableNodeType into a top level type to avoid problems it was causing for javac and JDT (CR-1408)
Doug Simon <doug.simon@oracle.com>
parents:
11556
diff
changeset
|
43 * <li>The identifier for an {@link IterableNodeType} class.</li> |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
44 * </ul> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
45 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
46 public final class NodeClass extends FieldIntrospection { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
47 |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
48 private static final Object GetNodeClassLock = new Object(); |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
49 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
50 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
51 * Gets the {@link NodeClass} associated with a given {@link Class}. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
52 */ |
11434
0d9fe4e80ab8
moved warning suppression annotation to placate JDT
Doug Simon <doug.simon@oracle.com>
parents:
11431
diff
changeset
|
53 @SuppressWarnings("unchecked") |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
54 public static NodeClass get(Class<?> c) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
55 Class<? extends Node> key = (Class<? extends Node>) c; |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
56 NodeClass value = (NodeClass) allClasses.get(key); |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
57 // The fact that {@link ConcurrentHashMap#put} and {@link ConcurrentHashMap#get} |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
58 // are used makes the double-checked locking idiom work. |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
59 if (value == null) { |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
60 // The creation of a NodeClass must be serialized as the NodeClass constructor accesses |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
61 // both FieldIntrospection.allClasses and NodeClass.nextIterableId. |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
62 synchronized (GetNodeClassLock) { |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
63 value = (NodeClass) allClasses.get(key); |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
64 if (value == null) { |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
65 value = new NodeClass(key); |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
66 Object old = allClasses.putIfAbsent(key, value); |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
67 assert old == null : old + " " + key; |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
68 } |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
69 } |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
70 } |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
71 return value; |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
72 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
73 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
74 public static final int NOT_ITERABLE = -1; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
75 public static final int NODE_LIST = -2; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 private static int nextIterableId = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 private final int directInputCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 private final long[] inputOffsets; |
15001 | 85 private final InputType[] inputTypes; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 private final int directSuccessorCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 private final long[] successorOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 private final Class<?>[] dataTypes; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 private final boolean canGVN; |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
90 private final boolean isLeafNode; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 private final int startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 private final String shortName; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
93 private final String nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 private final int iterableId; |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
95 private final EnumSet<InputType> allowedUsageTypes; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
96 private int[] iterableIds; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
98 private static final DebugMetric ITERABLE_NODE_TYPES = Debug.metric("IterableNodeTypes"); |
11663
d213be26ffb4
added metric to count number of times a typed node iterator is used per IterableNodeType (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11653
diff
changeset
|
99 private final DebugMetric nodeIterableCount; |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
100 |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
101 /** |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
102 * Determines if this node type implements {@link Canonicalizable}. |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
103 */ |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
104 private final boolean isCanonicalizable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
105 |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
106 /** |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
107 * Determines if this node type implements {@link Simplifiable}. |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
108 */ |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
109 private final boolean isSimplifiable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
110 |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
111 public NodeClass(Class<?> clazz) { |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
112 this(clazz, new DefaultCalcOffset(), null, 0); |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
113 } |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
114 |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
115 public NodeClass(Class<?> clazz, CalcOffset calcOffset, int[] presetIterableIds, int presetIterableId) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
116 super(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 assert NODE_CLASS.isAssignableFrom(clazz); |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
118 this.isCanonicalizable = Canonicalizable.class.isAssignableFrom(clazz); |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
119 this.isSimplifiable = Simplifiable.class.isAssignableFrom(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
121 FieldScanner scanner = new FieldScanner(calcOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 directInputCount = scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 inputOffsets = sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets); |
15001 | 126 inputTypes = new InputType[inputOffsets.length]; |
127 for (int i = 0; i < inputOffsets.length; i++) { | |
128 inputTypes[i] = scanner.types.get(inputOffsets[i]); | |
129 assert inputTypes[i] != null; | |
130 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 directSuccessorCount = scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 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
|
133 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
134 dataOffsets = sortedLongCopy(scanner.dataOffsets); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
135 dataTypes = new Class[dataOffsets.length]; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
136 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
|
137 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
139 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
140 fieldNames = scanner.fieldNames; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
141 fieldTypes = 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 canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 startGVNNumber = clazz.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
146 String newShortName = clazz.getSimpleName(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
147 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
|
148 newShortName = newShortName.substring(0, newShortName.length() - 4); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
150 String newNameTemplate = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 NodeInfo info = clazz.getAnnotation(NodeInfo.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 if (info != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 if (!info.shortName().isEmpty()) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
154 newShortName = info.shortName(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
156 if (!info.nameTemplate().isEmpty()) { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
157 newNameTemplate = info.nameTemplate(); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
158 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 } |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
160 EnumSet<InputType> newAllowedUsageTypes = EnumSet.noneOf(InputType.class); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
161 Class<?> current = clazz; |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
162 do { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
163 NodeInfo currentInfo = current.getAnnotation(NodeInfo.class); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
164 if (currentInfo != null) { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
165 if (currentInfo.allowedUsageTypes().length > 0) { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
166 newAllowedUsageTypes.addAll(Arrays.asList(currentInfo.allowedUsageTypes())); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
167 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
168 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
169 current = current.getSuperclass(); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
170 } while (current != Node.class); |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
171 this.nameTemplate = newNameTemplate == null ? newShortName : newNameTemplate; |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
172 this.allowedUsageTypes = newAllowedUsageTypes; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
173 this.shortName = newShortName; |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
174 if (presetIterableIds != null) { |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
175 this.iterableIds = presetIterableIds; |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
176 this.iterableId = presetIterableId; |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
177 } else if (IterableNodeType.class.isAssignableFrom(clazz)) { |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
178 ITERABLE_NODE_TYPES.increment(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 this.iterableId = nextIterableId++; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
180 List<NodeClass> existingClasses = new LinkedList<>(); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
181 for (FieldIntrospection nodeClass : allClasses.values()) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
182 if (clazz.isAssignableFrom(nodeClass.clazz)) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
183 existingClasses.add((NodeClass) nodeClass); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
184 } |
11631
1aed684853f6
refactored IterableNodeType into a top level type to avoid problems it was causing for javac and JDT (CR-1408)
Doug Simon <doug.simon@oracle.com>
parents:
11556
diff
changeset
|
185 if (nodeClass.clazz.isAssignableFrom(clazz) && IterableNodeType.class.isAssignableFrom(nodeClass.clazz)) { |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
186 NodeClass superNodeClass = (NodeClass) nodeClass; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
187 superNodeClass.iterableIds = Arrays.copyOf(superNodeClass.iterableIds, superNodeClass.iterableIds.length + 1); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
188 superNodeClass.iterableIds[superNodeClass.iterableIds.length - 1] = this.iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
189 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
190 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
191 int[] ids = new int[existingClasses.size() + 1]; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
192 ids[0] = iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
193 int i = 1; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
194 for (NodeClass other : existingClasses) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
195 ids[i++] = other.iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
196 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
197 this.iterableIds = ids; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
199 this.iterableId = NOT_ITERABLE; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
200 this.iterableIds = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 } |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
202 |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
203 isLeafNode = (this.inputOffsets.length == 0 && this.successorOffsets.length == 0); |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
204 nodeIterableCount = Debug.metric("NodeIterable_%s", shortName); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
207 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
208 protected void rescanFieldOffsets(CalcOffset calc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 FieldScanner scanner = new FieldScanner(calc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 assert directInputCount == scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 copyInto(inputOffsets, sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 assert directSuccessorCount == scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 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
|
215 copyInto(dataOffsets, sortedLongCopy(scanner.dataOffsets)); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
216 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
217 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
|
218 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
221 fieldNames.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
222 fieldNames.putAll(scanner.fieldNames); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
223 fieldTypes.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
224 fieldTypes.putAll(scanner.fieldTypes); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 public String shortName() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 return shortName; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
231 public int[] iterableIds() { |
11663
d213be26ffb4
added metric to count number of times a typed node iterator is used per IterableNodeType (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11653
diff
changeset
|
232 nodeIterableCount.increment(); |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
233 return iterableIds; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
234 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
235 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 public int iterableId() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 return iterableId; |
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 boolean valueNumberable() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 return canGVN; |
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 |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
244 public boolean isLeafNode() { |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
245 return isLeafNode; |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
246 } |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
247 |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
248 /** |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
249 * Determines if this node type implements {@link Canonicalizable}. |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
250 */ |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
251 public boolean isCanonicalizable() { |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
252 return isCanonicalizable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
253 } |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
254 |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
255 /** |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
256 * Determines if this node type implements {@link Simplifiable}. |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
257 */ |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
258 public boolean isSimplifiable() { |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
259 return isSimplifiable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
260 } |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
261 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 public static int cacheSize() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 return nextIterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
266 public EnumSet<InputType> getAllowedUsageTypes() { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
267 return allowedUsageTypes; |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
268 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
269 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
270 protected static class FieldScanner extends BaseFieldScanner { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
271 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 public final ArrayList<Long> successorListOffsets = new ArrayList<>(); |
15001 | 276 public final HashMap<Long, InputType> types = new HashMap<>(); |
277 public final HashMap<Long, String> names = new HashMap<>(); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
279 protected FieldScanner(CalcOffset calc) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
280 super(calc); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
283 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
284 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
|
285 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
|
286 assert !field.isAnnotationPresent(Node.Successor.class) : "field cannot be both input and successor"; |
15001 | 287 Input inputAnnotation = field.getAnnotation(Node.Input.class); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
288 if (INPUT_LIST_CLASS.isAssignableFrom(type)) { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
289 GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeInputList input field %s should be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
290 GraalInternalError.guarantee(!Modifier.isPublic(field.getModifiers()), "NodeInputList input field %s should not be public", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
291 inputListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
292 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
293 GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type) || type.isInterface(), "invalid input type: %s", type); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
294 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node input field %s should not be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
295 GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node input field %s should be private", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
296 inputOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
297 } |
15001 | 298 types.put(offset, inputAnnotation.value()); |
299 names.put(offset, field.getName()); | |
300 if (inputAnnotation.value() != InputType.Value) { | |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
301 fieldNames.put(offset, field.getName() + "#NDF"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
303 } 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
|
304 if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
305 GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeSuccessorList successor field % should be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
306 GraalInternalError.guarantee(!Modifier.isPublic(field.getModifiers()), "NodeSuccessorList successor field %s should not be public", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
307 successorListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
308 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
309 GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type), "invalid successor type: %s", type); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
310 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node successor field %s should not be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
311 GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node successor field %s should be private", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
312 successorOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
313 } |
15001 | 314 names.put(offset, field.getName()); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
315 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
316 GraalInternalError.guarantee(!NODE_CLASS.isAssignableFrom(type) || field.getName().equals("Null"), "suspicious node field: %s", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
317 GraalInternalError.guarantee(!INPUT_LIST_CLASS.isAssignableFrom(type), "suspicious node input list field: %s", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
318 GraalInternalError.guarantee(!SUCCESSOR_LIST_CLASS.isAssignableFrom(type), "suspicious node successor list field: %s", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
319 dataOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
320 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 } |
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
325 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
326 StringBuilder str = new StringBuilder(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 str.append("NodeClass ").append(clazz.getSimpleName()).append(" ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 for (int i = 0; i < inputOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 str.append(i == 0 ? "" : ", ").append(inputOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
331 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 for (int i = 0; i < successorOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
333 str.append(i == 0 ? "" : ", ").append(successorOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
335 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
336 for (int i = 0; i < dataOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
337 str.append(i == 0 ? "" : ", ").append(dataOffsets[i]); |
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 str.append("]"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 return str.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
343 /** |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
344 * Describes an edge slot for a {@link NodeClass}. |
15001 | 345 * |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
346 * @see NodeClass#get(Node, Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
347 * @see NodeClass#getName(Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
348 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 public static final class Position { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
350 |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
351 private final boolean input; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
352 private final int index; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
353 private final int subIndex; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 public Position(boolean input, int index, int subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 this.input = input; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 this.index = index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 this.subIndex = 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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 return (input ? "input " : "successor ") + index + "/" + subIndex; |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 public Node get(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 return node.getNodeClass().get(node, this); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
368 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 |
15001 | 370 public InputType getInputType(Node node) { |
371 return node.getNodeClass().getInputType(this); | |
372 } | |
373 | |
374 public String getInputName(Node node) { | |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
375 return node.getNodeClass().getName(this); |
15001 | 376 } |
377 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 public void set(Node node, Node value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 node.getNodeClass().set(node, this, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 |
5214 | 382 public boolean isValidFor(Node node, Node from) { |
383 return node.getNodeClass().isValid(this, from.getNodeClass()); | |
384 } | |
385 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 public int hashCode() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 final int prime = 31; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 int result = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 result = prime * result + index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 result = prime * result + (input ? 1231 : 1237); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 result = prime * result + subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 public boolean equals(Object obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 if (this == obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 return true; |
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 if (obj == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 if (getClass() != obj.getClass()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 return false; |
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 Position other = (Position) obj; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 if (index != other.index) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 return false; |
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 if (input != other.input) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 if (subIndex != other.subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 } |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
419 |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
420 public int getSubIndex() { |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
421 return subIndex; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
422 } |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
423 |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
424 public int getIndex() { |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
425 return index; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
426 } |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
427 |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
428 public boolean isInput() { |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
429 return input; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
430 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 private static Node getNode(Node node, long offset) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 return (Node) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 @SuppressWarnings("unchecked") |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 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
|
439 return (NodeList<Node>) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 } |
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 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
|
443 unsafe.putObject(node, offset, value); |
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 |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15002
diff
changeset
|
446 private static void putNodeList(Node node, long offset, NodeList<?> value) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
447 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
449 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
450 /** |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
451 * An iterator that will iterate over the fields given in {@link #getOffsets()}. The first |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
452 * {@link #getDirectCount()} offsets are treated as fields of type {@link Node}, while the rest |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
453 * of the fields are treated as {@link NodeList}s. All elements of these NodeLists will be |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
454 * visited by the iterator as well. This iterator can be used to iterate over the inputs or |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
455 * successors of a node. |
15001 | 456 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
457 * An iterator of this type will not return null values, unless the field values are modified |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
458 * concurrently. Concurrent modifications are detected by an assertion on a best-effort basis. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
459 */ |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
460 public abstract static class NodeClassIterator implements Iterator<Node> { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
461 protected final Node node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 private int index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 private int subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 * Creates an iterator that will iterate over fields in the given node. |
15001 | 467 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 * @param node the node which contains the fields. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 */ |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
470 NodeClassIterator(Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 this.node = node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 index = NOT_ITERABLE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 subIndex = 0; |
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 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
476 void forward() { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
477 if (index < getDirectCount()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 index++; |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
479 while (index < getDirectCount()) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
480 Node element = getNode(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 if (element != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 } |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
489 while (index < getOffsets().length) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
490 NodeList<Node> list = getNodeList(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 while (subIndex < list.size()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 if (list.get(subIndex) != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
497 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
500 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
501 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 private Node nextElement() { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
503 if (index < getDirectCount()) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
504 return getNode(node, getOffsets()[index]); |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
505 } else if (index < getOffsets().length) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
506 NodeList<Node> list = getNodeList(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
507 return list.get(subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 } |
7258
9bee93f61522
Cleanups: remove unused NodeUsagesList.replaceFirst and FrameState.block
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7123
diff
changeset
|
509 throw new NoSuchElementException(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
513 public boolean hasNext() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
514 return index < getOffsets().length; |
3733
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
518 public Node next() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 return nextElement(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
522 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
524 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
525 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
526 public Position nextPosition() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
527 try { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
528 if (index < getDirectCount()) { |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
529 return new Position(getOffsets() == getNodeClass().inputOffsets, index, NOT_ITERABLE); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
530 } else { |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
531 return new Position(getOffsets() == getNodeClass().inputOffsets, index, subIndex); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
532 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
533 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
534 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
535 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
536 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
537 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 public void remove() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
540 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
541 } |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
542 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
543 protected abstract int getDirectCount(); |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
544 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
545 protected abstract long[] getOffsets(); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
546 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
547 protected abstract NodeClass getNodeClass(); |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
548 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
549 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
550 private class NodeClassInputsIterator extends NodeClassIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
551 NodeClassInputsIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
552 this(node, true); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
553 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
554 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
555 NodeClassInputsIterator(Node node, boolean forward) { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
556 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
557 assert NodeClass.this == node.getNodeClass(); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
558 if (forward) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
559 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
560 } |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
561 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
562 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
563 @Override |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
564 protected int getDirectCount() { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
565 return directInputCount; |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
566 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
567 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
568 @Override |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
569 protected long[] getOffsets() { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
570 return inputOffsets; |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
571 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
572 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
573 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
574 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
575 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
576 } |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
577 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
578 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
579 private final class NodeClassInputsWithModCountIterator extends NodeClassInputsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
580 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
581 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
582 private NodeClassInputsWithModCountIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
583 super(node, false); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
584 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
585 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
586 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
587 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
588 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
589 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
590 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
591 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
592 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
593 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
594 assert modCount == node.modCount() : "must not be modified"; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
595 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
596 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
597 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
598 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
599 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
600 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
601 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
602 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
603 assert modCount == node.modCount() : "must not be modified"; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
604 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
605 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
606 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
607 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
608 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
609 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
610 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
611 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
612 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
613 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
614 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
615 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
616 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
617 private class NodeClassSuccessorsIterator extends NodeClassIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
618 NodeClassSuccessorsIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
619 this(node, true); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
620 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
621 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
622 NodeClassSuccessorsIterator(Node node, boolean forward) { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
623 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
624 assert NodeClass.this == node.getNodeClass(); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
625 if (forward) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
626 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
627 } |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
628 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
629 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
630 @Override |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
631 protected int getDirectCount() { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
632 return directSuccessorCount; |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
633 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
634 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
635 @Override |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
636 protected long[] getOffsets() { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
637 return successorOffsets; |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
638 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
639 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
640 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
641 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
642 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
643 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
644 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
645 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
646 private final class NodeClassSuccessorsWithModCountIterator extends NodeClassSuccessorsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
647 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
648 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
649 private NodeClassSuccessorsWithModCountIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
650 super(node, false); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
651 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
652 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
653 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
654 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
655 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
656 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
657 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
658 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
659 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
660 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
661 assert modCount == node.modCount() : "must not be modified"; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
662 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
663 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
664 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
665 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
666 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
667 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
668 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
669 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
670 assert modCount == node.modCount() : "must not be modified"; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
671 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
672 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
673 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
674 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
675 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
676 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
677 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
678 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
679 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
680 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
681 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
682 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
683 |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
684 private static int deepHashCode0(Object o) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
685 if (o instanceof Object[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
686 return Arrays.deepHashCode((Object[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
687 } else if (o instanceof byte[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
688 return Arrays.hashCode((byte[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
689 } else if (o instanceof short[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
690 return Arrays.hashCode((short[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
691 } else if (o instanceof int[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
692 return Arrays.hashCode((int[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
693 } else if (o instanceof long[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
694 return Arrays.hashCode((long[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
695 } else if (o instanceof char[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
696 return Arrays.hashCode((char[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
697 } else if (o instanceof float[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
698 return Arrays.hashCode((float[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
699 } else if (o instanceof double[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
700 return Arrays.hashCode((double[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
701 } else if (o instanceof boolean[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
702 return Arrays.hashCode((boolean[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
703 } else if (o != null) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
704 return o.hashCode(); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
705 } else { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
706 return 0; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
707 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
708 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
709 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
710 public int valueNumber(Node n) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
711 int number = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
712 if (canGVN) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
713 number = startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
714 for (int i = 0; i < dataOffsets.length; ++i) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
715 Class<?> type = dataTypes[i]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
716 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
717 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
718 int intValue = unsafe.getInt(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
719 number += intValue; |
6657
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
720 } else if (type == Long.TYPE) { |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
721 long longValue = unsafe.getLong(n, dataOffsets[i]); |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
722 number += longValue ^ (longValue >>> 32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
723 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
724 boolean booleanValue = unsafe.getBoolean(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
725 if (booleanValue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
726 number += 7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
728 } else if (type == Float.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
729 float floatValue = unsafe.getFloat(n, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
730 number += Float.floatToRawIntBits(floatValue); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
731 } else if (type == Double.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
732 double doubleValue = unsafe.getDouble(n, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
733 long longValue = Double.doubleToRawLongBits(doubleValue); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
734 number += longValue ^ (longValue >>> 32); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
735 } else if (type == Short.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
736 short shortValue = unsafe.getShort(n, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
737 number += shortValue; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
738 } else if (type == Character.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
739 char charValue = unsafe.getChar(n, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
740 number += charValue; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
741 } else if (type == Byte.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
742 byte byteValue = unsafe.getByte(n, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
743 number += byteValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
744 } else { |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
745 assert false : "unhandled property type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
746 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
747 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
748 Object o = unsafe.getObject(n, dataOffsets[i]); |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
749 number += deepHashCode0(o); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
750 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
751 number *= 13; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
752 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
753 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
754 return number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
755 } |
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 /** |
5711
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
758 * Populates a given map with the names and values of all data fields. |
15001 | 759 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
760 * @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
|
761 * @param properties a map that will be populated. |
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 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
|
764 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
|
765 Class<?> type = fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
766 Object value = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
767 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
768 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
769 value = unsafe.getInt(node, dataOffsets[i]); |
5361
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
770 } else if (type == Long.TYPE) { |
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
771 value = unsafe.getLong(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
772 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
773 value = unsafe.getBoolean(node, dataOffsets[i]); |
12669
1152cf83f0b9
added support for reading float debug properties from a node
Doug Simon <doug.simon@oracle.com>
parents:
12658
diff
changeset
|
774 } else if (type == Float.TYPE) { |
1152cf83f0b9
added support for reading float debug properties from a node
Doug Simon <doug.simon@oracle.com>
parents:
12658
diff
changeset
|
775 value = unsafe.getFloat(node, dataOffsets[i]); |
5287
e96c8d2925da
let NodeClass.getDebugProperties handle arrays and doubles
Lukas Stadler <lukas.stadler@jku.at>
parents:
5261
diff
changeset
|
776 } 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
|
777 value = unsafe.getDouble(node, dataOffsets[i]); |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
778 } else if (type == Short.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
779 value = unsafe.getShort(node, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
780 } else if (type == Character.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
781 value = unsafe.getChar(node, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
782 } else if (type == Byte.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
783 value = unsafe.getByte(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
784 } else { |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
785 assert false : "unhandled property type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
786 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
787 } else { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
788 value = unsafe.getObject(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
789 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
790 properties.put(fieldNames.get(dataOffsets[i]), value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
791 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
792 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
794 private static boolean deepEquals0(Object e1, Object e2) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
795 assert e1 != null; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
796 boolean eq; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
797 if (e1 instanceof Object[] && e2 instanceof Object[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
798 eq = Arrays.deepEquals((Object[]) e1, (Object[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
799 } else if (e1 instanceof byte[] && e2 instanceof byte[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
800 eq = Arrays.equals((byte[]) e1, (byte[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
801 } else if (e1 instanceof short[] && e2 instanceof short[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
802 eq = Arrays.equals((short[]) e1, (short[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
803 } else if (e1 instanceof int[] && e2 instanceof int[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
804 eq = Arrays.equals((int[]) e1, (int[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
805 } else if (e1 instanceof long[] && e2 instanceof long[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
806 eq = Arrays.equals((long[]) e1, (long[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
807 } else if (e1 instanceof char[] && e2 instanceof char[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
808 eq = Arrays.equals((char[]) e1, (char[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
809 } else if (e1 instanceof float[] && e2 instanceof float[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
810 eq = Arrays.equals((float[]) e1, (float[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
811 } else if (e1 instanceof double[] && e2 instanceof double[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
812 eq = Arrays.equals((double[]) e1, (double[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
813 } else if (e1 instanceof boolean[] && e2 instanceof boolean[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
814 eq = Arrays.equals((boolean[]) e1, (boolean[]) e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
815 } else { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
816 eq = e1.equals(e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
817 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
818 return eq; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
819 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
820 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
821 public boolean valueEqual(Node a, Node b) { |
15186
5e2cffe8b815
allow valueEqual for non-GVN node classes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15106
diff
changeset
|
822 if (a.getClass() != b.getClass()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
823 return a == b; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
824 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
825 for (int i = 0; i < dataOffsets.length; ++i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
826 Class<?> type = dataTypes[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
827 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
828 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
829 int aInt = unsafe.getInt(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
830 int bInt = unsafe.getInt(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
831 if (aInt != bInt) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
832 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
833 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
834 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
835 boolean aBoolean = unsafe.getBoolean(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
836 boolean bBoolean = unsafe.getBoolean(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
837 if (aBoolean != bBoolean) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
838 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
839 } |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
840 } else if (type == Long.TYPE) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
841 long aLong = unsafe.getLong(a, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
842 long bLong = unsafe.getLong(b, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
843 if (aLong != bLong) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
844 return false; |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
845 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
846 } else if (type == Float.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
847 float aFloat = unsafe.getFloat(a, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
848 float bFloat = unsafe.getFloat(b, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
849 if (aFloat != bFloat) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
850 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
851 } |
10785
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
852 } else if (type == Double.TYPE) { |
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
853 double aDouble = unsafe.getDouble(a, dataOffsets[i]); |
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
854 double bDouble = unsafe.getDouble(b, dataOffsets[i]); |
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
855 if (aDouble != bDouble) { |
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
856 return false; |
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
857 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
858 } else if (type == Short.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
859 short aShort = unsafe.getShort(a, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
860 short bShort = unsafe.getShort(b, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
861 if (aShort != bShort) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
862 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
863 } |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
864 } else if (type == Character.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
865 char aChar = unsafe.getChar(a, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
866 char bChar = unsafe.getChar(b, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
867 if (aChar != bChar) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
868 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
869 } |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
870 } else if (type == Byte.TYPE) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
871 byte aByte = unsafe.getByte(a, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
872 byte bByte = unsafe.getByte(b, dataOffsets[i]); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
873 if (aByte != bByte) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
874 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
875 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
876 } else { |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
877 assert false : "unhandled type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
878 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
879 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
880 Object objectA = unsafe.getObject(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
881 Object objectB = unsafe.getObject(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
882 if (objectA != objectB) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
883 if (objectA != null && objectB != null) { |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
884 if (!deepEquals0(objectA, objectB)) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
885 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
886 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
887 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
888 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
889 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
890 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
891 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
892 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
893 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
894 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
895 |
5214 | 896 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
|
897 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
|
898 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
|
899 } |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
900 long[] offsets = pos.isInput() ? inputOffsets : successorOffsets; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
901 if (pos.getIndex() >= offsets.length) { |
5214 | 902 return false; |
903 } | |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
904 long[] fromOffsets = pos.isInput() ? from.inputOffsets : from.successorOffsets; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
905 if (pos.getIndex() >= fromOffsets.length) { |
5214 | 906 return false; |
907 } | |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
908 return offsets[pos.getIndex()] == fromOffsets[pos.getIndex()]; |
5214 | 909 } |
910 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
911 public Node get(Node node, Position pos) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
912 long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
913 if (pos.getSubIndex() == NOT_ITERABLE) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
914 return getNode(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
915 } else { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
916 return getNodeList(node, offset).get(pos.getSubIndex()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
917 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
918 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
919 |
15001 | 920 public InputType getInputType(Position pos) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
921 assert pos.isInput(); |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
922 return inputTypes[pos.getIndex()]; |
15001 | 923 } |
924 | |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
925 public NodeList<?> getNodeList(Node node, Position pos) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
926 long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
927 assert pos.getSubIndex() == NODE_LIST; |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
928 return getNodeList(node, offset); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
929 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
930 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
931 public String getName(Position pos) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
932 return fieldNames.get(pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
933 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
934 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
935 void updateInputSuccInPlace(Node node, InplaceUpdateClosure duplicationReplacement) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
936 int index = 0; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
937 while (index < directInputCount) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
938 Node input = getNode(node, inputOffsets[index]); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
939 if (input != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
940 Node newInput = duplicationReplacement.replacement(input, true); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
941 node.updateUsages(null, newInput); |
13151
5801a5e3e7e4
Assert for checking the input type in NodeClass.updateInputSuccInPlace.
Roland Schatz <roland.schatz@oracle.com>
parents:
13140
diff
changeset
|
942 assert newInput == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(newInput.getClass()) : "Can not assign " + newInput.getClass() + " to " + |
5801a5e3e7e4
Assert for checking the input type in NodeClass.updateInputSuccInPlace.
Roland Schatz <roland.schatz@oracle.com>
parents:
13140
diff
changeset
|
943 fieldTypes.get(inputOffsets[index]) + " in " + node; |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
944 putNode(node, inputOffsets[index], newInput); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
945 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
946 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
947 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
948 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
949 if (index < inputOffsets.length) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
950 updateInputLists(node, duplicationReplacement, index); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
951 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
952 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
953 index = 0; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
954 while (index < directSuccessorCount) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
955 Node successor = getNode(node, successorOffsets[index]); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
956 if (successor != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
957 Node newSucc = duplicationReplacement.replacement(successor, false); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
958 node.updatePredecessor(null, newSucc); |
13151
5801a5e3e7e4
Assert for checking the input type in NodeClass.updateInputSuccInPlace.
Roland Schatz <roland.schatz@oracle.com>
parents:
13140
diff
changeset
|
959 assert newSucc == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(newSucc.getClass()) : fieldTypes.get(successorOffsets[index]) + " is not compatible with " + |
5801a5e3e7e4
Assert for checking the input type in NodeClass.updateInputSuccInPlace.
Roland Schatz <roland.schatz@oracle.com>
parents:
13140
diff
changeset
|
960 newSucc.getClass(); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
961 putNode(node, successorOffsets[index], newSucc); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
962 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
963 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
964 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
965 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
966 if (index < successorOffsets.length) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
967 updateSuccLists(node, duplicationReplacement, index); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
968 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
969 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
970 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
971 private void updateInputLists(Node node, InplaceUpdateClosure duplicationReplacement, int startIndex) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
972 int index = startIndex; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
973 while (index < inputOffsets.length) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
974 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
14157 | 975 assert list != null : clazz; |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
976 putNodeList(node, inputOffsets[index], updateInputListCopy(list, node, duplicationReplacement)); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
977 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
978 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
979 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
980 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
981 private void updateSuccLists(Node node, InplaceUpdateClosure duplicationReplacement, int startIndex) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
982 int index = startIndex; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
983 while (index < successorOffsets.length) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
984 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
14157 | 985 assert list != null : clazz; |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
986 putNodeList(node, successorOffsets[index], updateSuccListCopy(list, node, duplicationReplacement)); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
987 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
988 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
989 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
990 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
991 private static NodeInputList<Node> updateInputListCopy(NodeList<Node> list, Node node, InplaceUpdateClosure duplicationReplacement) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
992 int size = list.size(); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
993 NodeInputList<Node> result = new NodeInputList<>(node, size); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
994 for (int i = 0; i < list.count(); ++i) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
995 Node oldNode = list.get(i); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
996 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
997 Node newNode = duplicationReplacement.replacement(oldNode, true); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
998 result.set(i, newNode); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
999 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1000 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1001 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1002 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1003 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1004 private static NodeSuccessorList<Node> updateSuccListCopy(NodeList<Node> list, Node node, InplaceUpdateClosure duplicationReplacement) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1005 int size = list.size(); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1006 NodeSuccessorList<Node> result = new NodeSuccessorList<>(node, size); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1007 for (int i = 0; i < list.count(); ++i) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1008 Node oldNode = list.get(i); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1009 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1010 Node newNode = duplicationReplacement.replacement(oldNode, false); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1011 result.set(i, newNode); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1012 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1013 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1014 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1015 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1016 |
7283
3964f3d4eb18
Extend loop unswicthing to Switch nodes (integer or type)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7258
diff
changeset
|
1017 public void set(Node node, Position pos, Node x) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1018 long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1019 if (pos.getSubIndex() == NOT_ITERABLE) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1020 Node old = getNode(node, offset); |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1021 assert x == null || fieldTypes.get((pos.isInput() ? inputOffsets : successorOffsets)[pos.getIndex()]).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
|
1022 putNode(node, offset, x); |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1023 if (pos.isInput()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1024 node.updateUsages(old, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1025 } else { |
5487
9743ae819f73
Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5486
diff
changeset
|
1026 node.updatePredecessor(old, x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1027 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1028 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1029 NodeList<Node> list = getNodeList(node, offset); |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1030 if (pos.getSubIndex() < list.size()) { |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1031 list.set(pos.getSubIndex(), x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1032 } else { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1033 while (pos.getSubIndex() < list.size() - 1) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1034 list.add(null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1035 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1036 list.add(x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1037 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1038 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1039 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1040 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1041 public NodeClassIterable getInputIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1042 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1043 return new NodeClassIterable() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1044 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1045 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1046 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1047 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1048 return new NodeClassInputsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1049 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1050 return new NodeClassInputsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1051 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1052 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1053 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1054 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1055 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1056 return inputContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1057 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1058 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1059 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1060 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1061 public NodeClassIterable getSuccessorIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1062 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1063 return new NodeClassIterable() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1064 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1065 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1066 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1067 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1068 return new NodeClassSuccessorsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1069 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1070 return new NodeClassSuccessorsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1071 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1072 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1073 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1074 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1075 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1076 return successorContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1077 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1078 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1079 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1080 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1081 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
|
1082 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1083 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1084 Node input = getNode(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1085 if (input == old) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1086 assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1087 " in " + node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1088 putNode(node, inputOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1089 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1090 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1091 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1092 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1093 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1094 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1095 assert list != null : clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1096 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1097 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1098 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1099 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1100 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1101 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1102 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1103 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1104 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
|
1105 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1106 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1107 Node successor = getNode(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1108 if (successor == old) { |
10424
e6cf435419b2
Fix after lowering phase refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9808
diff
changeset
|
1109 assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()) : fieldTypes.get(successorOffsets[index]) + " is not compatible with " + |
e6cf435419b2
Fix after lowering phase refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9808
diff
changeset
|
1110 other.getClass(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1111 putNode(node, successorOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1112 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1113 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1114 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1115 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1116 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1117 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1118 assert list != null : clazz + " " + successorOffsets[index] + " " + node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1119 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1120 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1122 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1123 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1124 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1125 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1126 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1127 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1128 * Clear all inputs in the given node. This is accomplished by setting input fields to null and |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1129 * replacing input lists with new lists. (which is important so that this method can be used to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1130 * clear the inputs of cloned nodes.) |
15001 | 1131 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1132 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1133 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1134 public void clearInputs(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1135 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1136 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1137 putNode(node, inputOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1138 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1139 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1140 long curOffset = inputOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1141 int size = (getNodeList(node, curOffset)).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1142 // 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
|
1143 putNodeList(node, curOffset, new NodeInputList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1145 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1146 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1147 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1148 * Clear all successors in the given node. This is accomplished by setting successor fields to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1149 * null and replacing successor lists with new lists. (which is important so that this method |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1150 * can be used to clear the successors of cloned nodes.) |
15001 | 1151 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1152 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1153 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1154 public void clearSuccessors(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1155 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1156 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1157 putNode(node, successorOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1158 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1159 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1160 long curOffset = successorOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1161 int size = getNodeList(node, curOffset).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1162 // 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
|
1163 putNodeList(node, curOffset, new NodeSuccessorList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1164 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1166 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1167 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1168 * Copies the inputs from node to newNode. The nodes are expected to be of the exact same |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1169 * NodeClass type. |
15001 | 1170 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1171 * @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
|
1172 * @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
|
1173 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1174 public void copyInputs(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1175 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1176 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1177 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1178 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1179 putNode(newNode, inputOffsets[index], getNode(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1180 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1181 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1182 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1183 NodeList<Node> list = getNodeList(newNode, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1184 list.copy(getNodeList(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1185 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1186 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1188 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1189 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1190 * Copies the successors from node to newNode. The nodes are expected to be of the exact same |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1191 * NodeClass type. |
15001 | 1192 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1193 * @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
|
1194 * @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
|
1195 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1196 public void copySuccessors(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1197 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1198 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1199 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1200 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1201 putNode(newNode, successorOffsets[index], getNode(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1202 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1203 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1204 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1205 NodeList<Node> list = getNodeList(newNode, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1206 list.copy(getNodeList(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1207 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1208 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1209 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1210 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1211 public boolean edgesEqual(Node node, Node other) { |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1212 return inputsEqual(node, other) && successorsEqual(node, other); |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1213 } |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1214 |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1215 public boolean inputsEqual(Node node, Node other) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1216 assert node.getClass() == clazz && other.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1217 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1218 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1219 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
|
1220 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1221 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1222 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1223 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1224 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1225 NodeList<Node> list = getNodeList(other, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1226 if (!list.equals(getNodeList(node, inputOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1227 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1228 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1229 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1230 } |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1231 return true; |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1232 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1233 |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1234 public boolean successorsEqual(Node node, Node other) { |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1235 assert node.getClass() == clazz && other.getClass() == clazz; |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1236 int index = 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1237 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1238 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
|
1239 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1240 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1241 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1242 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1243 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1244 NodeList<Node> list = getNodeList(other, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1245 if (!list.equals(getNodeList(node, successorOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1246 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1247 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1248 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1249 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1250 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1251 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1252 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1253 public boolean inputContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1254 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1255 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1256 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1257 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1258 if (getNode(node, inputOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1259 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1260 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1261 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1262 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1263 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1264 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1265 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1266 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1267 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1268 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1269 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1270 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1271 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1272 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1273 public boolean successorContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1274 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1275 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1276 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1277 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1278 if (getNode(node, successorOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1279 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1280 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1281 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1282 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1283 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1284 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1285 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1286 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1287 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1288 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1289 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1290 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1291 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1292 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1293 public Collection<Position> getFirstLevelInputPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1294 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1295 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1296 public Iterator<Position> iterator() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1297 return new Iterator<NodeClass.Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1298 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1299 |
12558 | 1300 @Override |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1301 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1302 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1303 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1304 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1305 public Position next() { |
12510
11dc3108904f
Fix NodeClass.getFirstLevel(Input|Successor)Positions to use the NODE_LIST constant instead of 0
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12483
diff
changeset
|
1306 Position pos = new Position(true, i, i >= directInputCount ? NODE_LIST : NOT_ITERABLE); |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1307 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1308 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1309 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1310 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1311 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1312 return i < inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1313 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1314 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1315 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1316 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1317 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1318 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1319 return inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1320 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1321 }; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1322 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1323 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1324 public Collection<Position> getFirstLevelSuccessorPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1325 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1326 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1327 public Iterator<Position> iterator() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1328 return new Iterator<NodeClass.Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1329 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1330 |
12558 | 1331 @Override |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1332 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1333 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1334 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1335 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1336 public Position next() { |
12510
11dc3108904f
Fix NodeClass.getFirstLevel(Input|Successor)Positions to use the NODE_LIST constant instead of 0
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12483
diff
changeset
|
1337 Position pos = new Position(false, i, i >= directSuccessorCount ? NODE_LIST : NOT_ITERABLE); |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1338 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1339 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1340 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1341 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1342 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1343 return i < successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1344 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1345 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1346 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1347 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1348 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1349 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1350 return successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1351 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1352 }; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1353 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1354 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1355 public Class<?> getJavaClass() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1356 return clazz; |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1357 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1358 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1359 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1360 * The template used to build the {@link Verbosity#Name} version. Variable part are specified |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1361 * using {i#inputName} or {p#propertyName}. |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1362 */ |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1363 public String getNameTemplate() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1364 return nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1365 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1366 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1367 interface InplaceUpdateClosure { |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1368 |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1369 Node replacement(Node node, boolean isInput); |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1370 } |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1371 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1372 static Map<Node, Node> addGraphDuplicate(final Graph graph, final Graph oldGraph, int estimatedNodeCount, Iterable<Node> nodes, final DuplicationReplacement replacements) { |
12685
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1373 final Map<Node, Node> newNodes; |
12687
43301f080126
added graph compression (GRAAL-571)
Doug Simon <doug.simon@oracle.com>
parents:
12685
diff
changeset
|
1374 if (estimatedNodeCount > (oldGraph.getNodeCount() + oldGraph.getNodesDeletedSinceLastCompression() >> 4)) { |
12685
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1375 // Use dense map |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1376 newNodes = new NodeNodeMap(oldGraph); |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1377 } else { |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1378 // Use sparse map |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1379 newNodes = new IdentityHashMap<>(); |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1380 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1381 createNodeDuplicates(graph, nodes, replacements, newNodes); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1382 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1383 InplaceUpdateClosure replacementClosure = new InplaceUpdateClosure() { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1384 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1385 public Node replacement(Node node, boolean isInput) { |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1386 Node target = newNodes.get(node); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1387 if (target == null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1388 Node replacement = node; |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1389 if (replacements != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1390 replacement = replacements.replacement(node); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1391 } |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1392 if (replacement != node) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1393 target = replacement; |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1394 } else if (node.graph() == graph && isInput) { |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1395 // patch to the outer world |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1396 target = node; |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1397 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1398 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1399 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1400 return target; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1401 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1402 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1403 }; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1404 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1405 // re-wire inputs |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1406 for (Node oldNode : nodes) { |
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1407 Node node = newNodes.get(oldNode); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1408 NodeClass oldNodeClass = oldNode.getNodeClass(); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1409 NodeClass nodeClass = node.getNodeClass(); |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1410 if (replacements == null || replacements.replacement(oldNode) == oldNode) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1411 nodeClass.updateInputSuccInPlace(node, replacementClosure); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1412 } else { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1413 transferValuesDifferentNodeClass(graph, replacements, newNodes, oldNode, node, oldNodeClass, nodeClass); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1414 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1415 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1416 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1417 return newNodes; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1418 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1419 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1420 private static void createNodeDuplicates(final Graph graph, Iterable<Node> nodes, final DuplicationReplacement replacements, final Map<Node, Node> newNodes) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1421 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
|
1422 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
|
1423 assert !node.isDeleted() : "trying to duplicate deleted node: " + node; |
11671
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1424 Node replacement = node; |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1425 if (replacements != null) { |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1426 replacement = replacements.replacement(node); |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1427 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
1428 if (replacement != node) { |
5519
cedae73d9c2a
Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
1429 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
|
1430 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
|
1431 } else { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1432 Node newNode = node.clone(graph, false); |
12612
42a2c235652f
replace ".count() == 0" with ".isEmpty()"
Doug Simon <doug.simon@oracle.com>
parents:
12574
diff
changeset
|
1433 assert newNode.inputs().isEmpty() || newNode.usages().isEmpty(); |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
1434 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
|
1435 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
|
1436 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1437 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1438 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1439 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1440 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1441 private static void transferValuesDifferentNodeClass(final Graph graph, final DuplicationReplacement replacements, final Map<Node, Node> newNodes, Node oldNode, Node node, NodeClass oldNodeClass, |
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1442 NodeClass nodeClass) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1443 for (NodeClassIterator iter = oldNode.inputs().iterator(); iter.hasNext();) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1444 Position pos = iter.nextPosition(); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1445 if (!nodeClass.isValid(pos, oldNodeClass)) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1446 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1447 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1448 Node input = oldNodeClass.get(oldNode, pos); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1449 Node target = newNodes.get(input); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1450 if (target == null) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1451 Node replacement = input; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1452 if (replacements != null) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1453 replacement = replacements.replacement(input); |
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
|
1454 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1455 if (replacement != input) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1456 assert isAssignable(nodeClass.fieldTypes.get(nodeClass.inputOffsets[pos.getIndex()]), replacement); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1457 target = replacement; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1458 } else if (input.graph() == graph) { // patch to the outer world |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1459 target = input; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1460 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1461 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1462 nodeClass.set(node, pos, target); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1463 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1464 |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1465 for (NodeClassIterator iter = oldNode.successors().iterator(); iter.hasNext();) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1466 Position pos = iter.nextPosition(); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1467 if (!nodeClass.isValid(pos, oldNodeClass)) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1468 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1469 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1470 Node succ = oldNodeClass.get(oldNode, pos); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1471 Node target = newNodes.get(succ); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1472 if (target == null) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1473 Node replacement = replacements.replacement(succ); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1474 if (replacement != succ) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1475 assert isAssignable(nodeClass.fieldTypes.get(node.getNodeClass().successorOffsets[pos.getIndex()]), replacement); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1476 target = 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
|
1477 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1478 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1479 nodeClass.set(node, pos, target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1480 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1481 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1482 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1483 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
|
1484 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
|
1485 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1486 } |