changeset 5192:20993edddd73

write barrier for UnsafeStoreNode must be inserted after associated write node has replaced original store node in the graph
author Doug Simon <doug.simon@oracle.com>
date Wed, 04 Apr 2012 09:19:44 +0200
parents 67f52d18d01f
children 02da376dd213 8125c1f6472b
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Tue Apr 03 23:10:04 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Wed Apr 04 09:19:44 2012 +0200
@@ -333,12 +333,12 @@
             IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, store.storeKind(), store.displacement(), store.offset(), graph);
             location.setIndexScalingEnabled(false);
             WriteNode write = graph.add(new WriteNode(store.object(), store.value(), location));
-            if (store.storeKind() == CiKind.Object && !store.value().isNullConstant()) {
-                FieldWriteBarrier barrier = graph.add(new FieldWriteBarrier(store.object()));
+            write.setStateAfter(store.stateAfter());
+            graph.replaceFixedWithFixed(store, write);
+            if (write.value().kind() == CiKind.Object && !write.value().isNullConstant()) {
+                FieldWriteBarrier barrier = graph.add(new FieldWriteBarrier(write.object()));
                 graph.addBeforeFixed(write, barrier);
             }
-            write.setStateAfter(store.stateAfter());
-            graph.replaceFixedWithFixed(store, write);
         } else if (n instanceof ReadHubNode) {
             ReadHubNode objectClassNode = (ReadHubNode) n;
             LocationNode location = LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.hubOffset, graph);