Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java @ 7897:a58851061377
rename ValueProxyNode to ProxyNode
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 27 Feb 2013 15:59:16 +0100 |
parents | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java@649379d3f88d |
children | 0f6dd67470d9 |
rev | line source |
---|---|
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.nodes; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
25 import com.oracle.graal.graph.*; |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
26 import com.oracle.graal.graph.Node.ValueNumberable; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
27 import com.oracle.graal.nodes.PhiNode.PhiType; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
28 import com.oracle.graal.nodes.calc.*; |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
29 import com.oracle.graal.nodes.spi.*; |
5659
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
30 import com.oracle.graal.nodes.type.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
31 |
5377
9a5608ce6743
added javadoc to ValueProxyNode
Doug Simon <doug.simon@oracle.com>
parents:
5299
diff
changeset
|
32 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
33 * A value proxy that is inserted in the frame state of a loop exit for any value that is created |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
34 * inside the loop (i.e. was not live on entry to the loop) and is (potentially) used after the |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
35 * loop. |
5377
9a5608ce6743
added javadoc to ValueProxyNode
Doug Simon <doug.simon@oracle.com>
parents:
5299
diff
changeset
|
36 */ |
7897
a58851061377
rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7896
diff
changeset
|
37 @NodeInfo(nameTemplate = "{p#type/s}Proxy") |
a58851061377
rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7896
diff
changeset
|
38 public class ProxyNode extends FloatingNode implements Node.IterableNodeType, ValueNumberable, Canonicalizable, Virtualizable, LIRLowerable { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
39 |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
40 @Input(notDataflow = true) private BeginNode proxyPoint; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
41 @Input private ValueNode value; |
5299
0ebd9cfdc11f
removed @Data annotation
Lukas Stadler <lukas.stadler@jku.at>
parents:
5210
diff
changeset
|
42 private final PhiType type; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
43 |
7897
a58851061377
rename ValueProxyNode to ProxyNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7896
diff
changeset
|
44 public ProxyNode(ValueNode value, BeginNode exit, PhiType type) { |
7896
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
45 super(type == PhiType.Value ? value.stamp() : type.stamp); |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
46 this.type = type; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
47 assert exit != null; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
48 this.proxyPoint = exit; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
49 this.value = value; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
50 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
51 |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
52 public ValueNode value() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
53 return value; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
54 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
55 |
5631
f2d228de28d7
Make the value proxy node use the stamp of the proxied value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5377
diff
changeset
|
56 @Override |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
57 public boolean inferStamp() { |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
58 return updateStamp(value.stamp()); |
5631
f2d228de28d7
Make the value proxy node use the stamp of the proxied value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5377
diff
changeset
|
59 } |
f2d228de28d7
Make the value proxy node use the stamp of the proxied value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5377
diff
changeset
|
60 |
5659
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
61 @Override |
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
62 public Stamp stamp() { |
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
63 return value().stamp(); |
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
64 } |
73124ee1ee37
fix to ValueProxyNode for graal.boot
Lukas Stadler <lukas.stadler@jku.at>
parents:
5657
diff
changeset
|
65 |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
66 public BeginNode proxyPoint() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
67 return proxyPoint; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
68 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
69 |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
70 public PhiType type() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
71 return type; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
72 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
73 |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
74 @Override |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
75 public boolean verify() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
76 assert value != null; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
77 assert proxyPoint != null; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
78 return super.verify(); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
79 } |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
80 |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
81 @Override |
7896
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
82 public void generate(LIRGeneratorTool generator) { |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
83 assert type == PhiType.Memory; |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
84 } |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
85 |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
86 @Override |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
87 public ValueNode canonical(CanonicalizerTool tool) { |
7896
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
88 if (type == PhiType.Value && value.isConstant()) { |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
89 return value; |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
90 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
91 return this; |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
92 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
93 |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
94 @Override |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
95 public void virtualize(VirtualizerTool tool) { |
7896
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
96 if (type == PhiType.Value) { |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
97 State state = tool.getObjectState(value); |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
98 if (state != null && state.getState() == EscapeState.Virtual) { |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
99 tool.replaceWithVirtual(state.getVirtualObject()); |
649379d3f88d
don't kill memory proxies during RemoveValueProxyPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
100 } |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
101 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
102 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
103 } |