changeset 11416:bcb4ce5bd27e

don't create multiple value proxies in PEAReadEliminationClosure
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 26 Aug 2013 15:48:11 +0200
parents c355f6b32fa6
children 98d96597a8e6
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java	Mon Aug 26 11:15:26 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java	Mon Aug 26 15:48:11 2013 +0200
@@ -77,6 +77,7 @@
     public boolean verify() {
         assert value != null;
         assert proxyPoint != null;
+        assert !(value instanceof ProxyNode) || ((ProxyNode) value).proxyPoint != proxyPoint;
         return super.verify();
     }
 
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java	Mon Aug 26 11:15:26 2013 +0200
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java	Mon Aug 26 15:48:11 2013 +0200
@@ -112,9 +112,12 @@
 
         for (Map.Entry<ReadCacheEntry, ValueNode> entry : exitState.getReadCache().entrySet()) {
             if (initialState.getReadCache().get(entry.getKey()) != entry.getValue()) {
-                ProxyNode proxy = new ProxyNode(exitState.getReadCache(entry.getKey().object, entry.getKey().identity), exitNode, PhiType.Value, null);
-                effects.addFloatingNode(proxy, "readCacheProxy");
-                entry.setValue(proxy);
+                ValueNode value = exitState.getReadCache(entry.getKey().object, entry.getKey().identity);
+                if (!(value instanceof ProxyNode) || ((ProxyNode) value).proxyPoint() != exitNode) {
+                    ProxyNode proxy = new ProxyNode(value, exitNode, PhiType.Value, null);
+                    effects.addFloatingNode(proxy, "readCacheProxy");
+                    entry.setValue(proxy);
+                }
             }
         }
     }