Mercurial > hg > truffle
annotate graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java @ 17147:7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 18 Sep 2014 12:22:35 +0200 |
parents | 8ec6deb7d2eb |
children | 3837c6aa9fd0 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16154
f9f7bd1a6b2c
IGV: Support for InputType.
Roland Schatz <roland.schatz@oracle.com>
parents:
15827
diff
changeset
|
2 * Copyright (c) 2011, 2014, 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.*; |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
26 import static com.oracle.graal.graph.Node.*; |
15551
33cedbce5b23
added CollectionsProvider and NodeCollectionsProvider and replaced (almost) all allocations of IdentityHashMaps to go through these providers
Doug Simon <doug.simon@oracle.com>
parents:
15295
diff
changeset
|
27 import static com.oracle.graal.graph.util.CollectionsAccess.*; |
16991
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
28 import static java.lang.reflect.Modifier.*; |
11524
dede53632f3e
removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents:
11434
diff
changeset
|
29 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
30 import java.lang.reflect.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15186
diff
changeset
|
33 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
|
34 import com.oracle.graal.debug.*; |
17147
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
35 import com.oracle.graal.debug.internal.*; |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
36 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
|
37 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
|
38 import com.oracle.graal.graph.Node.Successor; |
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
|
39 import com.oracle.graal.graph.spi.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16554
diff
changeset
|
40 import com.oracle.graal.nodeinfo.*; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
41 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
42 /** |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
43 * 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
|
44 * <ul> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
45 * <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
|
46 * 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
|
47 * <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
|
48 * </ul> |
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 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
|
51 |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
52 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
|
53 |
17147
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
54 private static final DebugTimer NodeClassCreation = Debug.timer("NodeClassCreation"); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
55 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
56 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
57 * 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
|
58 */ |
11434
0d9fe4e80ab8
moved warning suppression annotation to placate JDT
Doug Simon <doug.simon@oracle.com>
parents:
11431
diff
changeset
|
59 @SuppressWarnings("unchecked") |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
60 public static NodeClass get(Class<?> c) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
61 Class<? extends Node> key = (Class<? extends Node>) c; |
16903
3ca8ba1bfc21
bind a generated Node class to the NodeClass instance of the generated-from Node class
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
62 |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
63 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
|
64 // 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
|
65 // 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
|
66 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
|
67 // 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
|
68 // 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
|
69 synchronized (GetNodeClassLock) { |
17147
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
70 try (TimerCloseable t = NodeClassCreation.start()) { |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
71 value = (NodeClass) allClasses.get(key); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
72 if (value == null) { |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
73 GeneratedNode gen = c.getAnnotation(GeneratedNode.class); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
74 if (gen != null) { |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
75 Class<? extends Node> originalNodeClass = (Class<? extends Node>) gen.value(); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
76 value = (NodeClass) allClasses.get(originalNodeClass); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
77 assert value != null; |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
78 if (value.genClass == null) { |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
79 value.genClass = (Class<? extends Node>) c; |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
80 } else { |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
81 assert value.genClass == c; |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
82 } |
16991
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
83 } else { |
17147
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
84 value = new NodeClass(key); |
16991
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
85 } |
17147
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
86 Object old = allClasses.putIfAbsent(key, value); |
7a3f6543d383
added timer for NodeClass initializer (-Dgraal.debug.timer.NodeClassCreation=true)
Doug Simon <doug.simon@oracle.com>
parents:
17128
diff
changeset
|
87 assert old == null : old + " " + key; |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
88 } |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
89 } |
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
90 } |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
91 } |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15040
diff
changeset
|
92 return value; |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
93 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
94 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 private static int nextIterableId = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 private final int directInputCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 private final long[] inputOffsets; |
15001 | 103 private final InputType[] inputTypes; |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
104 private final boolean[] inputOptional; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 private final int directSuccessorCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 private final long[] successorOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 private final Class<?>[] dataTypes; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 private final boolean canGVN; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 private final int startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 private final String shortName; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
111 private final String nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 private final int iterableId; |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
113 private final EnumSet<InputType> allowedUsageTypes; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
114 private int[] iterableIds; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 |
16991
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
116 /** |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
117 * The {@linkplain GeneratedNode generated} node class denoted by this object. This value is |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
118 * lazily initialized to avoid class initialization circularity issues. A sentinel value of |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
119 * {@code Node.class} is used to denote absence of a generated class. |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
120 */ |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
121 private Class<? extends Node> genClass; |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
122 |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
123 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
|
124 private final DebugMetric nodeIterableCount; |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
125 |
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
|
126 /** |
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
|
127 * 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
|
128 */ |
16239
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
129 private final boolean isCanonicalizable; |
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
|
130 |
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
|
131 /** |
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
|
132 * 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
|
133 */ |
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
|
134 private final boolean isSimplifiable; |
16919
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16903
diff
changeset
|
135 private final boolean isLeafNode; |
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
|
136 |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
137 public NodeClass(Class<?> clazz) { |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
138 this(clazz, new DefaultCalcOffset(), null, 0); |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
139 } |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
140 |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
141 /** |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
142 * Defines the order of fields in a node class that accessed via {@link Position}s. |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
143 */ |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
144 public interface PositionFieldOrder { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
145 /** |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
146 * Gets a field ordering specified by an ordered field name list. The only guarantee |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
147 * provided by this method is that all {@link NodeList} fields are preceded by all non |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
148 * {@link NodeList} fields. |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
149 * |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
150 * @param input specified whether input or successor field order is being requested |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
151 */ |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
152 String[] getOrderedFieldNames(boolean input); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
153 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
154 |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
155 private static long[] sortedOffsets(boolean input, PositionFieldOrder pfo, Map<Long, String> names, ArrayList<Long> list1, ArrayList<Long> list2) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
156 if (list1.isEmpty() && list2.isEmpty()) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
157 return new long[0]; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
158 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
159 if (pfo != null) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
160 List<String> fields = Arrays.asList(pfo.getOrderedFieldNames(input)); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
161 long[] offsets = new long[fields.size()]; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
162 assert list1.size() + list2.size() == fields.size(); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
163 for (Map.Entry<Long, String> e : names.entrySet()) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
164 int index = fields.indexOf(e.getValue()); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
165 if (index != -1) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
166 offsets[index] = e.getKey(); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
167 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
168 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
169 return offsets; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
170 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
171 return sortedLongCopy(list1, list2); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
172 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
173 |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
174 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
|
175 super(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 assert NODE_CLASS.isAssignableFrom(clazz); |
16239
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
177 |
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
178 this.isCanonicalizable = Canonicalizable.class.isAssignableFrom(clazz); |
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
179 if (Canonicalizable.Unary.class.isAssignableFrom(clazz) || Canonicalizable.Binary.class.isAssignableFrom(clazz)) { |
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
180 assert Canonicalizable.Unary.class.isAssignableFrom(clazz) ^ Canonicalizable.Binary.class.isAssignableFrom(clazz) : clazz + " should implement either Unary or Binary, not both"; |
16206
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
181 } |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
182 |
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
|
183 this.isSimplifiable = Simplifiable.class.isAssignableFrom(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
185 FieldScanner scanner = new FieldScanner(calcOffset); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 directInputCount = scanner.inputOffsets.size(); |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
189 |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
190 isLeafNode = scanner.inputOffsets.isEmpty() && scanner.inputListOffsets.isEmpty() && scanner.successorOffsets.isEmpty() && scanner.successorListOffsets.isEmpty(); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
191 |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
192 PositionFieldOrder pfo = lookupPositionFieldOrder(clazz); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
193 |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
194 inputOffsets = sortedOffsets(true, pfo, scanner.fieldNames, scanner.inputOffsets, scanner.inputListOffsets); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
195 |
15001 | 196 inputTypes = new InputType[inputOffsets.length]; |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
197 inputOptional = new boolean[inputOffsets.length]; |
15001 | 198 for (int i = 0; i < inputOffsets.length; i++) { |
199 inputTypes[i] = scanner.types.get(inputOffsets[i]); | |
200 assert inputTypes[i] != null; | |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
201 inputOptional[i] = scanner.optionalInputs.contains(inputOffsets[i]); |
15001 | 202 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 directSuccessorCount = scanner.successorOffsets.size(); |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
204 successorOffsets = sortedOffsets(false, pfo, scanner.fieldNames, scanner.successorOffsets, scanner.successorListOffsets); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
205 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
206 dataOffsets = sortedLongCopy(scanner.dataOffsets); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
207 dataTypes = new Class[dataOffsets.length]; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
208 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
|
209 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
211 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
212 fieldNames = scanner.fieldNames; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
213 fieldTypes = scanner.fieldTypes; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 startGVNNumber = clazz.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
218 String newShortName = clazz.getSimpleName(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
219 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
|
220 newShortName = newShortName.substring(0, newShortName.length() - 4); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
222 String newNameTemplate = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 NodeInfo info = clazz.getAnnotation(NodeInfo.class); |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
224 assert info != null : "missing " + NodeInfo.class.getSimpleName() + " annotation on " + clazz; |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
225 if (!info.shortName().isEmpty()) { |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
226 newShortName = info.shortName(); |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
227 } |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
228 if (!info.nameTemplate().isEmpty()) { |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
229 newNameTemplate = info.nameTemplate(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 } |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
231 EnumSet<InputType> newAllowedUsageTypes = EnumSet.noneOf(InputType.class); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
232 Class<?> current = clazz; |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
233 do { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
234 NodeInfo currentInfo = current.getAnnotation(NodeInfo.class); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
235 if (currentInfo != null) { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
236 if (currentInfo.allowedUsageTypes().length > 0) { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
237 newAllowedUsageTypes.addAll(Arrays.asList(currentInfo.allowedUsageTypes())); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
238 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
239 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
240 current = current.getSuperclass(); |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
241 } while (current != Node.class); |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
242 this.nameTemplate = newNameTemplate == null ? newShortName : newNameTemplate; |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
243 this.allowedUsageTypes = newAllowedUsageTypes; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
244 this.shortName = newShortName; |
13127
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
245 if (presetIterableIds != null) { |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
246 this.iterableIds = presetIterableIds; |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
247 this.iterableId = presetIterableId; |
f42f1f5d5ce0
Allow custom field offset providers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12701
diff
changeset
|
248 } 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
|
249 ITERABLE_NODE_TYPES.increment(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 this.iterableId = nextIterableId++; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
251 List<NodeClass> existingClasses = new LinkedList<>(); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
252 for (FieldIntrospection nodeClass : allClasses.values()) { |
16987
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
253 // There are duplicate entries in allClasses when using generated nodes |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
254 // hence the extra logic below guarded by USE_GENERATED_NODES |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
255 if (clazz.isAssignableFrom(nodeClass.getClazz())) { |
16987
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
256 if (!USE_GENERATED_NODES || !existingClasses.contains(nodeClass)) { |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
257 existingClasses.add((NodeClass) nodeClass); |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
258 } |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
259 } |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
260 if (nodeClass.getClazz().isAssignableFrom(clazz) && IterableNodeType.class.isAssignableFrom(nodeClass.getClazz())) { |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
261 NodeClass superNodeClass = (NodeClass) nodeClass; |
17128
8ec6deb7d2eb
Fix when not using generated node classes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17051
diff
changeset
|
262 if (!containsId(this.iterableId, superNodeClass.iterableIds)) { |
16987
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
263 superNodeClass.iterableIds = Arrays.copyOf(superNodeClass.iterableIds, superNodeClass.iterableIds.length + 1); |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
264 superNodeClass.iterableIds[superNodeClass.iterableIds.length - 1] = this.iterableId; |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
265 } |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
266 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
267 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
268 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
|
269 ids[0] = iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
270 int i = 1; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
271 for (NodeClass other : existingClasses) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
272 ids[i++] = other.iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
273 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
274 this.iterableIds = ids; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 } else { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
276 this.iterableId = Node.NOT_ITERABLE; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
277 this.iterableIds = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
278 } |
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
|
279 nodeIterableCount = Debug.metric("NodeIterable_%s", shortName); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
282 private PositionFieldOrder lookupPositionFieldOrder(Class<?> clazz) throws GraalInternalError { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
283 if (USE_GENERATED_NODES && !isAbstract(clazz.getModifiers()) && !isLeafNode) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
284 String name = clazz.getName().replace('$', '_') + "Gen$FieldOrder"; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
285 try { |
17009
2c04d7665bf6
use the right class loader when loading generated PositionFieldOrder class
Doug Simon <doug.simon@oracle.com>
parents:
17008
diff
changeset
|
286 return (PositionFieldOrder) Class.forName(name, true, getClazz().getClassLoader()).newInstance(); |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
287 } catch (Exception e) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
288 throw new GraalInternalError("Could not find generated class " + name + " for " + getClazz()); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
289 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
290 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
291 return null; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
292 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
293 |
16991
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
294 /** |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
295 * Gets the {@linkplain GeneratedNode generated} node class (if any) described by the object. |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
296 */ |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
297 @SuppressWarnings("unchecked") |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
298 public Class<? extends Node> getGenClass() { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
299 if (USE_GENERATED_NODES) { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
300 if (genClass == null) { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
301 if (!isAbstract(getClazz().getModifiers())) { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
302 String genClassName = getClazz().getName().replace('$', '_') + "Gen"; |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
303 try { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
304 genClass = (Class<? extends Node>) Class.forName(genClassName); |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
305 } catch (ClassNotFoundException e) { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
306 throw new GraalInternalError("Could not find generated class " + genClassName + " for " + getClazz()); |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
307 } |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
308 } else { |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
309 // Sentinel value denoting no generated class |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
310 genClass = Node.class; |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
311 } |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
312 } |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
313 return genClass.equals(Node.class) ? null : genClass; |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
314 } |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
315 return null; |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
316 } |
4a6d852dbb68
added support to get the generated Node class represented by a NodeClass instance
Doug Simon <doug.simon@oracle.com>
parents:
16987
diff
changeset
|
317 |
16987
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
318 private static boolean containsId(int iterableId, int[] iterableIds) { |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
319 for (int i : iterableIds) { |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
320 if (i == iterableId) { |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
321 return true; |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
322 } |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
323 } |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
324 return false; |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
325 } |
39d979dae809
need extra logic when computing Node iterable ids and USE_GENERATED_NODES == true
Doug Simon <doug.simon@oracle.com>
parents:
16986
diff
changeset
|
326 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
327 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
328 protected void rescanFieldOffsets(CalcOffset calc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 FieldScanner scanner = new FieldScanner(calc); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
330 scanner.scan(getClazz()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
331 assert directInputCount == scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 copyInto(inputOffsets, sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
333 assert directSuccessorCount == scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 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
|
335 copyInto(dataOffsets, sortedLongCopy(scanner.dataOffsets)); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
336 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
337 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
|
338 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
341 fieldNames.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
342 fieldNames.putAll(scanner.fieldNames); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
343 fieldTypes.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
344 fieldTypes.putAll(scanner.fieldTypes); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
347 /** |
17051
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
348 * Determines if a given {@link Node} class is described by this {@link NodeClass} object. This |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
349 * is useful for doing an exact type test (as opposed to an instanceof test) on a node. For |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
350 * example: |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
351 * |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
352 * <pre> |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
353 * if (node.getNodeClass().is(BeginNode.class)) { ... } |
17128
8ec6deb7d2eb
Fix when not using generated node classes
Christian Wimmer <christian.wimmer@oracle.com>
parents:
17051
diff
changeset
|
354 * |
17051
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
355 * // Due to generated Node classes, the test below |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
356 * // is *not* the same as the test above: |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
357 * if (node.getClass() == BeginNode.class) { ... } |
c25fcf343b4f
improved javadoc for NodeClass.is()
Doug Simon <doug.simon@oracle.com>
parents:
17044
diff
changeset
|
358 * </pre> |
16986
f7359a0ce946
tweaked comparison of a Node against a node class
Doug Simon <doug.simon@oracle.com>
parents:
16982
diff
changeset
|
359 * |
f7359a0ce946
tweaked comparison of a Node against a node class
Doug Simon <doug.simon@oracle.com>
parents:
16982
diff
changeset
|
360 * @param nodeClass a {@linkplain GeneratedNode non-generated} {@link Node} class |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
361 */ |
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
362 public boolean is(Class<? extends Node> nodeClass) { |
16986
f7359a0ce946
tweaked comparison of a Node against a node class
Doug Simon <doug.simon@oracle.com>
parents:
16982
diff
changeset
|
363 assert nodeClass.getAnnotation(GeneratedNode.class) == null : "cannot test NodeClas against generated " + nodeClass; |
f7359a0ce946
tweaked comparison of a Node against a node class
Doug Simon <doug.simon@oracle.com>
parents:
16982
diff
changeset
|
364 return nodeClass == getClazz(); |
16903
3ca8ba1bfc21
bind a generated Node class to the NodeClass instance of the generated-from Node class
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
365 } |
3ca8ba1bfc21
bind a generated Node class to the NodeClass instance of the generated-from Node class
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
366 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 public String shortName() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
368 return shortName; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
371 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
|
372 nodeIterableCount.increment(); |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
373 return iterableIds; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
374 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
375 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 public int iterableId() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 return iterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 public boolean valueNumberable() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 return canGVN; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
382 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 |
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
|
384 /** |
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
|
385 * 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
|
386 */ |
16239
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
387 public boolean isCanonicalizable() { |
de84713267fa
use default methods to select Canonicalizable behavior
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16206
diff
changeset
|
388 return isCanonicalizable; |
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
|
389 } |
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
|
390 |
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
|
391 /** |
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
|
392 * 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
|
393 */ |
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
|
394 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
|
395 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
|
396 } |
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
|
397 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 public static int cacheSize() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 return nextIterableId; |
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 |
15002
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
402 public EnumSet<InputType> getAllowedUsageTypes() { |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
403 return allowedUsageTypes; |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
404 } |
06e50d290784
isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
405 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
406 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
|
407 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
408 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
|
409 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
|
410 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
|
411 public final ArrayList<Long> successorListOffsets = new ArrayList<>(); |
15001 | 412 public final HashMap<Long, InputType> types = new HashMap<>(); |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
413 public final HashSet<Long> optionalInputs = new HashSet<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
415 protected FieldScanner(CalcOffset calc) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
416 super(calc); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
419 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
420 protected void scanField(Field field, Class<?> type, long offset) { |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
421 if (field.isAnnotationPresent(Node.Input.class) || field.isAnnotationPresent(Node.OptionalInput.class)) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
422 assert !field.isAnnotationPresent(Node.Successor.class) : "field cannot be both input and successor"; |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
423 assert field.isAnnotationPresent(Node.Input.class) ^ field.isAnnotationPresent(Node.OptionalInput.class) : "inputs can either be optional or non-optional"; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
424 if (INPUT_LIST_CLASS.isAssignableFrom(type)) { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
425 // NodeInputList fields should not be final since they are |
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
426 // written (via Unsafe) in clearInputs() |
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
427 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "NodeInputList input field %s should not be final", field); |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
428 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
|
429 inputListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
430 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
431 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
|
432 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node input field %s should not be final", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
433 inputOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
434 } |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
435 if (field.isAnnotationPresent(Node.Input.class)) { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
436 types.put(offset, field.getAnnotation(Node.Input.class).value()); |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
437 } else { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
438 types.put(offset, field.getAnnotation(Node.OptionalInput.class).value()); |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
439 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
440 if (field.isAnnotationPresent(Node.OptionalInput.class)) { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
441 optionalInputs.add(offset); |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
442 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
443 } 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
|
444 if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
445 // NodeSuccessorList fields should not be final since they are |
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
446 // written (via Unsafe) in clearSuccessors() |
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
447 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "NodeSuccessorList successor field % should not be final", field); |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
448 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
|
449 successorListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
450 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
451 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
|
452 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node successor field %s should not be final", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
453 successorOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
454 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
455 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
456 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
|
457 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
|
458 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
|
459 dataOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
460 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 StringBuilder str = new StringBuilder(); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
467 str.append("NodeClass ").append(getClazz().getSimpleName()).append(" ["); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 for (int i = 0; i < inputOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 str.append(i == 0 ? "" : ", ").append(inputOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 for (int i = 0; i < successorOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 str.append(i == 0 ? "" : ", ").append(successorOffsets[i]); |
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 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 for (int i = 0; i < dataOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 str.append(i == 0 ? "" : ", ").append(dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 str.append("]"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 return str.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 private static Node getNode(Node node, long offset) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 return (Node) unsafe.getObject(node, offset); |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 @SuppressWarnings("unchecked") |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 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
|
489 return (NodeList<Node>) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 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
|
493 unsafe.putObject(node, offset, value); |
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 |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15002
diff
changeset
|
496 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
|
497 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 } |
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 /** |
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
|
501 * 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
|
502 * {@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
|
503 * 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
|
504 * 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
|
505 * successors of a node. |
15001 | 506 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
507 * 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
|
508 * 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
|
509 */ |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
510 public abstract static class NodeClassIterator implements NodePosIterator { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
511 protected final Node node; |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
512 protected int index; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
513 protected int subIndex; |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
514 NodeList<Node> list; |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
515 protected boolean needsForward; |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
516 protected Node nextElement; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
517 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
518 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 * Creates an iterator that will iterate over fields in the given node. |
15001 | 520 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 * @param node the node which contains the fields. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
522 */ |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
523 NodeClassIterator(Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
524 this.node = node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
525 index = NOT_ITERABLE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
526 subIndex = 0; |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
527 needsForward = true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
528 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
529 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
530 void forward() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
531 needsForward = false; |
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
|
532 if (index < getDirectCount()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
533 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
|
534 while (index < getDirectCount()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
535 nextElement = getNode(node, getOffsets()[index]); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
536 if (nextElement != null) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
537 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
540 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
541 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
542 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
543 } |
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
|
544 while (index < getOffsets().length) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
545 if (subIndex == 0) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
546 list = getNodeList(node, getOffsets()[index]); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
547 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
548 while (subIndex < list.size()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
549 nextElement = list.get(subIndex); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
550 if (nextElement != null) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
551 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
552 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
553 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
554 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
555 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
556 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
557 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
558 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
559 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
560 private Node nextElement() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
561 if (needsForward) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
562 forward(); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
563 } |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
564 needsForward = true; |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
565 if (index < getOffsets().length) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
566 return nextElement; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
567 } |
7258
9bee93f61522
Cleanups: remove unused NodeUsagesList.replaceFirst and FrameState.block
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7123
diff
changeset
|
568 throw new NoSuchElementException(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
569 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
570 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
571 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 public boolean hasNext() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
573 if (needsForward) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
574 forward(); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
575 } |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
576 return index < getOffsets().length; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
578 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
579 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
580 public Node next() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
581 return nextElement(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
582 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
583 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
584 public Position nextPosition() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
585 if (needsForward) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
586 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
587 } |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
588 needsForward = true; |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
589 if (index < getDirectCount()) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
590 return new Position(getOffsets() == getNodeClass().inputOffsets, index, NOT_ITERABLE); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
591 } else { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
592 return new Position(getOffsets() == getNodeClass().inputOffsets, index, subIndex); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
593 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 public void remove() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
599 } |
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
|
600 |
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
|
601 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
|
602 |
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
|
603 protected abstract long[] getOffsets(); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
604 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
605 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
|
606 } |
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
|
607 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
608 private class NodeClassInputsIterator extends NodeClassIterator { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
609 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
610 NodeClassInputsIterator(Node node) { |
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
|
611 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
612 assert NodeClass.this == node.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
|
613 } |
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
|
614 |
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
|
615 @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
|
616 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
|
617 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
|
618 } |
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
|
619 |
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
|
620 @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
|
621 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
|
622 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
|
623 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
624 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
625 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
626 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
627 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
628 } |
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
|
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 |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
631 private class NodeClassAllInputsIterator extends NodeClassInputsIterator { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
632 NodeClassAllInputsIterator(Node node) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
633 super(node); |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
634 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
635 |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
636 @Override |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
637 void forward() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
638 needsForward = false; |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
639 if (index < getDirectCount()) { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
640 index++; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
641 if (index < getDirectCount()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
642 nextElement = getNode(node, getOffsets()[index]); |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
643 return; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
644 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
645 } else { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
646 subIndex++; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
647 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
648 while (index < getOffsets().length) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
649 if (subIndex == 0) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
650 list = getNodeList(node, getOffsets()[index]); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
651 } |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
652 if (subIndex < list.size()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
653 nextElement = list.get(subIndex); |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
654 return; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
655 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
656 subIndex = 0; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
657 index++; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
658 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
659 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
660 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
661 |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
662 private class NodeClassAllSuccessorsIterator extends NodeClassSuccessorsIterator { |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
663 NodeClassAllSuccessorsIterator(Node node) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
664 super(node); |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
665 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
666 |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
667 @Override |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
668 void forward() { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
669 needsForward = false; |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
670 if (index < getDirectCount()) { |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
671 index++; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
672 if (index < getDirectCount()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
673 nextElement = getNode(node, getOffsets()[index]); |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
674 return; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
675 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
676 } else { |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
677 subIndex++; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
678 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
679 while (index < getOffsets().length) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
680 if (subIndex == 0) { |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
681 list = getNodeList(node, getOffsets()[index]); |
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
682 } |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
683 if (subIndex < list.size()) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
684 nextElement = list.get(subIndex); |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
685 return; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
686 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
687 subIndex = 0; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
688 index++; |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
689 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
690 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
691 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
692 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
693 private final class NodeClassInputsWithModCountIterator extends NodeClassInputsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
694 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
695 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
696 private NodeClassInputsWithModCountIterator(Node node) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
697 super(node); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
698 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
699 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
700 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
701 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
702 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
703 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
704 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
705 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
706 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
707 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
|
708 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
709 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
710 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
711 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
712 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
713 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
714 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
715 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
716 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
|
717 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
718 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
719 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
720 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
721 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
722 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
723 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
724 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
725 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
726 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
727 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
728 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
729 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
730 private class NodeClassSuccessorsIterator extends NodeClassIterator { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
731 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
732 NodeClassSuccessorsIterator(Node node) { |
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
|
733 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
734 assert NodeClass.this == node.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
|
735 } |
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
|
736 |
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
|
737 @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
|
738 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
|
739 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
|
740 } |
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
|
741 |
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
|
742 @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
|
743 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
|
744 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
|
745 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
746 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
747 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
748 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
749 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
750 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
751 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
752 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
753 private final class NodeClassSuccessorsWithModCountIterator extends NodeClassSuccessorsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
754 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
755 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
756 private NodeClassSuccessorsWithModCountIterator(Node node) { |
17044
d5289a18cf5d
NodeClassIterator advances lazily instead of eagerly, allowing the next element to be cached in the advance operation
Doug Simon <doug.simon@oracle.com>
parents:
17009
diff
changeset
|
757 super(node); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
758 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
759 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
760 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
761 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
762 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
763 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
764 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
765 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
766 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
767 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
|
768 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
769 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
770 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
771 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
772 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
773 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
774 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
775 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
776 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
|
777 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
778 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
779 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
780 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
781 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
782 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
783 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
784 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
785 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
786 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
787 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
788 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
789 |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
790 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
|
791 if (o instanceof Object[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
792 return Arrays.deepHashCode((Object[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
793 } else if (o instanceof byte[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
794 return Arrays.hashCode((byte[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
795 } else if (o instanceof short[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
796 return Arrays.hashCode((short[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
797 } else if (o instanceof int[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
798 return Arrays.hashCode((int[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
799 } else if (o instanceof long[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
800 return Arrays.hashCode((long[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
801 } else if (o instanceof char[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
802 return Arrays.hashCode((char[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
803 } else if (o instanceof float[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
804 return Arrays.hashCode((float[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
805 } else if (o instanceof double[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
806 return Arrays.hashCode((double[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
807 } else if (o instanceof boolean[]) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
808 return Arrays.hashCode((boolean[]) o); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
809 } else if (o != null) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
810 return o.hashCode(); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
811 } else { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
812 return 0; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
813 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
814 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
815 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
816 public int valueNumber(Node n) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
817 int number = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
818 if (canGVN) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
819 number = startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
820 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
|
821 Class<?> type = dataTypes[i]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
822 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
823 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
824 int intValue = unsafe.getInt(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
825 number += intValue; |
6657
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
826 } else if (type == Long.TYPE) { |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
827 long longValue = unsafe.getLong(n, dataOffsets[i]); |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
828 number += longValue ^ (longValue >>> 32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
829 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
830 boolean booleanValue = unsafe.getBoolean(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
831 if (booleanValue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
832 number += 7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
833 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
834 } 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
|
835 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
|
836 number += Float.floatToRawIntBits(floatValue); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
837 } 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
|
838 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
|
839 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
|
840 number += longValue ^ (longValue >>> 32); |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
841 } 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
|
842 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
|
843 number += shortValue; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
844 } 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
|
845 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
|
846 number += charValue; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
847 } 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
|
848 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
|
849 number += byteValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
850 } else { |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
851 assert false : "unhandled property type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
852 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
853 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
854 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
|
855 number += deepHashCode0(o); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
856 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
857 number *= 13; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
858 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
859 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
860 return number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
861 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
862 |
12696
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
863 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
|
864 assert e1 != null; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
865 boolean eq; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
866 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
|
867 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
|
868 } 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
|
869 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
|
870 } 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
|
871 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
|
872 } 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
|
873 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
|
874 } 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
|
875 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
|
876 } 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
|
877 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
|
878 } 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
|
879 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
|
880 } 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
|
881 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
|
882 } 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
|
883 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
|
884 } else { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
885 eq = e1.equals(e2); |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
886 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
887 return eq; |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
888 } |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
889 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
890 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
|
891 if (a.getClass() != b.getClass()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
892 return a == b; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
893 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
894 for (int i = 0; i < dataOffsets.length; ++i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
895 Class<?> type = dataTypes[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
896 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
897 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
898 int aInt = unsafe.getInt(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
899 int bInt = unsafe.getInt(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
900 if (aInt != bInt) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
901 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
902 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
903 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
904 boolean aBoolean = unsafe.getBoolean(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
905 boolean bBoolean = unsafe.getBoolean(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
906 if (aBoolean != bBoolean) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
907 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
908 } |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
909 } else if (type == Long.TYPE) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
910 long aLong = unsafe.getLong(a, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
911 long bLong = unsafe.getLong(b, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
912 if (aLong != bLong) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
913 return false; |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
914 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
915 } 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
|
916 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
|
917 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
|
918 if (aFloat != bFloat) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
919 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
920 } |
10785
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
921 } 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 } |
12701
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
927 } 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
|
928 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
|
929 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
|
930 if (aShort != bShort) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
931 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
932 } |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
933 } 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
|
934 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
|
935 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
|
936 if (aChar != bChar) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
937 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
938 } |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
939 } 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
|
940 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
|
941 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
|
942 if (aByte != bByte) { |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
943 return false; |
42a60780c2c9
Add some missing cases for NodeClass.(getDebugProperties|valueEqual|valueNumber)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12696
diff
changeset
|
944 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
945 } else { |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
946 assert false : "unhandled type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
947 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
948 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
949 Object objectA = unsafe.getObject(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
950 Object objectB = unsafe.getObject(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
951 if (objectA != objectB) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
952 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
|
953 if (!deepEquals0(objectA, objectB)) { |
22780dc399da
Support arbitrary array types in global value numbering.
Roland Schatz <roland.schatz@oracle.com>
parents:
12687
diff
changeset
|
954 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
955 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
956 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
957 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
958 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
959 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
960 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
961 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
962 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
963 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
964 |
5214 | 965 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
|
966 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
|
967 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
|
968 } |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
969 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
|
970 if (pos.getIndex() >= offsets.length) { |
5214 | 971 return false; |
972 } | |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
973 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
|
974 if (pos.getIndex() >= fromOffsets.length) { |
5214 | 975 return false; |
976 } | |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
977 return offsets[pos.getIndex()] == fromOffsets[pos.getIndex()]; |
5214 | 978 } |
979 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
980 public Node get(Node node, Position pos) { |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
981 if (Node.USE_GENERATED_NODES) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
982 return node.getNodeAt(pos); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
983 } |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
984 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
|
985 if (pos.getSubIndex() == NOT_ITERABLE) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
986 return getNode(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
987 } else { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
988 return getNodeList(node, offset).get(pos.getSubIndex()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
989 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
990 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
991 |
15001 | 992 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
|
993 assert pos.isInput(); |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
994 return inputTypes[pos.getIndex()]; |
15001 | 995 } |
996 | |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
997 public boolean isInputOptional(Position pos) { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
998 assert pos.isInput(); |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
999 return inputOptional[pos.getIndex()]; |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1000 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1001 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1002 public NodeList<?> getNodeList(Node node, Position pos) { |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1003 if (Node.USE_GENERATED_NODES) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1004 return node.getNodeListAt(pos); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1005 } |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1006 long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
1007 assert pos.getSubIndex() == Node.NODE_LIST; |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1008 return getNodeList(node, offset); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1009 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1010 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1011 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
|
1012 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
|
1013 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1014 |
15827
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1015 public String getPropertyName(int pos) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1016 return fieldNames.get(dataOffsets[pos]); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1017 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1018 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1019 public Class<?> getPropertyType(int pos) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1020 return fieldTypes.get(dataOffsets[pos]); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1021 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1022 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1023 public Object getProperty(Node node, int pos) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1024 long dataOffset = dataOffsets[pos]; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1025 Class<?> type = fieldTypes.get(dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1026 Object value = null; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1027 if (type.isPrimitive()) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1028 if (type == Integer.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1029 value = unsafe.getInt(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1030 } else if (type == Long.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1031 value = unsafe.getLong(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1032 } else if (type == Boolean.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1033 value = unsafe.getBoolean(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1034 } else if (type == Float.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1035 value = unsafe.getFloat(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1036 } else if (type == Double.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1037 value = unsafe.getDouble(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1038 } else if (type == Short.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1039 value = unsafe.getShort(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1040 } else if (type == Character.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1041 value = unsafe.getChar(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1042 } else if (type == Byte.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1043 value = unsafe.getByte(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1044 } else { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1045 assert false : "unhandled property type: " + type; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1046 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1047 } else { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1048 value = unsafe.getObject(node, dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1049 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1050 return value; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1051 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1052 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1053 public void setProperty(Node node, int pos, Object value) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1054 long dataOffset = dataOffsets[pos]; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1055 Class<?> type = fieldTypes.get(dataOffset); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1056 if (type.isPrimitive()) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1057 if (type == Integer.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1058 unsafe.putInt(node, dataOffset, (Integer) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1059 } else if (type == Long.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1060 unsafe.putLong(node, dataOffset, (Long) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1061 } else if (type == Boolean.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1062 unsafe.putBoolean(node, dataOffset, (Boolean) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1063 } else if (type == Float.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1064 unsafe.putFloat(node, dataOffset, (Float) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1065 } else if (type == Double.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1066 unsafe.putDouble(node, dataOffset, (Double) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1067 } else if (type == Short.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1068 unsafe.putShort(node, dataOffset, (Short) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1069 } else if (type == Character.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1070 unsafe.putChar(node, dataOffset, (Character) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1071 } else if (type == Byte.TYPE) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1072 unsafe.putByte(node, dataOffset, (Byte) value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1073 } else { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1074 assert false : "unhandled property type: " + type; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1075 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1076 } else { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1077 assert value == null || !value.getClass().isPrimitive(); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1078 unsafe.putObject(node, dataOffset, value); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1079 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1080 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1081 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1082 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
|
1083 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
|
1084 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
|
1085 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
|
1086 if (input != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1087 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
|
1088 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
|
1089 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
|
1090 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
|
1091 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
|
1092 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1093 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1094 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1095 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1096 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
|
1097 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
|
1098 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1099 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1100 index = 0; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1101 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
|
1102 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
|
1103 if (successor != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1104 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
|
1105 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
|
1106 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
|
1107 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
|
1108 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
|
1109 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1110 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1111 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1112 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1113 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
|
1114 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
|
1115 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1116 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1117 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1118 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
|
1119 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
|
1120 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
|
1121 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1122 assert list != null : getClazz(); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1123 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
|
1124 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1125 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1126 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1127 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1128 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
|
1129 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
|
1130 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
|
1131 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1132 assert list != null : getClazz(); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1133 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
|
1134 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1135 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1136 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1137 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1144 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
|
1145 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
|
1146 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1147 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1148 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1149 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1150 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
1156 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1157 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
|
1158 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
|
1159 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1160 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1161 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1162 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1163 |
7283
3964f3d4eb18
Extend loop unswicthing to Switch nodes (integer or type)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7258
diff
changeset
|
1164 public void set(Node node, Position pos, Node x) { |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1165 if (Node.USE_GENERATED_NODES) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1166 node.updateNodeAt(pos, x); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1167 return; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1168 } |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1169 |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1170 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
|
1171 if (pos.getSubIndex() == NOT_ITERABLE) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1172 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
|
1173 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
|
1174 putNode(node, offset, x); |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1175 if (pos.isInput()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1176 node.updateUsages(old, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1177 } else { |
5487
9743ae819f73
Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5486
diff
changeset
|
1178 node.updatePredecessor(old, x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1179 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1180 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1181 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
|
1182 if (pos.getSubIndex() < list.size()) { |
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1183 list.set(pos.getSubIndex(), x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1184 } else { |
15827
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1185 while (list.size() < pos.getSubIndex()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1186 list.add(null); |
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 list.add(x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1189 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1190 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1191 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1192 |
16206
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1193 public void initializePosition(Node node, Position pos, Node x) { |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1194 if (Node.USE_GENERATED_NODES) { |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1195 node.initializeNodeAt(pos, x); |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1196 return; |
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1197 } |
16206
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1198 long offset = pos.isInput() ? inputOffsets[pos.getIndex()] : successorOffsets[pos.getIndex()]; |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1199 if (pos.getSubIndex() == NOT_ITERABLE) { |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1200 assert x == null || fieldTypes.get((pos.isInput() ? inputOffsets : successorOffsets)[pos.getIndex()]).isAssignableFrom(x.getClass()) : this + ".set(node, pos, " + x + ")"; |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1201 putNode(node, offset, x); |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1202 } else { |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1203 NodeList<Node> list = getNodeList(node, offset); |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1204 while (list.size() <= pos.getSubIndex()) { |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1205 list.add(null); |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1206 } |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1207 list.initialize(pos.getSubIndex(), x); |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1208 } |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1209 } |
2a1f3a8f76f1
handle Canonicalizable.Unary/Binary in CanonicalizerPhase and EquationalReasoner
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16154
diff
changeset
|
1210 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1211 public NodeClassIterable getInputIterable(final Node node) { |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1212 assert getClazz().isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1213 return new NodeClassIterable() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1214 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1215 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1216 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1217 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1218 return new NodeClassInputsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1219 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1220 return new NodeClassInputsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1221 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1222 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1223 |
16332
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1224 public NodeClassIterator withNullIterator() { |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1225 return new NodeClassAllInputsIterator(node); |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1226 } |
ddd68e267e34
explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16239
diff
changeset
|
1227 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1228 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1229 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1230 return inputContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1231 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1232 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1234 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1235 public NodeClassIterable getSuccessorIterable(final Node node) { |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1236 assert getClazz().isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
1237 return new NodeClassIterable() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1238 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1239 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1240 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1241 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1242 return new NodeClassSuccessorsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1243 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1244 return new NodeClassSuccessorsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
1245 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1246 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1247 |
16337
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
1248 public NodeClassIterator withNullIterator() { |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
1249 return new NodeClassAllSuccessorsIterator(node); |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
1250 } |
67f3267a8846
code and javadoc cleanups in Canonicalizable and NodeClassIterable
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16332
diff
changeset
|
1251 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1252 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1253 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1254 return successorContains(node, other); |
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 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1258 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1259 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
|
1260 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1261 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1262 Node input = getNode(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1263 if (input == old) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1264 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
|
1265 " in " + node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1266 putNode(node, inputOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1267 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1268 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1269 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1270 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1271 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1272 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1273 assert list != null : getClazz(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1274 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1275 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1276 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1277 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1278 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1279 return false; |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1282 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
|
1283 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1284 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1285 Node successor = getNode(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1286 if (successor == old) { |
10424
e6cf435419b2
Fix after lowering phase refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9808
diff
changeset
|
1287 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
|
1288 other.getClass(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1289 putNode(node, successorOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1290 return true; |
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 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1293 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1294 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1295 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1296 assert list != null : getClazz() + " " + successorOffsets[index] + " " + node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1297 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1298 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1299 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1300 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1301 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1302 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1303 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1304 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1305 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1306 * 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
|
1307 * 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
|
1308 * clear the inputs of cloned nodes.) |
15001 | 1309 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1310 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1311 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1312 public void clearInputs(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1313 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1314 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1315 putNode(node, inputOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1316 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1317 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1318 long curOffset = inputOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1319 int size = (getNodeList(node, curOffset)).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1320 // 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
|
1321 putNodeList(node, curOffset, new NodeInputList<>(node, size)); |
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1324 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1325 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1326 * 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
|
1327 * 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
|
1328 * can be used to clear the successors of cloned nodes.) |
15001 | 1329 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1330 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1331 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1332 public void clearSuccessors(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1333 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1334 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1335 putNode(node, successorOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1336 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1337 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1338 long curOffset = successorOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1339 int size = getNodeList(node, curOffset).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1340 // 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
|
1341 putNodeList(node, curOffset, new NodeSuccessorList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1342 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1343 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1344 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1345 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1346 * 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
|
1347 * NodeClass type. |
15001 | 1348 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1349 * @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
|
1350 * @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
|
1351 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1352 public void copyInputs(Node node, Node newNode) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1353 assert node.getNodeClass() == this && newNode.getNodeClass() == this; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1354 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1355 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1356 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1357 putNode(newNode, inputOffsets[index], getNode(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1358 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1359 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1360 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1361 NodeList<Node> list = getNodeList(newNode, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1362 list.copy(getNodeList(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1363 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1364 } |
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 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1367 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1368 * 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
|
1369 * NodeClass type. |
15001 | 1370 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1371 * @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
|
1372 * @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
|
1373 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1374 public void copySuccessors(Node node, Node newNode) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1375 assert node.getNodeClass() == this && newNode.getNodeClass() == this; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1376 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1377 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1378 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1379 putNode(newNode, successorOffsets[index], getNode(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1380 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1381 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1382 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1383 NodeList<Node> list = getNodeList(newNode, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1384 list.copy(getNodeList(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1385 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1386 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1387 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1388 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1389 public boolean edgesEqual(Node node, Node other) { |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1390 return inputsEqual(node, other) && successorsEqual(node, other); |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1391 } |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1392 |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1393 public boolean inputsEqual(Node node, Node other) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1394 assert node.getNodeClass() == this && other.getNodeClass() == this; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1395 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1396 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1397 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
|
1398 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1399 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1400 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1401 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1402 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1403 NodeList<Node> list = getNodeList(other, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1404 if (!list.equals(getNodeList(node, inputOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1405 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1406 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1407 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1408 } |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1409 return true; |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1410 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1411 |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1412 public boolean successorsEqual(Node node, Node other) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1413 assert node.getNodeClass() == this && other.getNodeClass() == this; |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1414 int index = 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1415 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1416 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
|
1417 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1418 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1419 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1420 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1421 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1422 NodeList<Node> list = getNodeList(other, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1423 if (!list.equals(getNodeList(node, successorOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1424 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1425 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1426 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1427 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1428 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1429 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1430 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1431 public boolean inputContains(Node node, Node other) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1432 assert node.getNodeClass() == this; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1433 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1434 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1435 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1436 if (getNode(node, inputOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1437 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1438 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1439 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1440 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1441 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1442 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1443 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1444 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1445 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1446 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1447 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1448 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1449 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1450 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1451 public boolean successorContains(Node node, Node other) { |
16982
5762848171e7
replaced 'node.getClass() == <literal>.getGenClass()' idiom with new 'NodeClass.is(Class<? extends Node.class> cls)' mechanism
Doug Simon <doug.simon@oracle.com>
parents:
16919
diff
changeset
|
1452 assert node.getNodeClass() == this; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1453 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1454 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1455 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1456 if (getNode(node, successorOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1457 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1458 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1459 index++; |
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 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1462 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1463 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1464 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1465 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1466 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1467 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1468 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1469 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1470 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1471 public Collection<Position> getFirstLevelInputPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1472 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1473 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1474 public Iterator<Position> iterator() { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
1475 return new Iterator<Position>() { |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1476 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1477 |
12558 | 1478 @Override |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1479 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1480 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1481 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1482 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1483 public Position next() { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
1484 Position pos = new Position(true, i, i >= directInputCount ? Node.NODE_LIST : Node.NOT_ITERABLE); |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1485 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1486 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1487 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1488 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1489 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1490 return i < inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1491 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1492 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1493 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1494 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1495 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1496 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1497 return inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1498 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1499 }; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1500 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1501 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1502 public Collection<Position> getFirstLevelSuccessorPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1503 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1504 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1505 public Iterator<Position> iterator() { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
1506 return new Iterator<Position>() { |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1507 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1508 |
12558 | 1509 @Override |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1510 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1511 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1512 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1513 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1514 public Position next() { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
1515 Position pos = new Position(false, i, i >= directSuccessorCount ? Node.NODE_LIST : Node.NOT_ITERABLE); |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1516 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1517 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1518 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1519 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1520 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1521 return i < successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1522 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1523 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1524 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1525 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1526 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1527 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1528 return successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1529 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1530 }; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1531 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1532 |
15827
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1533 public Collection<Integer> getPropertyPositions() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1534 return new AbstractCollection<Integer>() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1535 @Override |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1536 public Iterator<Integer> iterator() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1537 return new Iterator<Integer>() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1538 int i = 0; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1539 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1540 @Override |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1541 public void remove() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1542 throw new UnsupportedOperationException(); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1543 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1544 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1545 public Integer next() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1546 Integer pos = i++; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1547 return pos; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1548 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1549 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1550 public boolean hasNext() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1551 return i < dataOffsets.length; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1552 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1553 }; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1554 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1555 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1556 @Override |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1557 public int size() { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1558 return dataOffsets.length; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1559 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1560 }; |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1561 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1562 |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1563 /** |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1564 * Initializes a fresh allocated node for which no constructor is called yet. Needed to |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1565 * implement node factories in svm. |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1566 */ |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1567 public void initRawNode(Node node) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1568 node.init(); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1569 for (int inputPos = directInputCount; inputPos < inputOffsets.length; inputPos++) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1570 if (getNodeList(node, inputOffsets[inputPos]) == null) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1571 putNodeList(node, inputOffsets[inputPos], new NodeInputList<>(node)); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1572 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1573 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1574 for (int successorPos = directSuccessorCount; successorPos < successorOffsets.length; successorPos++) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1575 if (getNodeList(node, successorOffsets[successorPos]) == null) { |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1576 putNodeList(node, successorOffsets[successorPos], new NodeSuccessorList<>(node)); |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1577 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1578 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1579 } |
4e770fa50889
Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15551
diff
changeset
|
1580 |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1581 public Class<?> getJavaClass() { |
15295
21663230ba88
Move FieldIntrospection to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15241
diff
changeset
|
1582 return getClazz(); |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1583 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1584 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1585 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1586 * 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
|
1587 * 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
|
1588 */ |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1589 public String getNameTemplate() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1590 return nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1591 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1592 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1593 interface InplaceUpdateClosure { |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1594 |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1595 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
|
1596 } |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1597 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1598 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
|
1599 final Map<Node, Node> newNodes; |
15551
33cedbce5b23
added CollectionsProvider and NodeCollectionsProvider and replaced (almost) all allocations of IdentityHashMaps to go through these providers
Doug Simon <doug.simon@oracle.com>
parents:
15295
diff
changeset
|
1600 int denseThreshold = oldGraph.getNodeCount() + oldGraph.getNodesDeletedSinceLastCompression() >> 4; |
33cedbce5b23
added CollectionsProvider and NodeCollectionsProvider and replaced (almost) all allocations of IdentityHashMaps to go through these providers
Doug Simon <doug.simon@oracle.com>
parents:
15295
diff
changeset
|
1601 if (estimatedNodeCount > denseThreshold) { |
12685
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1602 // Use dense map |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1603 newNodes = new NodeNodeMap(oldGraph); |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1604 } else { |
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1605 // Use sparse map |
15551
33cedbce5b23
added CollectionsProvider and NodeCollectionsProvider and replaced (almost) all allocations of IdentityHashMaps to go through these providers
Doug Simon <doug.simon@oracle.com>
parents:
15295
diff
changeset
|
1606 newNodes = newIdentityMap(); |
12685
478c82dde838
commented choice of data structure in NodeClass.addGraphDuplicate()
Doug Simon <doug.simon@oracle.com>
parents:
12669
diff
changeset
|
1607 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1608 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
|
1609 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1610 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
|
1611 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1612 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
|
1613 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
|
1614 if (target == null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1615 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
|
1616 if (replacements != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1617 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
|
1618 } |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1619 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
|
1620 target = replacement; |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1621 } 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
|
1622 // patch to the outer world |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1623 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
|
1624 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1625 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1626 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1627 return target; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1628 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1629 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1630 }; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1631 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1632 // 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
|
1633 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
|
1634 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
|
1635 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
|
1636 NodeClass nodeClass = node.getNodeClass(); |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1637 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
|
1638 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
|
1639 } else { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1640 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
|
1641 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1642 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1643 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1644 return newNodes; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1645 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1646 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1647 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
|
1648 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
|
1649 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
|
1650 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
|
1651 Node replacement = node; |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1652 if (replacements != null) { |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1653 replacement = replacements.replacement(node); |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1654 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
1655 if (replacement != node) { |
5519
cedae73d9c2a
Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
1656 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
|
1657 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
|
1658 } else { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1659 Node newNode = node.clone(graph, false); |
12612
42a2c235652f
replace ".count() == 0" with ".isEmpty()"
Doug Simon <doug.simon@oracle.com>
parents:
12574
diff
changeset
|
1660 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
|
1661 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
|
1662 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
|
1663 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1664 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1665 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1666 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1667 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1668 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
|
1669 NodeClass nodeClass) { |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1670 for (NodePosIterator iter = oldNode.inputs().iterator(); iter.hasNext();) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1671 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
|
1672 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
|
1673 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1674 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1675 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
|
1676 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
|
1677 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
|
1678 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
|
1679 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
|
1680 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
|
1681 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1682 if (replacement != input) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1683 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
|
1684 target = replacement; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1685 } 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
|
1686 target = input; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1687 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1688 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1689 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
|
1690 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1691 |
17008
81c9a1fc9072
select generated input and successor iterators if Node.USE_GENERATED_NODES
Doug Simon <doug.simon@oracle.com>
parents:
16991
diff
changeset
|
1692 for (NodePosIterator iter = oldNode.successors().iterator(); iter.hasNext();) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1693 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
|
1694 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
|
1695 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1696 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1697 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
|
1698 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
|
1699 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
|
1700 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
|
1701 if (replacement != succ) { |
15241
c570c2fe9d2b
small refactoring of NodeClass.Position, remove duplicated functionality
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
1702 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
|
1703 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
|
1704 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1705 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1706 nodeClass.set(node, pos, target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1707 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1708 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1709 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1710 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
|
1711 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
|
1712 } |
16919
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16903
diff
changeset
|
1713 |
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16903
diff
changeset
|
1714 public boolean isLeafNode() { |
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16903
diff
changeset
|
1715 return isLeafNode; |
0fe4732e5181
made use of generated Node classes predicated on value of graal.useGeneratedNodes system property (default is false)
Doug Simon <doug.simon@oracle.com>
parents:
16903
diff
changeset
|
1716 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1717 } |