# HG changeset patch # User Christian Wimmer # Date 1411525321 25200 # Node ID 9ff6aee72c8b09b56d425bbf779de0aaefb2b3a7 # Parent a4b8c73ebb7db23e42a86873c38edb5fa7a91f09 Change class hierarchy of ValueProxy that should only be transparent during graph building diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Tue Sep 23 19:20:40 2014 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Tue Sep 23 19:22:01 2014 -0700 @@ -28,7 +28,7 @@ import com.oracle.graal.nodes.spi.*; @NodeInfo -public class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueAndStampProxy { +public class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueProxy { @Input ValueNode value; diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LimitedValueProxy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LimitedValueProxy.java Tue Sep 23 19:22:01 2014 -0700 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013, 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.spi; + +import com.oracle.graal.nodes.*; + +/** + * This interface is like the derived {@link ValueProxy}. The difference is that only the graph + * builder should see through the proxy for doing some checks. Optimizations should not see through + * this proxy and therefore should only test for {@link ValueProxy}. + */ +public interface LimitedValueProxy extends Proxy { + + ValueNode getOriginalNode(); + +} diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ValueAndStampProxy.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ValueAndStampProxy.java Tue Sep 23 19:20:40 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2014, 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.spi; - -/** - * This interface marks nodes whose result is the same as one of their inputs, and whose stamp is - * the same as one of their inputs. - * - * For some algorithms it is necessary or advantageous to see through these proxies. - */ -public interface ValueAndStampProxy extends ValueProxy { -} diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ValueProxy.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ValueProxy.java Tue Sep 23 19:20:40 2014 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ValueProxy.java Tue Sep 23 19:22:01 2014 -0700 @@ -22,16 +22,12 @@ */ package com.oracle.graal.nodes.spi; -import com.oracle.graal.nodes.*; - /** * This interface marks nodes whose result is the same as one of their inputs. Such nodes are used * to add type information, to introduce scheduling restrictions, etc. * * For some algorithms it is necessary or advantageous to see through these proxies. */ -public interface ValueProxy extends Proxy { - - ValueNode getOriginalNode(); +public interface ValueProxy extends LimitedValueProxy { } diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Tue Sep 23 19:20:40 2014 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Tue Sep 23 19:22:01 2014 -0700 @@ -335,8 +335,8 @@ public static ValueNode originalValue(ValueNode proxy) { ValueNode v = proxy; do { - if (v instanceof ValueProxy) { - v = ((ValueProxy) v).getOriginalNode(); + if (v instanceof LimitedValueProxy) { + v = ((LimitedValueProxy) v).getOriginalNode(); } else if (v instanceof PhiNode) { v = ((PhiNode) v).singleValue(); if (v == PhiNode.MULTIPLE_VALUES) { @@ -372,8 +372,8 @@ NodeWorkList worklist = proxy.graph().createNodeWorkList(); worklist.add(proxy); for (Node node : worklist) { - if (node instanceof ValueProxy) { - ValueNode originalValue = ((ValueProxy) node).getOriginalNode(); + if (node instanceof LimitedValueProxy) { + ValueNode originalValue = ((LimitedValueProxy) node).getOriginalNode(); if (!process(originalValue, worklist)) { return; } diff -r a4b8c73ebb7d -r 9ff6aee72c8b graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/InferStamps.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/InferStamps.java Tue Sep 23 19:20:40 2014 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/InferStamps.java Tue Sep 23 19:22:01 2014 -0700 @@ -25,7 +25,6 @@ import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; public class InferStamps { @@ -47,7 +46,7 @@ * when the phi function performs the "meet" operator on its input stamps. */ for (Node n : graph.getNodes()) { - if (n instanceof ValuePhiNode || n instanceof ValueAndStampProxy) { + if (n instanceof ValuePhiNode) { ValueNode node = (ValueNode) n; if (node.stamp() instanceof ObjectStamp) { assert node.stamp().isLegal() : "We assume all Phi and Proxy stamps are legal before the analysis"; @@ -84,7 +83,7 @@ private static boolean checkNoIllegalStamp(StructuredGraph graph) { for (Node n : graph.getNodes()) { - if (n instanceof ValuePhiNode || n instanceof ValueAndStampProxy) { + if (n instanceof ValuePhiNode) { ValueNode node = (ValueNode) n; assert !(node.stamp() instanceof IllegalStamp) : "Stamp is illegal after analysis. This is not necessarily an error, but a condition that we want to investigate (and then maybe relax or remove the assertion)."; }