Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java @ 19403:7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 16 Feb 2015 15:43:03 +0100 |
parents | 480bd3b1adcd |
children | 61d3cb8e1280 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.extended; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15145
diff
changeset
|
25 import com.oracle.graal.compiler.common.type.*; |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
26 import com.oracle.graal.graph.*; |
11881
da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11880
diff
changeset
|
27 import com.oracle.graal.graph.spi.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
28 import com.oracle.graal.nodeinfo.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.nodes.*; |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
30 import com.oracle.graal.nodes.calc.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.spi.*; |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
32 import com.oracle.graal.nodes.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 * The ValueAnchor instruction keeps non-CFG (floating) nodes above a certain point in the graph. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 */ |
15016
62e9e9c6ac38
fix floating unsafe load regression
Andreas Woess <andreas.woess@jku.at>
parents:
15006
diff
changeset
|
37 @NodeInfo(allowedUsageTypes = {InputType.Anchor, InputType.Guard}) |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
38 public final class ValueAnchorNode extends FixedWithNextNode implements LIRLowerable, Simplifiable, Virtualizable, AnchoringNode, GuardingNode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
40 public static final NodeClass TYPE = NodeClass.get(ValueAnchorNode.class); |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
41 @OptionalInput(InputType.Guard) ValueNode anchored; |
9644
a230bfbd9497
Use specialized node inputs for loopbegin's overflow check and for value anchor's anchored values
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9436
diff
changeset
|
42 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
17450
diff
changeset
|
43 public ValueAnchorNode(ValueNode value) { |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
44 super(TYPE, StampFactory.forVoid()); |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
45 this.anchored = value; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 @Override |
14950
d5a1206e1923
NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
49 public void generate(NodeLIRBuilderTool gen) { |
5079
f8fe72ce4adc
fix typos and remove unused parameters
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
50 // Nothing to emit, since this node is used for structural purposes only. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
53 public ValueNode getAnchoredNode() { |
10807
d3a677910eea
new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
10804
diff
changeset
|
54 return anchored; |
d3a677910eea
new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
10804
diff
changeset
|
55 } |
d3a677910eea
new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
10804
diff
changeset
|
56 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 @Override |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
58 public void simplify(SimplifierTool tool) { |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
59 while (next() instanceof ValueAnchorNode) { |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
60 ValueAnchorNode nextAnchor = (ValueAnchorNode) next(); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
61 if (nextAnchor.anchored == anchored || nextAnchor.anchored == null) { |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
62 // two anchors for the same anchored -> coalesce |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
63 // nothing anchored on the next anchor -> coalesce |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
64 nextAnchor.replaceAtUsages(this); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
65 GraphUtil.removeFixedWithUnusedInputs(nextAnchor); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
66 } else { |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
67 break; |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
68 } |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
69 } |
18937
ff232ff8d028
Add utility Node#hasNoUsages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
70 if (hasNoUsages() && next() instanceof FixedAccessNode) { |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
71 FixedAccessNode currentNext = (FixedAccessNode) next(); |
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
72 if (currentNext.getGuard() == anchored) { |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
73 GraphUtil.removeFixedWithUnusedInputs(this); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
74 return; |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
75 } else if (currentNext.getGuard() == null && anchored instanceof GuardNode && ((GuardNode) anchored).condition() instanceof IsNullNode) { |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
76 // coalesce null check guards into subsequent read/write |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
77 currentNext.setGuard((GuardingNode) anchored); |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
78 tool.addToWorkList(next()); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
79 return; |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
80 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 } |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
82 |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
83 if (anchored != null && (anchored.isConstant() || anchored instanceof FixedNode)) { |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
84 // anchoring fixed nodes and constants is useless |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
85 removeAnchoredNode(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 } |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
87 |
18937
ff232ff8d028
Add utility Node#hasNoUsages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
88 if (anchored == null && hasNoUsages()) { |
14714
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
89 // anchor is not necessary any more => remove. |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
90 GraphUtil.removeFixedWithUnusedInputs(this); |
b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
11915
diff
changeset
|
91 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 } |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
93 |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
94 @Override |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
95 public void virtualize(VirtualizerTool tool) { |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
96 if (anchored != null && !(anchored instanceof AbstractBeginNode)) { |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
97 State state = tool.getObjectState(anchored); |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
6710
diff
changeset
|
98 if (state == null || state.getState() != EscapeState.Virtual) { |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
99 return; |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
100 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
101 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
102 tool.delete(); |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6329
diff
changeset
|
103 } |
11711
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
104 |
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
105 public void removeAnchoredNode() { |
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
106 this.updateUsages(anchored, null); |
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
107 this.anchored = null; |
f12b418ebc74
Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11710
diff
changeset
|
108 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 } |