diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java @ 7896:649379d3f88d

don't kill memory proxies during RemoveValueProxyPhase
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 27 Feb 2013 15:51:34 +0100
parents 5e3d1a68664e
children
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java	Wed Feb 27 14:35:16 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java	Wed Feb 27 15:51:34 2013 +0100
@@ -34,14 +34,14 @@
  * inside the loop (i.e. was not live on entry to the loop) and is (potentially) used after the
  * loop.
  */
-public class ValueProxyNode extends FloatingNode implements Node.IterableNodeType, ValueNumberable, Canonicalizable, Virtualizable {
+public class ValueProxyNode extends FloatingNode implements Node.IterableNodeType, ValueNumberable, Canonicalizable, Virtualizable, LIRLowerable {
 
     @Input(notDataflow = true) private BeginNode proxyPoint;
     @Input private ValueNode value;
     private final PhiType type;
 
     public ValueProxyNode(ValueNode value, BeginNode exit, PhiType type) {
-        super(value.stamp());
+        super(type == PhiType.Value ? value.stamp() : type.stamp);
         this.type = type;
         assert exit != null;
         this.proxyPoint = exit;
@@ -78,8 +78,13 @@
     }
 
     @Override
+    public void generate(LIRGeneratorTool generator) {
+        assert type == PhiType.Memory;
+    }
+
+    @Override
     public ValueNode canonical(CanonicalizerTool tool) {
-        if (value.isConstant()) {
+        if (type == PhiType.Value && value.isConstant()) {
             return value;
         }
         return this;
@@ -87,9 +92,11 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        State state = tool.getObjectState(value);
-        if (state != null && state.getState() == EscapeState.Virtual) {
-            tool.replaceWithVirtual(state.getVirtualObject());
+        if (type == PhiType.Value) {
+            State state = tool.getObjectState(value);
+            if (state != null && state.getState() == EscapeState.Virtual) {
+                tool.replaceWithVirtual(state.getVirtualObject());
+            }
         }
     }
 }