Mercurial > hg > truffle
annotate graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java @ 12483:134671fbf973
Optimize Binary Graph format for more compact size
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 17 Oct 2013 18:18:05 +0200 |
parents | 1e76b14e1b3a |
children | 11dc3108904f |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
9720
d30cc6543973
fix concurrency issue in NodeClass.get
Lukas Stadler <lukas.stadler@jku.at>
parents:
9716
diff
changeset
|
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.graph; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
24 |
11524
dede53632f3e
removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents:
11434
diff
changeset
|
25 import static com.oracle.graal.graph.Graph.*; |
dede53632f3e
removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents:
11434
diff
changeset
|
26 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
27 import java.lang.reflect.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import java.util.*; |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
29 import java.util.concurrent.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
31 import com.oracle.graal.debug.*; |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
32 import com.oracle.graal.graph.Graph.DuplicationReplacement; |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
33 import com.oracle.graal.graph.Node.Input; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
34 import com.oracle.graal.graph.Node.Successor; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
35 import com.oracle.graal.graph.Node.Verbosity; |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
36 import com.oracle.graal.graph.spi.*; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
37 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
38 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
39 * Lazily associated metadata for every {@link Node} type. The metadata includes: |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
40 * <ul> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
41 * <li>The offsets of fields annotated with {@link Input} and {@link Successor} as well as methods |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
42 * for iterating over such fields.</li> |
11631
1aed684853f6
refactored IterableNodeType into a top level type to avoid problems it was causing for javac and JDT (CR-1408)
Doug Simon <doug.simon@oracle.com>
parents:
11556
diff
changeset
|
43 * <li>The identifier for an {@link IterableNodeType} class.</li> |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
44 * </ul> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
45 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
46 public final class NodeClass extends FieldIntrospection { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
47 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
48 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
49 * Maps {@link Class} values (for {@link Node} types) to {@link NodeClass} values. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
50 * |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
51 * Only a single Registry instance can be created. If a runtime creates a specialized registry, |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
52 * it must do so before the class initializer of {@link NodeClass} is executed. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
53 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
54 public static class Registry { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
55 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
56 private static Registry instance; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
57 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
58 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
59 * Gets the singleton {@link Registry} instance, creating it first if necessary. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
60 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
61 static synchronized Registry instance() { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
62 if (instance == null) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
63 return new Registry(); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
64 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
65 return instance; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
66 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
67 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
68 protected Registry() { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
69 assert instance == null : "exactly one registry can be created"; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
70 instance = this; |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
71 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
72 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
73 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
74 * @return the {@link NodeClass} value for {@code key} or {@code null} if no such mapping |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
75 * exists |
9720
d30cc6543973
fix concurrency issue in NodeClass.get
Lukas Stadler <lukas.stadler@jku.at>
parents:
9716
diff
changeset
|
76 */ |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
77 protected NodeClass get(Class<? extends Node> key) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
78 return (NodeClass) allClasses.get(key); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
79 } |
9720
d30cc6543973
fix concurrency issue in NodeClass.get
Lukas Stadler <lukas.stadler@jku.at>
parents:
9716
diff
changeset
|
80 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
81 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
82 * Same as {@link #get(Class)} except that a {@link NodeClass} is created if no such mapping |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
83 * exists. The creation of a {@link NodeClass} must be serialized as |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
84 * {@link NodeClass#NodeClass(Class)} accesses both {@link FieldIntrospection#allClasses} |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
85 * and {@link NodeClass#nextIterableId}. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
86 * <p> |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
87 * The fact that {@link ConcurrentHashMap#put} {@link ConcurrentHashMap#get} are used should |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
88 * make the double-checked locking idiom work in the way {@link NodeClass#get(Class)} uses |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
89 * this method and {@link #get(Class)}. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
90 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
91 final synchronized NodeClass make(Class<? extends Node> key) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
92 NodeClass value = (NodeClass) allClasses.get(key); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
93 if (value == null) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
94 value = new NodeClass(key); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
95 Object old = allClasses.putIfAbsent(key, value); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
96 assert old == null; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
97 registered(key, value); |
9720
d30cc6543973
fix concurrency issue in NodeClass.get
Lukas Stadler <lukas.stadler@jku.at>
parents:
9716
diff
changeset
|
98 } |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
99 return value; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
100 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
101 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
102 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
103 * Hook for a subclass to be notified of a new mapping added to the registry. |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
104 * |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
105 * @param key |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
106 * @param value |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
107 */ |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
108 protected void registered(Class<? extends Node> key, NodeClass value) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
109 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
110 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
111 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
113 private static final Registry registry = Registry.instance(); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
114 |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
115 /** |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
116 * 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
|
117 */ |
11434
0d9fe4e80ab8
moved warning suppression annotation to placate JDT
Doug Simon <doug.simon@oracle.com>
parents:
11431
diff
changeset
|
118 @SuppressWarnings("unchecked") |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
119 public static NodeClass get(Class<?> c) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
120 Class<? extends Node> key = (Class<? extends Node>) c; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
121 NodeClass value = registry.get(key); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
122 if (value != null) { |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
123 return value; |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
124 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
125 return registry.make(key); |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
126 } |
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
127 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
128 public static final int NOT_ITERABLE = -1; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
129 public static final int NODE_LIST = -2; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 private static int nextIterableId = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 private final int directInputCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 private final long[] inputOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 private final int directSuccessorCount; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 private final long[] successorOffsets; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 private final Class<?>[] dataTypes; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 private final boolean canGVN; |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
143 private final boolean isLeafNode; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 private final int startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 private final String shortName; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
146 private final String nameTemplate; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 private final int iterableId; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
148 private int[] iterableIds; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
150 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
|
151 private final DebugMetric nodeIterableCount; |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
152 |
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
|
153 /** |
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
|
154 * 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
|
155 */ |
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
|
156 private final boolean isCanonicalizable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
157 |
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
|
158 /** |
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
|
159 * 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
|
160 */ |
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
|
161 private final boolean isSimplifiable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
162 |
11431
ca53d08b8ef9
removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents:
10785
diff
changeset
|
163 private NodeClass(Class<?> clazz) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
164 super(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 assert NODE_CLASS.isAssignableFrom(clazz); |
11882
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
166 this.isCanonicalizable = Canonicalizable.class.isAssignableFrom(clazz); |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
167 this.isSimplifiable = Simplifiable.class.isAssignableFrom(clazz); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 FieldScanner scanner = new FieldScanner(new DefaultCalcOffset()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 directInputCount = scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 inputOffsets = sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 directSuccessorCount = scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 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
|
176 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
177 dataOffsets = sortedLongCopy(scanner.dataOffsets); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
178 dataTypes = new Class[dataOffsets.length]; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
179 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
|
180 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
182 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
183 fieldNames = scanner.fieldNames; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
184 fieldTypes = scanner.fieldTypes; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 startGVNNumber = clazz.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
189 String newShortName = clazz.getSimpleName(); |
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
190 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
|
191 newShortName = newShortName.substring(0, newShortName.length() - 4); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
193 String newNameTemplate = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 NodeInfo info = clazz.getAnnotation(NodeInfo.class); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 if (info != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 if (!info.shortName().isEmpty()) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
197 newShortName = info.shortName(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
199 if (!info.nameTemplate().isEmpty()) { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
200 newNameTemplate = info.nameTemplate(); |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
201 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
203 this.nameTemplate = newNameTemplate == null ? newShortName : newNameTemplate; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
204 this.shortName = newShortName; |
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
|
205 if (IterableNodeType.class.isAssignableFrom(clazz)) { |
11642
5507e2824bc6
added metric to count IterableNodeTypes (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11631
diff
changeset
|
206 ITERABLE_NODE_TYPES.increment(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 this.iterableId = nextIterableId++; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
208 List<NodeClass> existingClasses = new LinkedList<>(); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
209 for (FieldIntrospection nodeClass : allClasses.values()) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
210 if (clazz.isAssignableFrom(nodeClass.clazz)) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
211 existingClasses.add((NodeClass) nodeClass); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
212 } |
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
|
213 if (nodeClass.clazz.isAssignableFrom(clazz) && IterableNodeType.class.isAssignableFrom(nodeClass.clazz)) { |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
214 NodeClass superNodeClass = (NodeClass) nodeClass; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
215 superNodeClass.iterableIds = Arrays.copyOf(superNodeClass.iterableIds, superNodeClass.iterableIds.length + 1); |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
216 superNodeClass.iterableIds[superNodeClass.iterableIds.length - 1] = this.iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
217 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
218 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
219 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
|
220 ids[0] = iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
221 int i = 1; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
222 for (NodeClass other : existingClasses) { |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
223 ids[i++] = other.iterableId; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
224 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
225 this.iterableIds = ids; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 this.iterableId = NOT_ITERABLE; |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
228 this.iterableIds = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 } |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
230 |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
231 isLeafNode = (this.inputOffsets.length == 0 && this.successorOffsets.length == 0); |
11663
d213be26ffb4
added metric to count number of times a typed node iterator is used per IterableNodeType (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents:
11653
diff
changeset
|
232 nodeIterableCount = Debug.metric("NodeIterable_" + shortName); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
235 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
236 protected void rescanFieldOffsets(CalcOffset calc) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 FieldScanner scanner = new FieldScanner(calc); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 scanner.scan(clazz); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 assert directInputCount == scanner.inputOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 copyInto(inputOffsets, sortedLongCopy(scanner.inputOffsets, scanner.inputListOffsets)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 assert directSuccessorCount == scanner.successorOffsets.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 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
|
243 copyInto(dataOffsets, sortedLongCopy(scanner.dataOffsets)); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
244 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
245 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
|
246 dataTypes[i] = scanner.fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
249 fieldNames.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
250 fieldNames.putAll(scanner.fieldNames); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
251 fieldTypes.clear(); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
252 fieldTypes.putAll(scanner.fieldTypes); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 public String shortName() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 return shortName; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
259 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
|
260 nodeIterableCount.increment(); |
7332
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
261 return iterableIds; |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
262 } |
c5a9bcd9493d
Support sub-types for typed node iterators
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7283
diff
changeset
|
263 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 public int iterableId() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 return iterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 public boolean valueNumberable() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 return canGVN; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 |
11653
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
272 public boolean isLeafNode() { |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
273 return isLeafNode; |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
274 } |
64a9ed9f1e8d
Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11642
diff
changeset
|
275 |
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
|
276 /** |
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
|
277 * 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
|
278 */ |
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
|
279 public boolean isCanonicalizable() { |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
280 return isCanonicalizable; |
51059863da73
replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11676
diff
changeset
|
281 } |
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
|
282 |
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
|
283 /** |
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
|
284 * 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
|
285 */ |
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
|
286 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
|
287 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
|
288 } |
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
|
289 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 public static int cacheSize() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 return nextIterableId; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
294 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
|
295 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 public final ArrayList<Long> successorListOffsets = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
301 protected FieldScanner(CalcOffset calc) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
302 super(calc); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
305 @Override |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
306 protected void scanField(Field field, Class<?> type, long offset) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
307 if (field.isAnnotationPresent(Node.Input.class)) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
308 assert !field.isAnnotationPresent(Node.Successor.class) : "field cannot be both input and successor"; |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
309 if (INPUT_LIST_CLASS.isAssignableFrom(type)) { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
310 GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeInputList input field %s should be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
311 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
|
312 inputListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
313 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
314 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
|
315 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node input field %s should not be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
316 GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node input field %s should be private", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
317 inputOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
318 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
319 if (field.getAnnotation(Node.Input.class).notDataflow()) { |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
320 fieldNames.put(offset, field.getName() + "#NDF"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
322 } 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
|
323 if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
324 GraalInternalError.guarantee(Modifier.isFinal(field.getModifiers()), "NodeSuccessorList successor field % should be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
325 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
|
326 successorListOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
327 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
328 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
|
329 GraalInternalError.guarantee(!Modifier.isFinal(field.getModifiers()), "Node successor field %s should not be final", field); |
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
330 GraalInternalError.guarantee(Modifier.isPrivate(field.getModifiers()), "Node successor field %s should be private", field); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
331 successorOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
332 } |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
333 } else { |
9808
12fdb8fe0a35
turn assertions in NodeClass.FieldScanner into guarantees
Lukas Stadler <lukas.stadler@jku.at>
parents:
9720
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 dataOffsets.add(offset); |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
338 } |
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 StringBuilder str = new StringBuilder(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 str.append("NodeClass ").append(clazz.getSimpleName()).append(" ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 for (int i = 0; i < inputOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 str.append(i == 0 ? "" : ", ").append(inputOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 for (int i = 0; i < successorOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
351 str.append(i == 0 ? "" : ", ").append(successorOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 str.append("] ["); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 for (int i = 0; i < dataOffsets.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 str.append(i == 0 ? "" : ", ").append(dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 str.append("]"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 return str.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
361 /** |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
362 * Describes an edge slot for a {@link NodeClass}. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
363 * |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
364 * @see NodeClass#get(Node, Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
365 * @see NodeClass#getName(Position) |
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
366 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 public static final class Position { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
368 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 public final boolean input; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 public final int index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 public final int subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
372 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
373 public Position(boolean input, int index, int subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 this.input = input; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 this.index = index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 this.subIndex = subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 } |
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 return (input ? "input " : "successor ") + index + "/" + subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
382 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 public Node get(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
385 return node.getNodeClass().get(node, this); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 public void set(Node node, Node value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 node.getNodeClass().set(node, this, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 |
5214 | 392 public boolean isValidFor(Node node, Node from) { |
393 return node.getNodeClass().isValid(this, from.getNodeClass()); | |
394 } | |
395 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 public int hashCode() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 final int prime = 31; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 int result = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 result = prime * result + index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 result = prime * result + (input ? 1231 : 1237); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 result = prime * result + subIndex; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 public boolean equals(Object obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 if (this == obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 if (obj == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
414 if (getClass() != obj.getClass()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
416 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
417 Position other = (Position) obj; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 if (index != other.index) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 if (input != other.input) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
424 if (subIndex != other.subIndex) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
425 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
426 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
429 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
430 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
431 private static Node getNode(Node node, long offset) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 return (Node) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 @SuppressWarnings("unchecked") |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
436 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
|
437 return (NodeList<Node>) unsafe.getObject(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
438 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
439 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
440 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
|
441 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 private static void putNodeList(Node node, long offset, NodeList value) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 unsafe.putObject(node, offset, value); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
447 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 /** |
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
|
449 * 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
|
450 * {@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
|
451 * 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
|
452 * 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
|
453 * successors of a node. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
454 * |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
455 * 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
|
456 * 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
|
457 */ |
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
|
458 public abstract static class NodeClassIterator implements Iterator<Node> { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
459 protected final Node node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 private int index; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 private int subIndex; |
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 * Creates an iterator that will iterate over fields in the given node. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
465 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 * @param node the node which contains the fields. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 */ |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
468 NodeClassIterator(Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 this.node = node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 index = NOT_ITERABLE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
474 void forward() { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
475 if (index < getDirectCount()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 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
|
477 while (index < getDirectCount()) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
478 Node element = getNode(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 if (element != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 return; |
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 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 } |
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
|
487 while (index < getOffsets().length) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
488 NodeList<Node> list = getNodeList(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
489 while (subIndex < list.size()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 if (list.get(subIndex) != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 subIndex++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 subIndex = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
497 } |
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 private Node nextElement() { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
501 if (index < getDirectCount()) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
502 return getNode(node, getOffsets()[index]); |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
503 } else if (index < getOffsets().length) { |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
504 NodeList<Node> list = getNodeList(node, getOffsets()[index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 return list.get(subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 } |
7258
9bee93f61522
Cleanups: remove unused NodeUsagesList.replaceFirst and FrameState.block
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7123
diff
changeset
|
507 throw new NoSuchElementException(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 public boolean hasNext() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
512 return index < getOffsets().length; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
513 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
514 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
515 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
516 public Node next() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
517 try { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
518 return nextElement(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
522 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
524 public Position nextPosition() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
525 try { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
526 if (index < getDirectCount()) { |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
527 return new Position(getOffsets() == getNodeClass().inputOffsets, index, NOT_ITERABLE); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
528 } else { |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
529 return new Position(getOffsets() == getNodeClass().inputOffsets, index, subIndex); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
530 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
531 } finally { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
532 forward(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
533 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
534 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
535 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
536 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
537 public void remove() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 throw new UnsupportedOperationException(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 } |
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
|
540 |
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
|
541 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
|
542 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
543 protected abstract long[] getOffsets(); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
544 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
545 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
|
546 } |
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
|
547 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
548 private class NodeClassInputsIterator extends NodeClassIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
549 NodeClassInputsIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
550 this(node, true); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
551 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
552 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
553 NodeClassInputsIterator(Node node, boolean forward) { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
554 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
555 assert NodeClass.this == node.getNodeClass(); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
556 if (forward) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
557 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
558 } |
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
|
559 } |
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
|
560 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
561 @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
|
562 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
|
563 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
|
564 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
565 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
566 @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
|
567 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
|
568 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
|
569 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
570 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
571 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
572 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
573 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
574 } |
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
|
575 } |
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
|
576 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
577 private final class NodeClassInputsWithModCountIterator extends NodeClassInputsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
578 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
579 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
580 private NodeClassInputsWithModCountIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
581 super(node, false); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
582 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
583 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
584 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
585 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
586 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
587 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
588 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
589 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
590 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
591 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
592 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
|
593 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
594 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
595 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
596 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
597 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
598 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
599 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
600 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
601 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
|
602 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
603 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
604 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
605 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
606 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
607 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
608 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
609 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
610 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
611 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
612 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
613 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
614 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
615 private class NodeClassSuccessorsIterator extends NodeClassIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
616 NodeClassSuccessorsIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
617 this(node, true); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
618 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
619 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
620 NodeClassSuccessorsIterator(Node node, boolean forward) { |
12046
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
621 super(node); |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
622 assert NodeClass.this == node.getNodeClass(); |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
623 if (forward) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
624 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
625 } |
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
|
626 } |
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
|
627 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
628 @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
|
629 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
|
630 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
|
631 } |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
632 |
c3a1d5bfc3ee
NodeClassIterator: specialize instance for each type of iterator (inputs/successors) in order to share directCount/offsets directly with NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
11882
diff
changeset
|
633 @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
|
634 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
|
635 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
|
636 } |
12378
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
637 |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
638 @Override |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
639 protected NodeClass getNodeClass() { |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
640 return NodeClass.this; |
1e76b14e1b3a
NodeClassIterator: remove reference to NodeClass
Bernhard Urban <bernhard.urban@jku.at>
parents:
12047
diff
changeset
|
641 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
642 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
643 |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
644 private final class NodeClassSuccessorsWithModCountIterator extends NodeClassSuccessorsIterator { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
645 private final int modCount; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
646 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
647 private NodeClassSuccessorsWithModCountIterator(Node node) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
648 super(node, false); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
649 assert MODIFICATION_COUNTS_ENABLED; |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
650 this.modCount = node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
651 forward(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
652 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
653 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
654 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
655 public boolean hasNext() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
656 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
657 return super.hasNext(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
658 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
659 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
|
660 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
661 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
662 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
663 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
664 public Node next() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
665 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
666 return super.next(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
667 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
668 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
|
669 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
670 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
671 |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
672 @Override |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
673 public Position nextPosition() { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
674 try { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
675 return super.nextPosition(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
676 } finally { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
677 assert modCount == node.modCount(); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
678 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
679 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
680 } |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
681 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
682 public int valueNumber(Node n) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
683 int number = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
684 if (canGVN) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
685 number = startGVNNumber; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
686 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
|
687 Class<?> type = dataTypes[i]; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
688 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
689 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
690 int intValue = unsafe.getInt(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
691 number += intValue; |
6657
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
692 } else if (type == Long.TYPE) { |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
693 long longValue = unsafe.getLong(n, dataOffsets[i]); |
768793150bcd
more PEA refactoring, multiple iterations
Lukas Stadler <lukas.stadler@jku.at>
parents:
6414
diff
changeset
|
694 number += longValue ^ (longValue >>> 32); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
695 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
696 boolean booleanValue = unsafe.getBoolean(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
697 if (booleanValue) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
698 number += 7; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
699 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
700 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
701 assert false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
702 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
703 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
704 Object o = unsafe.getObject(n, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
705 if (o != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
706 number += o.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
707 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
708 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
709 number *= 13; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
710 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
711 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
712 return number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
713 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
714 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
715 /** |
5711
4d7175cf3526
enabled Eclipse/JDT javadoc checking and fixed resulting warnings
Doug Simon <doug.simon@oracle.com>
parents:
5693
diff
changeset
|
716 * Populates a given map with the names and values of all data fields. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
717 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
718 * @param node the node from which to take the values. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
719 * @param properties a map that will be populated. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
720 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
721 public void getDebugProperties(Node node, Map<Object, Object> properties) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
722 for (int i = 0; i < dataOffsets.length; ++i) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
723 Class<?> type = fieldTypes.get(dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
724 Object value = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
725 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
726 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 value = unsafe.getInt(node, dataOffsets[i]); |
5361
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
728 } else if (type == Long.TYPE) { |
dec5a35ddbe2
lowering checkcasts with Java snippets (incomplete)
Doug Simon <doug.simon@oracle.com>
parents:
5313
diff
changeset
|
729 value = unsafe.getLong(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
730 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
731 value = unsafe.getBoolean(node, dataOffsets[i]); |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
732 } else if (type == Long.TYPE) { |
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
733 value = unsafe.getLong(node, dataOffsets[i]); |
5287
e96c8d2925da
let NodeClass.getDebugProperties handle arrays and doubles
Lukas Stadler <lukas.stadler@jku.at>
parents:
5261
diff
changeset
|
734 } else if (type == Double.TYPE) { |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
735 value = unsafe.getDouble(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
736 } else { |
5313
be1a8ff480db
Visualizer: display long properties correctly, "!InstanceOf" for negated InstanceOfNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
5301
diff
changeset
|
737 assert false : "unhandled property type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
738 } |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
739 } else { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
740 value = unsafe.getObject(node, dataOffsets[i]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
741 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
742 properties.put(fieldNames.get(dataOffsets[i]), value); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
743 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
744 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
745 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
746 public boolean valueEqual(Node a, Node b) { |
11666
3967f9f306f8
Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11653
diff
changeset
|
747 if (!canGVN || a.getClass() != b.getClass()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
748 return a == b; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
749 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
750 for (int i = 0; i < dataOffsets.length; ++i) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
751 Class<?> type = dataTypes[i]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
752 if (type.isPrimitive()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
753 if (type == Integer.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
754 int aInt = unsafe.getInt(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
755 int bInt = unsafe.getInt(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
756 if (aInt != bInt) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
757 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
758 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
759 } else if (type == Boolean.TYPE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
760 boolean aBoolean = unsafe.getBoolean(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
761 boolean bBoolean = unsafe.getBoolean(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
762 if (aBoolean != bBoolean) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
763 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
764 } |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
765 } else if (type == Long.TYPE) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
766 long aLong = unsafe.getLong(a, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
767 long bLong = unsafe.getLong(b, dataOffsets[i]); |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
768 if (aLong != bLong) { |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
769 return false; |
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
770 } |
10785
debb9d8e0282
allow double fields in value number computation and thus, in floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
10424
diff
changeset
|
771 } 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
|
772 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
|
773 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
|
774 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
|
775 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
|
776 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
777 } else { |
5301
23ea81293bd5
let NodeClass.valueEqual handle long fields
Lukas Stadler <lukas.stadler@jku.at>
parents:
5299
diff
changeset
|
778 assert false : "unhandled type: " + type; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
779 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
780 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
781 Object objectA = unsafe.getObject(a, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
782 Object objectB = unsafe.getObject(b, dataOffsets[i]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
783 if (objectA != objectB) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
784 if (objectA != null && objectB != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
785 if (!(objectA.equals(objectB))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
786 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
787 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
788 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
789 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
790 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
791 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
792 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
794 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
795 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
796 |
5214 | 797 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
|
798 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
|
799 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
|
800 } |
5214 | 801 long[] offsets = pos.input ? inputOffsets : successorOffsets; |
802 if (pos.index >= offsets.length) { | |
803 return false; | |
804 } | |
805 long[] fromOffsets = pos.input ? from.inputOffsets : from.successorOffsets; | |
806 if (pos.index >= fromOffsets.length) { | |
807 return false; | |
808 } | |
809 return offsets[pos.index] == fromOffsets[pos.index]; | |
810 } | |
811 | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
812 public Node get(Node node, Position pos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
813 long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
814 if (pos.subIndex == NOT_ITERABLE) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
815 return getNode(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
816 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
817 return getNodeList(node, offset).get(pos.subIndex); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
818 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
819 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
820 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
821 public NodeList<?> getNodeList(Node node, Position pos) { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
822 long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
823 assert pos.subIndex == NODE_LIST; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
824 return getNodeList(node, offset); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
825 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
826 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
827 public String getName(Position pos) { |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
828 return fieldNames.get(pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
829 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
830 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
831 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
|
832 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
|
833 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
|
834 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
|
835 if (input != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
836 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
|
837 node.updateUsages(null, newInput); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
838 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
|
839 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
840 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
841 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
842 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
843 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
|
844 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
|
845 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
846 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
847 index = 0; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
848 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
|
849 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
|
850 if (successor != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
851 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
|
852 node.updatePredecessor(null, newSucc); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
853 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
|
854 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
855 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
856 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
857 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
858 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
|
859 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
|
860 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
861 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
862 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
863 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
|
864 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
|
865 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
|
866 NodeList<Node> list = getNodeList(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
|
867 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
|
868 assert list != null : clazz; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
869 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
870 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
871 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
872 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
873 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
|
874 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
|
875 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
|
876 NodeList<Node> list = getNodeList(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
|
877 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
|
878 assert list != null : clazz; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
879 index++; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
880 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
881 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
882 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
883 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
|
884 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
|
885 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
|
886 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
|
887 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
|
888 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
889 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
|
890 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
|
891 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
892 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
893 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
894 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
895 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
896 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
|
897 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
|
898 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
|
899 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
|
900 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
|
901 if (oldNode != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
902 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
|
903 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
|
904 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
905 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
906 return result; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
907 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
908 |
7283
3964f3d4eb18
Extend loop unswicthing to Switch nodes (integer or type)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7258
diff
changeset
|
909 public void set(Node node, Position pos, Node x) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
910 long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
911 if (pos.subIndex == NOT_ITERABLE) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
912 Node old = getNode(node, offset); |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
913 assert x == null || fieldTypes.get((pos.input ? inputOffsets : successorOffsets)[pos.index]).isAssignableFrom(x.getClass()) : this + ".set(node, pos, " + x + ")"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
914 putNode(node, offset, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
915 if (pos.input) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
916 node.updateUsages(old, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
917 } else { |
5487
9743ae819f73
Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5486
diff
changeset
|
918 node.updatePredecessor(old, x); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
919 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
920 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
921 NodeList<Node> list = getNodeList(node, offset); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
922 if (pos.subIndex < list.size()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
923 list.set(pos.subIndex, x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
924 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
925 while (pos.subIndex < list.size() - 1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
926 list.add(null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
927 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
928 list.add(x); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
929 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
930 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
931 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
932 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
933 public NodeClassIterable getInputIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
934 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
935 return new NodeClassIterable() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
936 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
937 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
938 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
939 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
940 return new NodeClassInputsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
941 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
942 return new NodeClassInputsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
943 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
944 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
945 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
946 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
947 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
948 return inputContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
949 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
950 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
951 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
952 |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
953 public NodeClassIterable getSuccessorIterable(final Node node) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
954 assert clazz.isInstance(node); |
7123
b914b9b4c578
graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6657
diff
changeset
|
955 return new NodeClassIterable() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
956 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
957 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
958 public NodeClassIterator iterator() { |
12047
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
959 if (MODIFICATION_COUNTS_ENABLED) { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
960 return new NodeClassSuccessorsWithModCountIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
961 } else { |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
962 return new NodeClassSuccessorsIterator(node); |
dcd412a084a2
NodeClassIterator: seperate implementation for modCount check
Bernhard Urban <bernhard.urban@jku.at>
parents:
12046
diff
changeset
|
963 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
964 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
965 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
966 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
967 public boolean contains(Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
968 return successorContains(node, other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
969 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
970 }; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
971 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
972 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
973 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
|
974 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
975 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
976 Node input = getNode(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
977 if (input == old) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
978 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
|
979 " in " + node; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
980 putNode(node, inputOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
981 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
982 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
983 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
984 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
985 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
986 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
987 assert list != null : clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
988 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
989 return true; |
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 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
992 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
993 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
994 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
995 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
996 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
|
997 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
998 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
999 Node successor = getNode(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1000 if (successor == old) { |
10424
e6cf435419b2
Fix after lowering phase refactoring.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9808
diff
changeset
|
1001 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
|
1002 other.getClass(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1003 putNode(node, successorOffsets[index], other); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1004 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1005 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1006 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1007 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1008 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1009 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1010 assert list != null : clazz + " " + successorOffsets[index] + " " + node; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1011 if (list.replaceFirst(old, other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1012 return true; |
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 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1015 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1016 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1017 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1018 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1019 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1020 * 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
|
1021 * 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
|
1022 * clear the inputs of cloned nodes.) |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1023 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1024 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1025 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1026 public void clearInputs(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1027 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1028 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1029 putNode(node, inputOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1030 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1031 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1032 long curOffset = inputOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1033 int size = (getNodeList(node, curOffset)).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1034 // 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
|
1035 putNodeList(node, curOffset, new NodeInputList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1036 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1037 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1038 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1039 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1040 * 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
|
1041 * 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
|
1042 * can be used to clear the successors of cloned nodes.) |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1043 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1044 * @param node the node to be cleared |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1045 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1046 public void clearSuccessors(Node node) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1047 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1048 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1049 putNode(node, successorOffsets[index++], null); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1050 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1051 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1052 long curOffset = successorOffsets[index++]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1053 int size = getNodeList(node, curOffset).initialSize; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1054 // 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
|
1055 putNodeList(node, curOffset, new NodeSuccessorList<>(node, size)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1056 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1057 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1058 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1059 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1060 * 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
|
1061 * NodeClass type. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1062 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1063 * @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
|
1064 * @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
|
1065 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1066 public void copyInputs(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1067 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1068 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1069 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1070 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1071 putNode(newNode, inputOffsets[index], getNode(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1072 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1073 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1074 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1075 NodeList<Node> list = getNodeList(newNode, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1076 list.copy(getNodeList(node, inputOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1077 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1078 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1079 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1080 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1081 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1082 * 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
|
1083 * NodeClass type. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1084 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1085 * @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
|
1086 * @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
|
1087 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1088 public void copySuccessors(Node node, Node newNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1089 assert node.getClass() == clazz && newNode.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1090 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1091 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1092 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1093 putNode(newNode, successorOffsets[index], getNode(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1094 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1095 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1096 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1097 NodeList<Node> list = getNodeList(newNode, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1098 list.copy(getNodeList(node, successorOffsets[index])); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1099 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1100 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1101 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1102 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1103 public boolean edgesEqual(Node node, Node other) { |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1104 return inputsEqual(node, other) && successorsEqual(node, other); |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1105 } |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1106 |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1107 public boolean inputsEqual(Node node, Node other) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1108 assert node.getClass() == clazz && other.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1109 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1110 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1111 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
|
1112 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1113 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1114 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1115 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1116 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1117 NodeList<Node> list = getNodeList(other, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1118 if (!list.equals(getNodeList(node, inputOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1119 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1120 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1121 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1122 } |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1123 return true; |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1124 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1125 |
9450
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1126 public boolean successorsEqual(Node node, Node other) { |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1127 assert node.getClass() == clazz && other.getClass() == clazz; |
ca34e36c53e8
Add loop safepoint elimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7530
diff
changeset
|
1128 int index = 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1129 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1130 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
|
1131 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1132 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1133 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1134 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1135 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1136 NodeList<Node> list = getNodeList(other, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1137 if (!list.equals(getNodeList(node, successorOffsets[index]))) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1138 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1139 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1140 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1141 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1142 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1143 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1144 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1145 public boolean inputContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1146 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1147 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1148 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1149 while (index < directInputCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1150 if (getNode(node, inputOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1151 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1152 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1153 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1154 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1155 while (index < inputOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1156 NodeList<Node> list = getNodeList(node, inputOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1157 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1158 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1159 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1160 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1161 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1162 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1163 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1164 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1165 public boolean successorContains(Node node, Node other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1166 assert node.getClass() == clazz; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1167 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1168 int index = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1169 while (index < directSuccessorCount) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1170 if (getNode(node, successorOffsets[index]) == other) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1171 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1172 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1173 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1174 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1175 while (index < successorOffsets.length) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1176 NodeList<Node> list = getNodeList(node, successorOffsets[index]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1177 if (list.contains(other)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1178 return true; |
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 index++; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1181 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1182 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1183 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1184 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1185 public Collection<Position> getFirstLevelInputPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1186 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1187 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1188 public Iterator<Position> iterator() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1189 return new Iterator<NodeClass.Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1190 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1191 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1192 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1193 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1194 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1195 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1196 public Position next() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1197 Position pos = new Position(true, i, i >= directInputCount ? 0 : NOT_ITERABLE); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1198 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1199 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1200 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1201 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1202 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1203 return i < inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1204 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1205 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1206 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1207 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1208 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1209 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1210 return inputOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1211 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1212 }; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1213 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1214 |
12483
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1215 public Collection<Position> getFirstLevelSuccessorPositions() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1216 return new AbstractCollection<Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1217 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1218 public Iterator<Position> iterator() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1219 return new Iterator<NodeClass.Position>() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1220 int i = 0; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1221 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1222 public void remove() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1223 throw new UnsupportedOperationException(); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1224 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1225 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1226 public Position next() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1227 Position pos = new Position(false, i, i >= directSuccessorCount ? 0 : NOT_ITERABLE); |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1228 i++; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1229 return pos; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1230 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1231 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1232 public boolean hasNext() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1233 return i < successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1234 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1235 }; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1236 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1237 |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1238 @Override |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1239 public int size() { |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1240 return successorOffsets.length; |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1241 } |
134671fbf973
Optimize Binary Graph format for more compact size
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12378
diff
changeset
|
1242 }; |
5813
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1243 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1244 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1245 public Class<?> getJavaClass() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1246 return clazz; |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1247 } |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1248 |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1249 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7332
diff
changeset
|
1250 * 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
|
1251 * 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
|
1252 */ |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1253 public String getNameTemplate() { |
3b8bc07f8d17
Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5810
diff
changeset
|
1254 return nameTemplate; |
3733
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 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1257 interface InplaceUpdateClosure { |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1258 |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1259 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
|
1260 } |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1261 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1262 static Map<Node, Node> addGraphDuplicate(final Graph graph, final Graph oldGraph, int estimatedNodeCount, Iterable<Node> nodes, final DuplicationReplacement replacements) { |
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1263 final Map<Node, Node> newNodes = (estimatedNodeCount > (oldGraph.getNodeCount() + oldGraph.getDeletedNodeCount() >> 4)) ? new NodeNodeMap(oldGraph) : new IdentityHashMap<Node, Node>(); |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1264 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
|
1265 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1266 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
|
1267 |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1268 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
|
1269 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
|
1270 if (target == null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1271 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
|
1272 if (replacements != null) { |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1273 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
|
1274 } |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1275 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
|
1276 target = replacement; |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1277 } 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
|
1278 // patch to the outer world |
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1279 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
|
1280 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1281 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1282 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1283 return target; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1284 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1285 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1286 }; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1287 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1288 // 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
|
1289 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
|
1290 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
|
1291 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
|
1292 NodeClass nodeClass = node.getNodeClass(); |
11676
435c8b984680
Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11675
diff
changeset
|
1293 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
|
1294 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
|
1295 } else { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1296 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
|
1297 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1298 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1299 |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1300 return newNodes; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1301 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1302 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1303 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
|
1304 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
|
1305 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
|
1306 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
|
1307 Node replacement = node; |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1308 if (replacements != null) { |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1309 replacement = replacements.replacement(node); |
3522f7c99c5f
Allow null DuplicationReplacement in addDuplicates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11669
diff
changeset
|
1310 } |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
1311 if (replacement != node) { |
5519
cedae73d9c2a
Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
1312 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
|
1313 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
|
1314 } else { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1315 Node newNode = node.clone(graph, false); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1316 assert newNode.usages().count() == 0 || newNode.inputs().count() == 0; |
5478
4a99bfc329f0
Add posibility to provide a replacement function instead of map for duplication.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5361
diff
changeset
|
1317 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
|
1318 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
|
1319 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1320 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1321 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1322 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1323 |
11675
77d9f12797c5
Use NodeMap in inlining utility when number of nodes is high.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11674
diff
changeset
|
1324 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
|
1325 NodeClass nodeClass) { |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1326 for (NodeClassIterator iter = oldNode.inputs().iterator(); iter.hasNext();) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1327 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
|
1328 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
|
1329 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1330 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1331 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
|
1332 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
|
1333 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
|
1334 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
|
1335 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
|
1336 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
|
1337 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1338 if (replacement != input) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1339 assert isAssignable(nodeClass.fieldTypes.get(nodeClass.inputOffsets[pos.index]), replacement); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1340 target = replacement; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1341 } 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
|
1342 target = input; |
3733
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 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1345 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
|
1346 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1347 |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1348 for (NodeClassIterator iter = oldNode.successors().iterator(); iter.hasNext();) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1349 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
|
1350 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
|
1351 continue; |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1352 } |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1353 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
|
1354 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
|
1355 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
|
1356 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
|
1357 if (replacement != succ) { |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1358 assert isAssignable(nodeClass.fieldTypes.get(node.getNodeClass().successorOffsets[pos.index]), replacement); |
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1359 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
|
1360 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1361 } |
11674
8505bcff4bdc
New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11673
diff
changeset
|
1362 nodeClass.set(node, pos, target); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1363 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1364 } |
5858
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1365 |
911315a3e642
Factor out common infrastructure from NodeClass and LIRInstructionClass
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5813
diff
changeset
|
1366 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
|
1367 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
|
1368 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1369 } |