changeset 11231:cf9603cd8b13

Merge.
author Doug Simon <doug.simon@oracle.com>
date Tue, 06 Aug 2013 22:12:12 +0200
parents 5c153c59ba62 (current diff) 038a598da996 (diff)
children 22d3ee2fcb97 a7c7b0bd0557
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Aug 06 21:40:09 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Aug 06 22:12:12 2013 +0200
@@ -623,7 +623,12 @@
                 } else {
                     LoadHubNode arrayClass = graph.add(new LoadHubNode(array, wordKind));
                     LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.arrayClassElementOffset, graph);
-                    FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind())));
+                    /*
+                     * Anchor the read of the element klass to the cfg, because it is only valid
+                     * when arrayClass is an object class, which might not be the case in other
+                     * parts of the compiled method.
+                     */
+                    FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, BeginNode.prevBegin(storeIndexed), StampFactory.forKind(wordKind())));
                     CheckCastDynamicNode checkcast = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true));
                     graph.addBeforeFixed(storeIndexed, checkcast);
                     graph.addBeforeFixed(checkcast, arrayClass);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Tue Aug 06 21:40:09 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Tue Aug 06 22:12:12 2013 +0200
@@ -22,8 +22,11 @@
  */
 package com.oracle.graal.nodes.java;
 
+import java.util.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
@@ -67,7 +70,22 @@
         }
         LoadExceptionObjectNode loadException = graph().add(new LoadExceptionObjectNode(stamp()));
         loadException.setStateAfter(stateAfter());
+        List<GuardedNode> guardedNodes = new ArrayList<>();
+        for (Node usage : usages().snapshot()) {
+            if (usage instanceof GuardedNode) {
+                // can't replace the guard with LoadExceptionObjectNode as it is not a GuardingNode
+                // so temporarily change it to remove the GuardedNode from usages
+                GuardedNode guardedNode = (GuardedNode) usage;
+                guardedNode.setGuard(graph().add(new BeginNode()));
+                guardedNodes.add(guardedNode);
+            }
+        }
         replaceAtUsages(loadException);
+        for (GuardedNode guardedNode : guardedNodes) {
+            BeginNode dummyGuard = (BeginNode) guardedNode.getGuard();
+            guardedNode.setGuard(this);
+            graph().removeFixed(dummyGuard);
+        }
         graph().addAfterFixed(this, loadException);
         setStateAfter(null);
         setStamp(StampFactory.forVoid());