annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java @ 8536:2978a819763b

CheckCastSnippets: anchor UnsafeCast with subclass tests
author Bernhard Urban <bernhard.urban@jku.at>
date Wed, 27 Mar 2013 19:11:30 +0100
parents 21bf57680185
children 653110156f8a
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.nodes;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
25 import static com.oracle.graal.graph.iterators.NodePredicates.*;
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.graph.iterators.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.nodes.spi.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.nodes.type.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
34 public class BeginNode extends FixedWithNextNode implements StateSplit, LIRLowerable, Simplifiable, Node.IterableNodeType {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
35
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
36 @Input(notDataflow = true) private FrameState stateAfter;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
37
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
38 public FrameState stateAfter() {
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
39 return stateAfter;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
40 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
41
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
42 public void setStateAfter(FrameState x) {
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
43 assert x == null || x.isAlive() : "frame state must be in a graph";
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
44 updateUsages(stateAfter, x);
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
45 stateAfter = x;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
46 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
47
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
48 public boolean hasSideEffect() {
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
49 return false;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
50 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
51
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 public BeginNode() {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5375
diff changeset
53 super(StampFactory.dependency());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
8441
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7897
diff changeset
56 protected BeginNode(Stamp stamp) {
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7897
diff changeset
57 super(stamp);
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7897
diff changeset
58 }
21bf57680185 Fuse the ExceptionObject its DispatchBegin into a single node since it has to be atomic while gurads are floating
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7897
diff changeset
59
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 public static BeginNode begin(FixedNode with) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 if (with instanceof BeginNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 return (BeginNode) with;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
64 BeginNode begin = with.graph().add(new BeginNode());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 begin.setNext(with);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 return begin;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 @Override
4310
72d099e5be61 more CanonicalizerPhase simplifications, added Simplifiable interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 4309
diff changeset
70 public void simplify(SimplifierTool tool) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 FixedNode prev = (FixedNode) this.predecessor();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 if (prev == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 // This is the start node.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 } else if (prev instanceof ControlSplitNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 // This begin node is necessary.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 // This begin node can be removed and all guards moved up to the preceding begin node.
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
78 prepareDelete();
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5814
diff changeset
79 tool.addToWorkList(next());
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
80 ((StructuredGraph) graph()).removeFixed(this);
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
81 }
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
82 }
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
83
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
84 public static BeginNode prevBegin(FixedNode from) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
85 Node prevBegin = from;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
86 while (prevBegin != null) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
87 if (prevBegin instanceof BeginNode) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
88 return (BeginNode) prevBegin;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
89 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
90 prevBegin = prevBegin.predecessor();
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
91 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
92 return null;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
93 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
94
6573
4eba1a717254 extended IfNode simplification to try and connect code that initializes a variable directly with the successors of an if construct that switches on the variable
Doug Simon <doug.simon@oracle.com>
parents: 6534
diff changeset
95 private void evacuateGuards(FixedNode evacuateFrom) {
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
96 if (!usages().isEmpty()) {
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
97 BeginNode prevBegin = prevBegin(evacuateFrom);
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
98 assert prevBegin != null;
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
99 for (Node anchored : anchored().snapshot()) {
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
100 anchored.replaceFirstInput(this, prevBegin);
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
101 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
105 public void prepareDelete() {
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
106 prepareDelete((FixedNode) predecessor());
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
107 }
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
108
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
109 public void prepareDelete(FixedNode evacuateFrom) {
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
110 removeProxies();
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
111 evacuateGuards(evacuateFrom);
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
112 }
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
113
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
114 public void removeProxies() {
7897
a58851061377 rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
115 for (ProxyNode vpn : proxies().snapshot()) {
6318
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
116 // can not use graph.replaceFloating because vpn.value may be null during killCFG
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
117 vpn.replaceAtUsages(vpn.value());
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
118 vpn.safeDelete();
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
119 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
120 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
121
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 public boolean verify() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 assertTrue(predecessor() != null || this == ((StructuredGraph) graph()).start() || this instanceof MergeNode, "begin nodes must be connected");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 return super.verify();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 public void generate(LIRGeneratorTool gen) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 // nop
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 }
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
132
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
133 public NodeIterable<GuardNode> guards() {
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
134 return usages().filter(GuardNode.class);
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
135 }
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
136
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
137 public NodeIterable<Node> anchored() {
7897
a58851061377 rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
138 return usages().filter(isNotA(ProxyNode.class));
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
139 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
140
7897
a58851061377 rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
141 public NodeIterable<ProxyNode> proxies() {
a58851061377 rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
142 return usages().filter(ProxyNode.class);
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
143 }
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
144
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
145 public NodeIterable<FixedNode> getBlockNodes() {
5608
3bc48971a1bf Make NodeIterable an interface and create AbstractNodeIterable,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5443
diff changeset
146 return new AbstractNodeIterable<FixedNode>() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
147
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
148 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
149 public Iterator<FixedNode> iterator() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
150 return new BlockNodeIterator(BeginNode.this);
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
151 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
152 };
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
153 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
154
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
155 private class BlockNodeIterator implements Iterator<FixedNode> {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
156
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
157 private FixedNode current;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
158
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
159 public BlockNodeIterator(FixedNode next) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
160 this.current = next;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
161 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
162
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
163 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
164 public boolean hasNext() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
165 return current != null;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
166 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
167
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
168 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
169 public FixedNode next() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
170 FixedNode ret = current;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
171 if (ret == null) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
172 throw new NoSuchElementException();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
173 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
174 if (!(current instanceof FixedWithNextNode) || (current instanceof BeginNode && current != BeginNode.this)) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
175 current = null;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
176 } else {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
177 current = ((FixedWithNextNode) current).next();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
178 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
179 return ret;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
180 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
181
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
182 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
183 public void remove() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
184 throw new UnsupportedOperationException();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
185 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
186 }
8536
2978a819763b CheckCastSnippets: anchor UnsafeCast with subclass tests
Bernhard Urban <bernhard.urban@jku.at>
parents: 8441
diff changeset
187
2978a819763b CheckCastSnippets: anchor UnsafeCast with subclass tests
Bernhard Urban <bernhard.urban@jku.at>
parents: 8441
diff changeset
188 @NodeIntrinsic
2978a819763b CheckCastSnippets: anchor UnsafeCast with subclass tests
Bernhard Urban <bernhard.urban@jku.at>
parents: 8441
diff changeset
189 public static native <T> T anchor(@ConstantNodeParameter Stamp stamp);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 }