annotate graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java @ 16606:7036c4594919

correct name of zero usages method
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 28 Jul 2014 13:51:36 -0700
parents f3c1b2d999da
children 5d468add216f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
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;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
11524
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
25 import static com.oracle.graal.graph.Graph.*;
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.lang.annotation.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29
11486
5d5bfb75dae0 added metrics for total number of Nodes, LIRInstructions and CompositeValues created (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents: 11431
diff changeset
30 import com.oracle.graal.graph.NodeClass.NodeClassIterator;
5d5bfb75dae0 added metrics for total number of Nodes, LIRInstructions and CompositeValues created (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents: 11431
diff changeset
31 import com.oracle.graal.graph.NodeClass.Position;
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
32 import com.oracle.graal.graph.iterators.*;
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: 11755
diff changeset
33 import com.oracle.graal.graph.spi.*;
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
34
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
36 * This class is the base class for all nodes, it represent a node which can be inserted in a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
37 * {@link Graph}.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
38 * <p>
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
39 * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
40 * subclasses are represented with annotated fields. There are two kind of edges : {@link Input} and
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
41 * {@link Successor}. If a field, of a type compatible with {@link Node}, annotated with either
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
42 * {@link Input} and {@link Successor} is not null, then there is an edge from this node to the node
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
43 * this field points to.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
44 * <p>
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 * Nodes which are be value numberable should implement the {@link ValueNumberable} interface.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
46 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 * <h1>Assertions and Verification</h1>
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
48 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 * The Node class supplies the {@link #assertTrue(boolean, String, Object...)} and
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
50 * {@link #assertFalse(boolean, String, Object...)} methods, which will check the supplied boolean
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
51 * and throw a VerificationError if it has the wrong value. Both methods will always either throw an
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
52 * exception or return true. They can thus be used within an assert statement, so that the check is
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
53 * only performed if assertions are enabled.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 */
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
55 public abstract class Node implements Cloneable, Formattable {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 static final int DELETED_ID_START = -1000000000;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 static final int INITIAL_ID = -1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 static final int ALIVE_ID_START = 0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5814
diff changeset
61 /**
16336
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
62 * Denotes a non-optional (non-null) node input. This should be applied to exactly the fields of
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
63 * a node that are of type {@link Node} or {@link NodeInputList}. Nodes that update fields of
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
64 * type {@link Node} outside of their constructor should call
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
65 * {@link Node#updateUsages(Node, Node)} just prior to doing the update of the input.
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5814
diff changeset
66 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 @Retention(RetentionPolicy.RUNTIME)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 @Target(ElementType.FIELD)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 public static @interface Input {
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
70 InputType value() default InputType.Value;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72
16332
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
73 /**
16336
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
74 * Denotes an optional (nullable) node input. This should be applied to exactly the fields of a
c88a9e432faf small fix and doc for @OptionalInput
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
75 * node that are of type {@link Node} or {@link NodeInputList}. Nodes that update fields of type
16332
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
76 * {@link Node} outside of their constructor should call {@link Node#updateUsages(Node, Node)}
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
77 * just prior to doing the update of the input.
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
78 */
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
79 @Retention(RetentionPolicy.RUNTIME)
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
80 @Target(ElementType.FIELD)
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
81 public static @interface OptionalInput {
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
82 InputType value() default InputType.Value;
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
83 }
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
84
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 @Retention(RetentionPolicy.RUNTIME)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 @Target(ElementType.FIELD)
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
87 public static @interface Successor {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
88 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
91 * Denotes that a parameter of an {@linkplain NodeIntrinsic intrinsic} method must be a compile
7759
9e68bd67b745 cleanups, javadoc, assertions
Lukas Stadler <lukas.stadler@jku.at>
parents: 7651
diff changeset
92 * time constant at all call sites to the intrinsic method.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 @Retention(RetentionPolicy.RUNTIME)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 @Target(ElementType.PARAMETER)
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
96 public static @interface ConstantNodeParameter {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
97 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 /**
12361
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
100 * Denotes an injected parameter in a {@linkplain NodeIntrinsic node intrinsic} constructor. If
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
101 * the constructor is called as part of node intrinsification, the node intrinsifier will inject
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
102 * an argument for the annotated parameter. Injected parameters must precede all non-injected
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
103 * parameters in a constructor.
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
104 */
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
105 @Retention(RetentionPolicy.RUNTIME)
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
106 @Target(ElementType.PARAMETER)
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
107 public static @interface InjectedNodeParameter {
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
108 }
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
109
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
110 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
111 * Annotates a method that can be replaced by a compiler intrinsic. A (resolved) call to the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
112 * annotated method can be replaced with an instance of the node class denoted by
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
113 * {@link #value()}. For this reason, the signature of the annotated method must match the
12361
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
114 * signature (excluding a prefix of {@linkplain InjectedNodeParameter injected} parameters) of a
ec57cc36371e introduced @InjectedNodeParameter annotation to make injection of arguments during node intrinsification more extensible
Doug Simon <doug.simon@oracle.com>
parents: 11940
diff changeset
115 * constructor in the node class.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 @Retention(RetentionPolicy.RUNTIME)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 @Target(ElementType.METHOD)
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 public static @interface NodeIntrinsic {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
120
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
122 * Gets the {@link Node} subclass instantiated when intrinsifying a call to the annotated
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
123 * method. If not specified, then the class in which the annotated method is declared is
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
124 * used (and is assumed to be a {@link Node} subclass).
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 */
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15036
diff changeset
126 Class<?> value() default NodeIntrinsic.class;
6419
b74402a7079b fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
127
b74402a7079b fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
128 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
129 * Determines if the stamp of the instantiated intrinsic node has its stamp set from the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
130 * return type of the annotated method.
11698
4eec2ac671c2 Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11677
diff changeset
131 * <p>
4eec2ac671c2 Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11677
diff changeset
132 * When it is set to true, the stamp that is passed in to the constructor of ValueNode is
4eec2ac671c2 Refactor the WordTypeVerificationPhase to use fewer graph iterations, and invoke it a fewer places
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11677
diff changeset
133 * ignored and can therefore safely be {@code null}.
6419
b74402a7079b fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
134 */
b74402a7079b fixed oopmap bug caused by unsafe mixing of word and object values
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
135 boolean setStampFromReturnType() default false;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
138 public interface ValueNumberable {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
139 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 private Graph graph;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 int id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
144 // this next pointer is used in Graph to implement fast iteration over NodeClass types, it
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
145 // therefore points to the next Node of the same type.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 Node typeCacheNext;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
148 private static final int INLINE_USAGE_COUNT = 2;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
149 private static final Node[] NO_NODES = {};
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
150
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
151 /**
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
152 * Head of usage list. The elements of the usage list in order are {@link #usage0},
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
153 * {@link #usage1} and {@link #extraUsages}. The first null entry terminates the list.
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
154 */
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
155 private Node usage0;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
156 private Node usage1;
15827
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
157 private Node[] extraUsages;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
158
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 private Node predecessor;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161 public Node() {
15827
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
162 init();
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
163 }
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
164
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
165 final void init() {
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
166 id = INITIAL_ID;
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
167 extraUsages = NO_NODES;
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
12686
ca8ab182026f abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents: 12655
diff changeset
170 int id() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 return id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173
12655
2c4aa758ee18 made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
174 /**
13327
c258331fdde6 removed support for external nodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 13140
diff changeset
175 * Gets the graph context of this node.
12655
2c4aa758ee18 made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
176 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 public Graph graph() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 return graph;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
182 * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
183 * input edges of this node.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
184 *
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
185 * @return an {@link NodeClassIterable iterable} for all non-null input edges.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 */
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
187 public NodeClassIterable inputs() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
188 return getNodeClass().getInputIterable(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
192 * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
193 * successor edges of this node.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
194 *
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
195 * @return an {@link NodeClassIterable iterable} for all non-null successor edges.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 */
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
197 public NodeClassIterable successors() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198 return getNodeClass().getSuccessorIterable(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
201 class NodeUsageIterator implements Iterator<Node> {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
202
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
203 int index = -1;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
204 Node current;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
205
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
206 private void advance() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
207 current = null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
208 index++;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
209 if (index == 0) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
210 current = usage0;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
211 } else if (index == 1) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
212 current = usage1;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
213 } else {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
214 if (index - INLINE_USAGE_COUNT < extraUsages.length) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
215 current = extraUsages[index - INLINE_USAGE_COUNT];
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
216 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
217 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
218 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
219
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
220 public NodeUsageIterator() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
221 advance();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
222 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
223
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
224 public boolean hasNext() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
225 return current != null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
226 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
227
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
228 public Node next() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
229 Node result = current;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
230 if (result == null) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
231 throw new NoSuchElementException();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
232 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
233 advance();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
234 return result;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
235 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
236
12437
c991f8291f1b add missing @Override to Iterator.remove overrides
twisti
parents: 12361
diff changeset
237 @Override
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
238 public void remove() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
239 throw new UnsupportedOperationException();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
240 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
241 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
242
15269
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
243 class NodeUsageWithModCountIterator extends NodeUsageIterator {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
244
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
245 private final int expectedModCount = usageModCount();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
246
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
247 @Override
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
248 public boolean hasNext() {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
249 if (expectedModCount != usageModCount()) {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
250 throw new ConcurrentModificationException();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
251 }
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
252 return super.hasNext();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
253 }
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
254
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
255 @Override
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
256 public Node next() {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
257 if (expectedModCount != usageModCount()) {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
258 throw new ConcurrentModificationException();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
259 }
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
260 return super.next();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
261 }
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
262 }
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
263
15146
65efd2eeea1b Remove AbstractNodeIterable, move its methods to default methods on NodeIterable.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15040
diff changeset
264 class NodeUsageIterable implements NodeIterable<Node> {
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
265
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
266 public NodeUsageIterator iterator() {
15269
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
267 if (MODIFICATION_COUNTS_ENABLED) {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
268 return new NodeUsageWithModCountIterator();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
269 } else {
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
270 return new NodeUsageIterator();
ad3441f45118 Make a NodeUsageWithModCountIterator subclass of NodeUsageIterator. Throw ConcurrentModificationException from it instead of AssertionErrors
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15193
diff changeset
271 }
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
272 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
273
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
274 @Override
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
275 public boolean isEmpty() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
276 return usage0 == null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
277 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
278
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
279 @Override
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
280 public boolean isNotEmpty() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
281 return usage0 != null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
282 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
283
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
284 @Override
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
285 public int count() {
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
286 return usageCount();
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
287 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
288 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
289
11654
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
290 int getUsageCountUpperBound() {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
291 assert recordsUsages();
11654
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
292 if (usage0 == null) {
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
293 return 0;
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
294 }
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
295 if (usage1 == null) {
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
296 return 1;
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
297 }
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
298 return 2 + extraUsages.length;
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
299 }
317036da1f29 Improve global value numbering algorithm.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11653
diff changeset
300
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
301 /**
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
302 * Gets the list of nodes that use this node (i.e., as an input).
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
303 */
7123
b914b9b4c578 graal.graph refactorings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6458
diff changeset
304 public final NodeIterable<Node> usages() {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
305 assert recordsUsages() : this;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
306 return new NodeUsageIterable();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
307 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
308
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
309 /**
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
310 * Determines if this node records its usages (i.e. the nodes for which it is an input). All
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
311 * methods in {@link Node} that pertain to querying or updating usage information must not be
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
312 * called for a {@link Node} instance that returns false for this method.
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
313 */
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
314 public boolean recordsUsages() {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
315 return true;
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
316 }
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
317
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
318 /**
11539
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
319 * Finds the index of the last non-null entry in a node array. The search assumes that all
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
320 * non-null entries precede the first null entry in the array.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
321 *
11539
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
322 * @param nodes the array to search
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
323 * @return the index of the last non-null entry in {@code nodes} if it exists, else -1
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
324 */
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
325 private static int indexOfLastNonNull(Node[] nodes) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
326 if (nodes.length == 0 || nodes[0] == null) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
327 return -1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
328 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
329 if (nodes[nodes.length - 1] != null) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
330 return nodes.length - 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
331 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
332
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
333 // binary search
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
334 int low = 0;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
335 int high = nodes.length - 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
336 while (true) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
337 int mid = (low + high) >>> 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
338 if (nodes[mid] == null) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
339 if (nodes[mid - 1] != null) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
340 return mid - 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
341 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
342 high = mid - 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
343 } else {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
344 if (mid == nodes.length - 1 || nodes[mid + 1] == null) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
345 return mid;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
346 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
347 low = mid + 1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
348 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
349 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
350 }
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
351
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
352 /**
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
353 * Adds a given node to this node's {@linkplain #usages() usages}.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
354 *
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
355 * @param node the node to add
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
356 */
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
357 private void addUsage(Node node) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
358 assert recordsUsages();
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
359 incUsageModCount();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
360 if (usage0 == null) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
361 usage0 = node;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
362 } else if (usage1 == null) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
363 usage1 = node;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
364 } else {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
365 int length = extraUsages.length;
11539
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
366 if (length == 0) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
367 extraUsages = new Node[4];
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
368 extraUsages[0] = node;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
369 } else {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
370 int lastNonNull = indexOfLastNonNull(extraUsages);
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
371 if (lastNonNull == length - 1) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
372 extraUsages = Arrays.copyOf(extraUsages, length * 2 + 1);
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
373 extraUsages[length] = node;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
374 } else if (lastNonNull == -1) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
375 extraUsages[0] = node;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
376 } else {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
377 extraUsages[lastNonNull + 1] = node;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
378 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
379 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
380 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
381 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
382
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
383 private int usageCount() {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
384 if (usage0 == null) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
385 return 0;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
386 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
387 if (usage1 == null) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
388 return 1;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
389 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
390 return 2 + indexOfLastNonNull(extraUsages) + 1;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
391 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
392
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
393 /**
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
394 * Remove all usages between {@code fromIndex} and {@code toIndex} (exclusive), also, if
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
395 * {@code toIndex} is a valid usage, it is moved to {@code fromIndex}.
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
396 *
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
397 * <p>
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
398 * Visually,
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
399 *
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
400 * <pre>
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
401 * {@code
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
402 * [1, 2, 3, 4, 5, 6, 7].removeUsagesAndShiftFirst(1, 2) == [1, 4, 6, 7, 5, null, null]}
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
403 * </pre>
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
404 *
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
405 *
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
406 * @param fromIndex the index of the first element to be removed
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
407 * @param toIndex the index after the last element to be removed
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
408 */
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
409 private void removeUsagesAndShiftFirst(int fromIndex, int toIndex) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
410 assert fromIndex < toIndex;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
411 int firstNullIndex = usageCount();
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
412 assert toIndex <= firstNullIndex;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
413 int i = fromIndex;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
414 int limit = toIndex;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
415 if (toIndex < firstNullIndex) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
416 // move usage at toIndex to fromIndex(!)
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
417 movUsageTo(toIndex, fromIndex);
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
418 limit++;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
419 i++;
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
420 }
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
421 while (i < limit && firstNullIndex > limit) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
422 movUsageTo(firstNullIndex - 1, i);
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
423 firstNullIndex--;
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
424 i++;
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
425 }
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
426 while (i < limit) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
427 if (i == 0) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
428 usage0 = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
429 } else if (i == 1) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
430 usage1 = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
431 } else {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
432 extraUsages[i - INLINE_USAGE_COUNT] = null;
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
433 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
434 i++;
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
435 }
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
436
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
437 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
438
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
439 private void movUsageTo(int usageIndex, int toIndex) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
440 assert usageIndex > toIndex;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
441 if (toIndex == 0) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
442 if (usageIndex == 1) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
443 usage0 = usage1;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
444 usage1 = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
445 } else {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
446 usage0 = extraUsages[usageIndex - INLINE_USAGE_COUNT];
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
447 extraUsages[usageIndex - INLINE_USAGE_COUNT] = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
448 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
449 } else if (toIndex == 1) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
450 usage1 = extraUsages[usageIndex - INLINE_USAGE_COUNT];
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
451 extraUsages[usageIndex - INLINE_USAGE_COUNT] = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
452 } else {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
453 extraUsages[toIndex - INLINE_USAGE_COUNT] = extraUsages[usageIndex - INLINE_USAGE_COUNT];
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
454 extraUsages[usageIndex - INLINE_USAGE_COUNT] = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
455 }
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
456 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
457
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
458 /**
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
459 * Removes a given node from this node's {@linkplain #usages() usages}.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
460 *
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
461 * @param node the node to remove
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
462 * @return whether or not {@code usage} was in the usage list
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
463 */
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
464 private boolean removeUsage(Node node) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
465 assert recordsUsages();
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
466 assert node != null;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
467 // It is critical that this method maintains the invariant that
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
468 // the usage list has no null element preceding a non-null element
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
469 incUsageModCount();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
470 if (usage0 == node) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
471 if (usage1 != null) {
11539
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
472 int lastNonNull = indexOfLastNonNull(extraUsages);
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
473 if (lastNonNull >= 0) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
474 usage0 = extraUsages[lastNonNull];
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
475 extraUsages[lastNonNull] = null;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
476 } else {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
477 // usage1 is the last element
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
478 usage0 = usage1;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
479 usage1 = null;
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
480 }
11531
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
481 } else {
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
482 // usage0 is the last element
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
483 usage0 = null;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
484 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
485 return true;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
486 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
487 if (usage1 == node) {
11539
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
488 int lastNonNull = indexOfLastNonNull(extraUsages);
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
489 if (lastNonNull >= 0) {
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
490 usage1 = extraUsages[lastNonNull];
edf875b3c091 use binary search when looking for the end of Node.extraUsages (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11531
diff changeset
491 extraUsages[lastNonNull] = null;
11531
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
492 } else {
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
493 // usage1 is the last element
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
494 usage1 = null;
331f7590b741 modified Node.removeUsage to do less copying (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11528
diff changeset
495 }
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
496 return true;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
497 }
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
498 int matchIndex = -1;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
499 int i = 0;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
500 Node n;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
501 while (i < extraUsages.length && (n = extraUsages[i]) != null) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
502 if (n == node) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
503 matchIndex = i;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
504 }
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
505 i++;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
506 }
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
507 if (matchIndex >= 0) {
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
508 extraUsages[matchIndex] = extraUsages[i - 1];
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
509 extraUsages[i - 1] = null;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
510 return true;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
511 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
512 return false;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
513 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
514
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
515 private void clearUsages() {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
516 assert recordsUsages();
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
517 incUsageModCount();
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
518 usage0 = null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
519 usage1 = null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
520 extraUsages = NO_NODES;
3733
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 public final Node predecessor() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
524 return predecessor;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
525 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
526
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
527 final int modCount() {
11524
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
528 if (MODIFICATION_COUNTS_ENABLED && graph != null) {
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
529 return graph.modCount(this);
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
530 }
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
531 return 0;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
532 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
533
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
534 final void incModCount() {
11524
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
535 if (MODIFICATION_COUNTS_ENABLED && graph != null) {
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
536 graph.incModCount(this);
dede53632f3e removed Node.modCount field (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11492
diff changeset
537 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
538 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
539
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
540 final int usageModCount() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
541 if (MODIFICATION_COUNTS_ENABLED && graph != null) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
542 return graph.usageModCount(this);
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
543 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
544 return 0;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
545 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
546
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
547 final void incUsageModCount() {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
548 if (MODIFICATION_COUNTS_ENABLED && graph != null) {
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
549 graph.incUsageModCount(this);
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
550 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
551 }
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
552
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
553 public boolean isDeleted() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
554 return id <= DELETED_ID_START;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
555 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
556
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
557 public boolean isAlive() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
558 return id >= ALIVE_ID_START;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
559 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
560
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
561 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
562 * Updates the usages sets of the given nodes after an input slot is changed from oldInput to
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
563 * newInput: removes this node from oldInput's usages and adds this node to newInput's usages.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
564 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
565 protected void updateUsages(Node oldInput, Node newInput) {
14577
532d9b78c7d4 assert that only live ValueNodes are added as inputs and successors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14157
diff changeset
566 assert isAlive() && (newInput == null || newInput.isAlive()) : "adding " + newInput + " to " + this + " instead of " + oldInput;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
567 if (oldInput != newInput) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
568 if (oldInput != null) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
569 if (oldInput.recordsUsages()) {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
570 boolean result = removeThisFromUsages(oldInput);
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
571 assert assertTrue(result, "not found in usages, old input: %s", oldInput);
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
572 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
573 }
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
574 maybeNotifyInputChanged(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
575 if (newInput != null) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
576 if (newInput.recordsUsages()) {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
577 newInput.addUsage(this);
4614
a3882fd1ae61 Make it possible to have multiple LoopEnds per LoopBegin
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4418
diff changeset
578 }
16175
3ee8c2cb629c notify changed when setting input to null
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16101
diff changeset
579 }
3ee8c2cb629c notify changed when setting input to null
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16101
diff changeset
580 if (oldInput != null && oldInput.recordsUsages() && oldInput.usages().isEmpty()) {
16606
7036c4594919 correct name of zero usages method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16554
diff changeset
581 maybeNotifyZeroUsages(oldInput);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
582 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
583 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
584 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
585
15007
9a73164832a9 add NodeInterface
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15002
diff changeset
586 protected void updateUsagesInterface(NodeInterface oldInput, NodeInterface newInput) {
9a73164832a9 add NodeInterface
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15002
diff changeset
587 updateUsages(oldInput == null ? null : oldInput.asNode(), newInput == null ? null : newInput.asNode());
9a73164832a9 add NodeInterface
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15002
diff changeset
588 }
9a73164832a9 add NodeInterface
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15002
diff changeset
589
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
590 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
591 * Updates the predecessor of the given nodes after a successor slot is changed from
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
592 * oldSuccessor to newSuccessor: removes this node from oldSuccessor's predecessors and adds
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
593 * this node to newSuccessor's predecessors.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
594 */
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
595 protected void updatePredecessor(Node oldSuccessor, Node newSuccessor) {
14577
532d9b78c7d4 assert that only live ValueNodes are added as inputs and successors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14157
diff changeset
596 assert isAlive() && (newSuccessor == null || newSuccessor.isAlive()) : "adding " + newSuccessor + " to " + this + " instead of " + oldSuccessor;
13744
d96dbd96bb45 Always copy method substitutions. Add some assertion checking for it.
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13327
diff changeset
597 assert graph == null || !graph.isFrozen();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
598 if (oldSuccessor != newSuccessor) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
599 if (oldSuccessor != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
600 assert assertTrue(oldSuccessor.predecessor == this, "wrong predecessor in old successor (%s): %s", oldSuccessor, oldSuccessor.predecessor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
601 oldSuccessor.predecessor = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
602 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
603 if (newSuccessor != null) {
11676
435c8b984680 Distinguish inputs and successors in in-place updates.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11674
diff changeset
604 assert assertTrue(newSuccessor.predecessor == null, "unexpected non-null predecessor in new successor (%s): %s, this=%s", newSuccessor, newSuccessor.predecessor, this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
605 newSuccessor.predecessor = this;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
606 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
607 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
608 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
609
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
610 void initialize(Graph newGraph) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
611 assert assertTrue(id == INITIAL_ID, "unexpected id: %d", id);
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
612 this.graph = newGraph;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
613 newGraph.register(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
614 for (Node input : inputs()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
615 updateUsages(null, input);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
616 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
617 for (Node successor : successors()) {
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
618 updatePredecessor(null, successor);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
619 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
620 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
621
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
622 public final NodeClass getNodeClass() {
11431
ca53d08b8ef9 removed Node.nodeClass field (GRAAL-359)
Doug Simon <doug.simon@oracle.com>
parents: 9495
diff changeset
623 return NodeClass.get(getClass());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
624 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
625
15002
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
626 public boolean isAllowedUsageType(InputType type) {
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
627 return getNodeClass().getAllowedUsageTypes().contains(type);
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
628 }
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
629
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
630 private boolean checkReplaceWith(Node other) {
13744
d96dbd96bb45 Always copy method substitutions. Add some assertion checking for it.
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13327
diff changeset
631 assert assertTrue(graph == null || !graph.isFrozen(), "cannot modify frozen graph");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
632 assert assertFalse(other == this, "cannot replace a node with itself");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
633 assert assertFalse(isDeleted(), "cannot replace deleted node");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
634 assert assertTrue(other == null || !other.isDeleted(), "cannot replace with deleted node %s", other);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
635 return true;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
636 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
637
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
638 public void replaceAtUsages(Node other) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
639 assert checkReplaceWith(other);
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
640 for (Node usage : usages()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
641 boolean result = usage.getNodeClass().replaceFirstInput(usage, this, other);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
642 assert assertTrue(result, "not found in inputs, usage: %s", usage);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
643 if (other != null) {
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
644 maybeNotifyInputChanged(usage);
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
645 if (other.recordsUsages()) {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
646 other.addUsage(usage);
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
647 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
648 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
649 }
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
650 clearUsages();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
651 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
652
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
653 public void replaceAtMatchingUsages(Node other, NodePredicate usagePredicate) {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
654 assert checkReplaceWith(other);
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
655 NodeUsageIterator it = (NodeUsageIterator) usages().iterator();
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
656 int removeStart = -1;
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
657 while (it.hasNext()) {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
658 Node usage = it.next();
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
659 if (usagePredicate.apply(usage)) {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
660 if (removeStart < 0) {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
661 removeStart = it.index - 1;
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
662 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
663 boolean result = usage.getNodeClass().replaceFirstInput(usage, this, other);
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
664 assert assertTrue(result, "not found in inputs, usage: %s", usage);
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
665 if (other != null) {
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
666 maybeNotifyInputChanged(usage);
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
667 if (other.recordsUsages()) {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
668 other.addUsage(usage);
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
669 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
670 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
671 } else {
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
672 if (removeStart >= 0) {
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
673 int removeEndIndex = it.index - 1;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
674 removeUsagesAndShiftFirst(removeStart, removeEndIndex);
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
675 it.index = removeStart;
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
676 it.advance();
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
677 removeStart = -1;
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
678 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
679 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
680 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
681 if (removeStart >= 0) {
15153
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
682 int removeEndIndex = it.index;
d224a3a0e6a9 Various optimizations of Node.replaceAtMatchingUsages and Node.replaceAtUsages
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15150
diff changeset
683 removeUsagesAndShiftFirst(removeStart, removeEndIndex);
15150
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
684 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
685 }
101a31da0dd0 Add Node.replaceAtMatchingUsages(Node, NodePredicate) and some tests.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15146
diff changeset
686
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
687 public void replaceAtUsages(InputType type, Node other) {
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
688 assert checkReplaceWith(other);
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
689 for (Node usage : usages().snapshot()) {
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
690 NodeClassIterator iter = usage.inputs().iterator();
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
691 while (iter.hasNext()) {
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
692 Position pos = iter.nextPosition();
15315
518a7f487c4f Fix bug in InputType specific replaceAtUsages.
Roland Schatz <roland.schatz@oracle.com>
parents: 15010
diff changeset
693 if (pos.getInputType(usage) == type && pos.get(usage) == this) {
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
694 pos.set(usage, other);
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
695 }
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
696 }
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
697 }
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
698 }
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
699
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
700 private void maybeNotifyInputChanged(Node node) {
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
701 if (graph != null) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
702 assert !graph.isFrozen();
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
703 NodeEventListener listener = graph.nodeEventListener;
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
704 if (listener != null) {
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
705 listener.inputChanged(node);
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
706 }
13979
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
707 }
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
708 }
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
709
16606
7036c4594919 correct name of zero usages method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16554
diff changeset
710 private void maybeNotifyZeroUsages(Node node) {
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
711 if (graph != null) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
712 assert !graph.isFrozen();
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
713 NodeEventListener listener = graph.nodeEventListener;
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
714 if (listener != null) {
16241
c6ebc1997a55 added listener for nodes being added to a graph; consolidated all node event listeners into new NodeEventListener interface and made registering such listeners work in a try-with-resources statement so that de-registration is automatic
Doug Simon <doug.simon@oracle.com>
parents: 16239
diff changeset
715 listener.usagesDroppedToZero(node);
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13979
diff changeset
716 }
13979
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
717 }
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
718 }
5568586d32a6 factor out listener notify. fix typo
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13744
diff changeset
719
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
720 public void replaceAtPredecessor(Node other) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
721 assert checkReplaceWith(other);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
722 if (predecessor != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
723 boolean result = predecessor.getNodeClass().replaceFirstSuccessor(predecessor, this, other);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
724 assert assertTrue(result, "not found in successors, predecessor: %s", predecessor);
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
725 predecessor.updatePredecessor(this, other);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
726 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
727 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
728
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
729 public void replaceAndDelete(Node other) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
730 assert checkReplaceWith(other);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
731 if (other != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
732 clearSuccessors();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
733 replaceAtUsages(other);
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
734 replaceAtPredecessor(other);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
735 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
736 safeDelete();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
737 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
738
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
739 public void replaceFirstSuccessor(Node oldSuccessor, Node newSuccessor) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
740 if (getNodeClass().replaceFirstSuccessor(this, oldSuccessor, newSuccessor)) {
5487
9743ae819f73 Move virtual chain help methods from SuperBlock to GraphUtil
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5485
diff changeset
741 updatePredecessor(oldSuccessor, newSuccessor);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
742 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
743 }
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 public void replaceFirstInput(Node oldInput, Node newInput) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
746 if (getNodeClass().replaceFirstInput(this, oldInput, newInput)) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
747 updateUsages(oldInput, newInput);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
748 }
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
16101
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
751 private void unregisterInputs() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
752 for (Node input : inputs()) {
13327
c258331fdde6 removed support for external nodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 13140
diff changeset
753 if (input.recordsUsages()) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
754 removeThisFromUsages(input);
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
755 if (input.usages().isEmpty()) {
16606
7036c4594919 correct name of zero usages method
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16554
diff changeset
756 maybeNotifyZeroUsages(input);
9331
199c77760850 Rename InputChangedListener => NodeChangedListener. Add event for usage count of a node dropping to 0.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8555
diff changeset
757 }
199c77760850 Rename InputChangedListener => NodeChangedListener. Add event for usage count of a node dropping to 0.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8555
diff changeset
758 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
759 }
16101
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
760 }
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
761
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
762 public void clearInputs() {
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
763 assert assertFalse(isDeleted(), "cannot clear inputs of deleted node");
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
764
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
765 unregisterInputs();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
766 getNodeClass().clearInputs(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
767 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
768
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
769 private boolean removeThisFromUsages(Node n) {
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
770 return n.removeUsage(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
771 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
772
16101
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
773 private void unregisterSuccessors() {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
774 for (Node successor : successors()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
775 assert assertTrue(successor.predecessor == this, "wrong predecessor in old successor (%s): %s", successor, successor.predecessor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
776 successor.predecessor = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
777 }
16101
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
778 }
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
779
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
780 public void clearSuccessors() {
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
781 assert assertFalse(isDeleted(), "cannot clear successors of deleted node");
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
782
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
783 unregisterSuccessors();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
784 getNodeClass().clearSuccessors(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
785 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
786
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
787 private boolean checkDeletion() {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
788 if (recordsUsages()) {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
789 assertTrue(usages().isEmpty(), "cannot delete node %s because of usages: %s", this, usages());
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
790 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
791 assertTrue(predecessor == null, "cannot delete node %s because of predecessor: %s", this, predecessor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
792 return true;
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
5258
97b1e0ab7442 added javadoc to some of the API for removing nodes from a graph
Doug Simon <doug.simon@oracle.com>
parents: 5175
diff changeset
795 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
796 * Removes this node from its graph. This node must have no {@linkplain Node#usages() usages}
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
797 * and no {@linkplain #predecessor() predecessor}.
5258
97b1e0ab7442 added javadoc to some of the API for removing nodes from a graph
Doug Simon <doug.simon@oracle.com>
parents: 5175
diff changeset
798 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
799 public void safeDelete() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
800 assert checkDeletion();
16101
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
801 unregisterInputs();
99e2e006ade2 do not zap inputs and successors in Node.safeDelete
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15827
diff changeset
802 unregisterSuccessors();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
803 graph.unregister(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
804 id = DELETED_ID_START - id;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
805 assert isDeleted();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
806 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
807
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
808 public final Node copyWithInputs() {
16554
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
809 return copyWithInputs(true);
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
810 }
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
811
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
812 public final Node copyWithInputs(boolean addToGraph) {
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
813 Node newNode = clone(addToGraph ? graph : null);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
814 NodeClass clazz = getNodeClass();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
815 clazz.copyInputs(this, newNode);
16554
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
816 if (addToGraph) {
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
817 for (Node input : inputs()) {
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
818 if (input.recordsUsages()) {
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
819 input.addUsage(newNode);
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
820 }
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
821 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
822 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
823 return newNode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
824 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
825
11677
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
826 public final Node clone(Graph into) {
11674
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
827 return clone(into, true);
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
828 }
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
829
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: 11755
diff changeset
830 /**
11940
87402d9a67ca spelling fix
Doug Simon <doug.simon@oracle.com>
parents: 11891
diff changeset
831 * Must be overridden by subclasses that implement {@link Simplifiable}. The implementation in
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: 11755
diff changeset
832 * {@link Node} exists to obviate the need to cast a node before invoking
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
833 * {@link Simplifiable#simplify(SimplifierTool)}.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
834 *
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: 11755
diff changeset
835 * @param tool
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
836 */
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
837 public void simplify(SimplifierTool tool) {
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
838 throw new UnsupportedOperationException();
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
839 }
51059863da73 replace instanceof type tests for Canonicalizable and Simplifiable with extra boolean properties in NodeClass (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents: 11755
diff changeset
840
11677
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
841 final Node clone(Graph into, boolean clearInputsAndSuccessors) {
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: 11631
diff changeset
842 NodeClass nodeClass = getNodeClass();
16554
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
843 if (into != null && nodeClass.valueNumberable() && nodeClass.isLeafNode()) {
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: 11631
diff changeset
844 Node otherNode = into.findNodeInCache(this);
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
845 if (otherNode != null) {
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
846 return otherNode;
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
847 }
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
848 }
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
849
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
850 Node newNode = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
851 try {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
852 newNode = (Node) this.clone();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
853 } catch (CloneNotSupportedException e) {
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15153
diff changeset
854 throw new GraalGraphInternalError(e).addContext(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
855 }
11674
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
856 if (clearInputsAndSuccessors) {
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
857 nodeClass.clearInputs(newNode);
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
858 nodeClass.clearSuccessors(newNode);
8505bcff4bdc New graph duplication mechanism that allows in-place fixing of edges.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11666
diff changeset
859 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
860 newNode.graph = into;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
861 newNode.typeCacheNext = null;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
862 newNode.id = INITIAL_ID;
16554
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
863 if (into != null) {
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
864 into.register(newNode);
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
865 }
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
866 newNode.usage0 = null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
867 newNode.usage1 = null;
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
868 newNode.extraUsages = NO_NODES;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
869 newNode.predecessor = null;
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: 11631
diff changeset
870
16554
f3c1b2d999da clone nodes without adding to a graph
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16336
diff changeset
871 if (into != null && nodeClass.valueNumberable() && nodeClass.isLeafNode()) {
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: 11631
diff changeset
872 into.putNodeIntoCache(newNode);
64a9ed9f1e8d Introduce NodeClass.isLeafNode(). Avoid cloning of leaf nodes if equal node is found in destination graph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11631
diff changeset
873 }
11677
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
874 newNode.afterClone(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
875 return newNode;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
876 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
877
11677
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
878 protected void afterClone(@SuppressWarnings("unused") Node other) {
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
879 }
9d341b6e47e5 Correct custom clone implementations after change of Node base class clone method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11676
diff changeset
880
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
881 public boolean verify() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
882 assertTrue(isAlive(), "cannot verify inactive nodes (id=%d)", id);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
883 assertTrue(graph() != null, "null graph");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
884 for (Node input : inputs()) {
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
885 assertTrue(!input.recordsUsages() || input.usages().contains(this), "missing usage in input %s", input);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
886 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
887 for (Node successor : successors()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
888 assertTrue(successor.predecessor() == this, "missing predecessor in %s (actual: %s)", successor, successor.predecessor());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
889 assertTrue(successor.graph() == graph(), "mismatching graph in successor %s", successor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
890 }
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
891 if (recordsUsages()) {
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
892 for (Node usage : usages()) {
12723
bbf6407458ee Node: print node in assert
Bernhard Urban <bernhard.urban@jku.at>
parents: 12686
diff changeset
893 assertFalse(usage.isDeleted(), "usage %s must never be deleted", usage);
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
894 assertTrue(usage.inputs().contains(this), "missing input in usage %s", usage);
15010
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
895 NodeClassIterator iterator = usage.inputs().iterator();
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
896 while (iterator.hasNext()) {
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
897 Position pos = iterator.nextPosition();
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
898 if (pos.get(usage) == this && pos.getInputType(usage) != InputType.Unchecked) {
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
899 assert isAllowedUsageType(pos.getInputType(usage)) : "invalid input of type " + pos.getInputType(usage) + " from " + usage + " to " + this + " (" + pos.getInputName(usage) +
f36e56e9dd9a add allowedUsageType to GuardProxy/GuardPhi, changelog, remove debug output
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15007
diff changeset
900 ")";
15002
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
901 }
06e50d290784 isAllowedUsageType on Nodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15001
diff changeset
902 }
12570
af39ea2dc39d made ConstantNodes (optionally) not record their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12437
diff changeset
903 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
904 }
16332
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
905 NodeClassIterator iterator = inputs().withNullIterator();
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
906 while (iterator.hasNext()) {
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
907 Position pos = iterator.nextPosition();
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
908 assert pos.isInputOptional(this) || pos.get(this) != null : "non-optional input " + pos.getInputName(this) + " cannot be null in " + this + " (fix nullness or use @OptionalInput)";
ddd68e267e34 explicitly define optional inputs in @Input
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16241
diff changeset
909 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
910 if (predecessor != null) {
12723
bbf6407458ee Node: print node in assert
Bernhard Urban <bernhard.urban@jku.at>
parents: 12686
diff changeset
911 assertFalse(predecessor.isDeleted(), "predecessor %s must never be deleted", predecessor);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
912 assertTrue(predecessor.successors().contains(this), "missing successor in predecessor %s", predecessor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
913 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
914 return true;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
915 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
916
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
917 public boolean assertTrue(boolean condition, String message, Object... args) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
918 if (condition) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
919 return true;
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 throw new VerificationError(message, args).addContext(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
922 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
923 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
924
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
925 public boolean assertFalse(boolean condition, String message, Object... args) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
926 if (condition) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
927 throw new VerificationError(message, args).addContext(this);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
928 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
929 return true;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
933 public Iterable<? extends Node> cfgPredecessors() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
934 if (predecessor == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
935 return Collections.emptySet();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
936 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
937 return Collections.singleton(predecessor);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
938 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
939 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
940
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
941 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
942 * Returns an iterator that will provide all control-flow successors of this node. Normally this
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
943 * will be the contents of all fields marked as NodeSuccessor, but some node classes (like
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
944 * EndNode) may return different nodes. Note that the iterator may generate null values if the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
945 * fields contain them.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
946 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
947 public Iterable<? extends Node> cfgSuccessors() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
948 return successors();
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 /**
13327
c258331fdde6 removed support for external nodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 13140
diff changeset
952 * Nodes always use an {@linkplain System#identityHashCode(Object) identity} hash code.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
953 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
954 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
955 public final int hashCode() {
12655
2c4aa758ee18 made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
956 return System.identityHashCode(this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
957 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
958
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
959 /**
13327
c258331fdde6 removed support for external nodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 13140
diff changeset
960 * Equality tests must rely solely on identity.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
961 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
962 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
963 public final boolean equals(Object obj) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
964 return super.equals(obj);
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
967 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
968 * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
969 * ideal graph visualizer).
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
970 */
9495
6ad0bdcd76aa make Node.getDebugProperties() final
Lukas Stadler <lukas.stadler@jku.at>
parents: 9332
diff changeset
971 public final Map<Object, Object> getDebugProperties() {
5813
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
972 return getDebugProperties(new HashMap<>());
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
973 }
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
974
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
975 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
976 * Fills a {@link Map} with properties of this node for use in debugging (e.g., to view in the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
977 * ideal graph visualizer). Subclasses overriding this method should also fill the map using
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
978 * their superclass.
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14577
diff changeset
979 *
5813
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
980 * @param map
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
981 */
3b8bc07f8d17 Add ability to give an existing to getDebugProperties
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5810
diff changeset
982 public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
15827
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
983 NodeClass nodeClass = getNodeClass();
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
984 for (Integer pos : nodeClass.getPropertyPositions()) {
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
985 map.put(nodeClass.getPropertyName(pos), nodeClass.getProperty(this, pos));
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
986
4e770fa50889 Make NodeClass more flexible
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15381
diff changeset
987 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
988 return map;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
989 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
990
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
991 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
992 * This method is a shortcut for {@link #toString(Verbosity)} with {@link Verbosity#Short}.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
993 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
994 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
995 public final String toString() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
996 return toString(Verbosity.Short);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
997 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
998
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
999 public enum Verbosity {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1000 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1001 * Only the id of the node.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1002 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1003 Id,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1004 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
1005 * Only the name of the node, which may contain some more information for certain node types
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7521
diff changeset
1006 * (constants, ...).
3733
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 Name,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1009 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1010 * {@link #Id} + {@link #Name}.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1011 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1012 Short,
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 * Defaults to {@link #Short} and may be enhanced by subclasses.
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 Long,
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 * For use by a custom formatting facility in an IDE.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1019 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1020 Debugger,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1021 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1022 * All the other information plus all debug properties of the node.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1023 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1024 All
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1027 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1028 * Creates a String representation for this node with a given {@link Verbosity}.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1029 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1030 public String toString(Verbosity verbosity) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1031 switch (verbosity) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1032 case Id:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1033 return Integer.toString(id);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1034 case Name:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1035 return getNodeClass().shortName();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1036 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1037 return toString(Verbosity.Id) + "|" + toString(Verbosity.Name);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1038 case Long:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1039 return toString(Verbosity.Short);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1040 case Debugger:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1041 case All: {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1042 StringBuilder str = new StringBuilder();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1043 str.append(toString(Verbosity.Short)).append(" { ");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1044 for (Map.Entry<Object, Object> entry : getDebugProperties().entrySet()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1045 str.append(entry.getKey()).append("=").append(entry.getValue()).append(", ");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1046 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1047 str.append(" }");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1048 return str.toString();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1049 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1050 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1051 throw new RuntimeException("unknown verbosity: " + verbosity);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1052 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1053 }
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1054
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5806
diff changeset
1055 @Deprecated
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5806
diff changeset
1056 public int getId() {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5806
diff changeset
1057 return id;
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5806
diff changeset
1058 }
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5806
diff changeset
1059
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1060 @Override
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1061 public void formatTo(Formatter formatter, int flags, int width, int precision) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1062 if ((flags & FormattableFlags.ALTERNATE) == FormattableFlags.ALTERNATE) {
4418
46e9068c09b4 small fixed to log output
Lukas Stadler <lukas.stadler@jku.at>
parents: 4397
diff changeset
1063 formatter.format("%s", toString(Verbosity.Id));
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1064 } else if ((flags & FormattableFlags.UPPERCASE) == FormattableFlags.UPPERCASE) {
15036
9806a98bcf9a make %S format for Node emit Verbosity.All
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15010
diff changeset
1065 // Use All here since Long is only slightly longer than Short.
9806a98bcf9a make %S format for Node emit Verbosity.All
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15010
diff changeset
1066 formatter.format("%s", toString(Verbosity.All));
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1067 } else {
4418
46e9068c09b4 small fixed to log output
Lukas Stadler <lukas.stadler@jku.at>
parents: 4397
diff changeset
1068 formatter.format("%s", toString(Verbosity.Short));
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1069 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1070
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1071 boolean neighborsAlternate = ((flags & FormattableFlags.LEFT_JUSTIFY) == FormattableFlags.LEFT_JUSTIFY);
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1072 int neighborsFlags = (neighborsAlternate ? FormattableFlags.ALTERNATE | FormattableFlags.LEFT_JUSTIFY : 0);
11666
3967f9f306f8 Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11654
diff changeset
1073 NodeClass nodeClass = getNodeClass();
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1074 if (width > 0) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1075 if (this.predecessor != null) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1076 formatter.format(" pred={");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1077 this.predecessor.formatTo(formatter, neighborsFlags, width - 1, 0);
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1078 formatter.format("}");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1079 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1080
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1081 NodeClassIterator inputIter = inputs().iterator();
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1082 while (inputIter.hasNext()) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1083 Position position = inputIter.nextPosition();
11666
3967f9f306f8 Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11654
diff changeset
1084 Node input = nodeClass.get(this, position);
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1085 if (input != null) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1086 formatter.format(" ");
11666
3967f9f306f8 Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11654
diff changeset
1087 formatter.format(nodeClass.getName(position));
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1088 formatter.format("={");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1089 input.formatTo(formatter, neighborsFlags, width - 1, 0);
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1090 formatter.format("}");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1091 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1092 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1093 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1094
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1095 if (precision > 0) {
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
1096 if (!usages().isEmpty()) {
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1097 formatter.format(" usages={");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1098 int z = 0;
11528
8f500c7a510a inlined NodeUsageList into Node (GRAAL-452)
Doug Simon <doug.simon@oracle.com>
parents: 11524
diff changeset
1099 for (Node usage : usages()) {
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1100 if (z != 0) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1101 formatter.format(", ");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1102 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1103 usage.formatTo(formatter, neighborsFlags, 0, precision - 1);
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1104 ++z;
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1105 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1106 formatter.format("}");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1107 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1108
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1109 NodeClassIterator succIter = successors().iterator();
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1110 while (succIter.hasNext()) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1111 Position position = succIter.nextPosition();
11666
3967f9f306f8 Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11654
diff changeset
1112 Node successor = nodeClass.get(this, position);
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1113 if (successor != null) {
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1114 formatter.format(" ");
11666
3967f9f306f8 Factor usages of getNodeClass().
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11654
diff changeset
1115 formatter.format(nodeClass.getName(position));
4397
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1116 formatter.format("={");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1117 successor.formatTo(formatter, neighborsFlags, 0, precision - 1);
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1118 formatter.format("}");
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1119 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1120 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1121 }
403330cfd3da Added Formattable interface to node base class in order to allow custom handling of formatter specifiers for the node class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4311
diff changeset
1122 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1123 }