changeset 5190:cb3245503a5e

emit GC write barrier for UnsafeStoreNode only if store kind is Object
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Apr 2012 23:08:27 +0200
parents 6fbf12b8e572
children 67f52d18d01f
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Tue Apr 03 21:31:32 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Tue Apr 03 23:08:27 2012 +0200
@@ -333,10 +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));
-            FieldWriteBarrier barrier = graph.add(new FieldWriteBarrier(store.object()));
+            if (store.storeKind() == CiKind.Object && !store.value().isNullConstant()) {
+                FieldWriteBarrier barrier = graph.add(new FieldWriteBarrier(store.object()));
+                graph.addBeforeFixed(write, barrier);
+            }
             write.setStateAfter(store.stateAfter());
             graph.replaceFixedWithFixed(store, write);
-            graph.addBeforeFixed(write, barrier);
         } else if (n instanceof ReadHubNode) {
             ReadHubNode objectClassNode = (ReadHubNode) n;
             LocationNode location = LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.hubOffset, graph);