changeset 9183:34eba4e78a0a

Attach LocationNode to CompareAndSwapNode
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Thu, 18 Apr 2013 01:23:58 +0200
parents c433aad055b9
children 642e04f1ea93
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java
diffstat 3 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Wed Apr 17 22:59:36 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Apr 18 01:23:58 2013 +0200
@@ -580,6 +580,8 @@
         } else if (n instanceof CompareAndSwapNode) {
             // Separate out GC barrier semantics
             CompareAndSwapNode cas = (CompareAndSwapNode) n;
+            LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1);
+            cas.setLocation(location);
             cas.setWriteBarrierType(getCompareAndSwapBarrier(cas));
         } else if (n instanceof LoadIndexedNode) {
             LoadIndexedNode loadIndexed = (LoadIndexedNode) n;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Wed Apr 17 22:59:36 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Thu Apr 18 01:23:58 2013 +0200
@@ -61,11 +61,9 @@
     private static void addCASBarriers(CompareAndSwapNode node, StructuredGraph graph) {
         WriteBarrierType barrierType = node.getWriteBarrierType();
         if (barrierType == WriteBarrierType.PRECISE) {
-            LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, node.expected().kind(), node.displacement(), node.offset(), graph, 1);
-            graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), location, true)));
+            graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), true)));
         } else if (barrierType == WriteBarrierType.IMPRECISE) {
-            LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, node.expected().kind(), node.displacement(), node.offset(), graph, 1);
-            graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), location, false)));
+            graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), false)));
         } else {
             assert barrierType == WriteBarrierType.NONE;
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Wed Apr 17 22:59:36 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Thu Apr 18 01:23:58 2013 +0200
@@ -42,6 +42,7 @@
     @Input private ValueNode offset;
     @Input private ValueNode expected;
     @Input private ValueNode newValue;
+    @Input private LocationNode location;
     private final int displacement;
     private WriteBarrierType barrierType;
 
@@ -65,6 +66,15 @@
         return displacement;
     }
 
+    public LocationNode getLocation() {
+        return location;
+    }
+
+    public void setLocation(LocationNode location) {
+        updateUsages(this.location, location);
+        this.location = location;
+    }
+
     public WriteBarrierType getWriteBarrierType() {
         return barrierType;
     }