changeset 21777:76c162c69c2f

Drop stamp information of OSR proxies in graph builder.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 08 Jun 2015 12:09:37 +0200
parents 0c60e14e7796
children 037d14459ef9
files graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryProxyNode.java
diffstat 3 files changed, 62 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Mon Jun 08 11:47:32 2015 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Mon Jun 08 12:09:37 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -2294,7 +2294,7 @@
                     throw new BailoutException("OSR into a JSR scope is not supported");
                 }
                 EntryMarkerNode x = append(new EntryMarkerNode());
-                frameState.insertProxies(value -> ProxyNode.forValue(value, x, graph));
+                frameState.insertProxies(value -> graph.unique(new EntryProxyNode(value, x)));
                 x.setStateAfter(createFrameState(bci, x));
             }
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Mon Jun 08 11:47:32 2015 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Mon Jun 08 12:09:37 2015 +0200
@@ -425,16 +425,16 @@
 
     public void insertLoopPhis(LocalLiveness liveness, int loopId, LoopBeginNode loopBegin, boolean forcePhis) {
         for (int i = 0; i < localsSize(); i++) {
-            boolean changedInLoop = liveness.localIsChangedInLoop(loopId, i);
-            if (changedInLoop || forcePhis) {
-                locals[i] = createLoopPhi(loopBegin, locals[i], !changedInLoop);
+            boolean needPhi = forcePhis || liveness.localIsChangedInLoop(loopId, i);
+            if (needPhi) {
+                locals[i] = createLoopPhi(loopBegin, locals[i]);
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            stack[i] = createLoopPhi(loopBegin, stack[i], false);
+            stack[i] = createLoopPhi(loopBegin, stack[i]);
         }
         for (int i = 0; i < lockedObjects.length; i++) {
-            lockedObjects[i] = createLoopPhi(loopBegin, lockedObjects[i], false);
+            lockedObjects[i] = createLoopPhi(loopBegin, lockedObjects[i]);
         }
     }
 
@@ -486,13 +486,13 @@
         }
     }
 
-    private ValueNode createLoopPhi(AbstractMergeNode block, ValueNode value, boolean stampFromValue) {
+    private ValueNode createLoopPhi(AbstractMergeNode block, ValueNode value) {
         if (value == null || value == TWO_SLOT_MARKER) {
             return value;
         }
         assert !block.isPhiAtMerge(value) : "phi function for this block already created";
 
-        ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(stampFromValue ? value.stamp() : value.stamp().unrestricted(), block));
+        ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(value.stamp().unrestricted(), block));
         phi.addInput(value);
         return phi;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryProxyNode.java	Mon Jun 08 12:09:37 2015 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 2015, 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.graph.*;
+import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.spi.*;
+
+/**
+ * Proxy node that is used in OSR. This node drops the stamp information from the value, since the
+ * types we see during OSR may be too precise (if a branch was not parsed for example).
+ */
+@NodeInfo(nameTemplate = "EntryProxy({i#value})")
+public final class EntryProxyNode extends ProxyNode implements ValueProxy {
+
+    public static final NodeClass<EntryProxyNode> TYPE = NodeClass.create(EntryProxyNode.class);
+    @Input ValueNode value;
+
+    public EntryProxyNode(ValueNode value, AbstractBeginNode proxyPoint) {
+        super(TYPE, value.stamp().unrestricted(), proxyPoint);
+        this.value = value;
+    }
+
+    @Override
+    public ValueNode value() {
+        return value;
+    }
+
+    @Override
+    public ValueNode getOriginalNode() {
+        return value();
+    }
+}