changeset 16459:a039ae7e0e50

remove MemoryProxyNode (memory graph is built after proxies are removed)
author Lukas Stadler <lukas.stadler@oracle.com>
date Thu, 10 Jul 2014 16:46:19 +0200
parents 162c6fba1168
children 1da834bdfda2
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryProxyNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java
diffstat 5 files changed, 4 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java	Thu Jul 10 16:45:18 2014 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java	Thu Jul 10 16:46:19 2014 +0200
@@ -464,28 +464,7 @@
         assertReadAndWriteInSameBlock(schedule, false);
     }
 
-    /*
-     * read of field a should be in first block, read of field b in loop begin block
-     */
-    public static void testProxy1Snippet() {
-        while (container.a < container.b) {
-            container.b--;
-        }
-        container.b++;
-    }
-
-    @Test
-    public void testProxy1() {
-        SchedulePhase schedule = getFinalSchedule("testProxy1Snippet", TestMode.WITHOUT_FRAMESTATES);
-        assertReadWithinStartBlock(schedule, true); // read of container.a should be in start block
-        /*
-         * read of container.b for increment operation should be in return block. TODO: not sure
-         * though, could be replaced by read of container.b of the loop header...
-         */
-        assertReadWithinAllReturnBlocks(schedule, true);
-    }
-
-    public static void testProxy2Snippet() {
+    public static void testProxySnippet() {
         while (container.a < container.b) {
             List<Container> list = new ArrayList<>(containerList);
             while (container.c < list.size()) {
@@ -501,8 +480,8 @@
     }
 
     @Test
-    public void testProxy2() {
-        SchedulePhase schedule = getFinalSchedule("testProxy2Snippet", TestMode.WITHOUT_FRAMESTATES);
+    public void testProxy() {
+        SchedulePhase schedule = getFinalSchedule("testProxySnippet", TestMode.WITHOUT_FRAMESTATES);
         assertReadWithinStartBlock(schedule, false);
         assertReadWithinAllReturnBlocks(schedule, false);
     }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Thu Jul 10 16:45:18 2014 +0200
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Thu Jul 10 16:46:19 2014 +0200
@@ -332,7 +332,7 @@
                  * VirtualState nodes contained in the old exit's state may be shared by other
                  * dominated VirtualStates. Those dominated virtual states need to see the
                  * proxy->phi update that are applied below.
-                 * 
+                 *
                  * We now update the original fragment's nodes accordingly:
                  */
                 originalExitState.applyToVirtual(node -> original.nodes.clearAndGrow(node));
@@ -357,8 +357,6 @@
                         phi = graph.addWithoutUnique(new ValuePhiNode(vpn.stamp(), merge));
                     } else if (vpn instanceof GuardProxyNode) {
                         phi = graph.addWithoutUnique(new GuardPhiNode(merge));
-                    } else if (vpn instanceof MemoryProxyNode) {
-                        phi = graph.addWithoutUnique(new MemoryPhiNode(merge, ((MemoryProxyNode) vpn).getLocationIdentity()));
                     } else {
                         throw GraalInternalError.shouldNotReachHere();
                     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryProxyNode.java	Thu Jul 10 16:45:18 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.nodes;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.spi.*;
-
-@NodeInfo(allowedUsageTypes = {InputType.Memory})
-public class MemoryProxyNode extends ProxyNode implements MemoryProxy, LIRLowerable {
-
-    @Input(InputType.Memory) private MemoryNode value;
-    private final LocationIdentity identity;
-
-    public MemoryProxyNode(MemoryNode value, BeginNode exit, LocationIdentity identity) {
-        super(StampFactory.forVoid(), exit);
-        this.value = value;
-        this.identity = identity;
-    }
-
-    @Override
-    public ValueNode value() {
-        return value.asNode();
-    }
-
-    public LocationIdentity getLocationIdentity() {
-        return identity;
-    }
-
-    @Override
-    public void generate(NodeLIRBuilderTool generator) {
-    }
-
-    @Override
-    public boolean verify() {
-        assert value() instanceof MemoryNode : this + " " + value();
-        return super.verify();
-    }
-
-    public MemoryNode getOriginalMemoryNode() {
-        return (MemoryNode) value();
-    }
-
-    public Node getOriginalNode() {
-        return value.asNode();
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java	Thu Jul 10 16:45:18 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java	Thu Jul 10 16:46:19 2014 +0200
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.ValueNumberable;
@@ -57,10 +56,6 @@
         return super.verify();
     }
 
-    public static MemoryProxyNode forMemory(MemoryNode value, BeginNode exit, LocationIdentity location, StructuredGraph graph) {
-        return graph.unique(new MemoryProxyNode(value, exit, location));
-    }
-
     public static ValueProxyNode forValue(ValueNode value, BeginNode exit, StructuredGraph graph) {
         return graph.unique(new ValueProxyNode(value, exit));
     }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Thu Jul 10 16:45:18 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Thu Jul 10 16:46:19 2014 +0200
@@ -358,16 +358,6 @@
                     phi.initializeValueAt(endIndex, ValueNodeUtil.asNode(entry.getValue().getLastLocationAccess(key)));
                 }
             }
-            for (Map.Entry<LoopExitNode, MemoryMapImpl> entry : loopInfo.exitStates.entrySet()) {
-                LoopExitNode exit = entry.getKey();
-                MemoryMapImpl state = entry.getValue();
-                for (LocationIdentity location : modifiedLocations) {
-                    MemoryNode lastAccessAtExit = state.lastMemorySnapshot.get(location);
-                    if (lastAccessAtExit != null) {
-                        state.lastMemorySnapshot.put(location, MemoryProxyNode.forMemory(lastAccessAtExit, exit, location, loop.graph()));
-                    }
-                }
-            }
             return loopInfo.exitStates;
         }
     }