changeset 10516:a1b3863e3fc5

Move barrier check inside addReadNodeBarriers method, better assertions
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Mon, 24 Jun 2013 13:44:59 +0200
parents ba607afddc8b
children c2c9afee00b5
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Mon Jun 24 12:06:32 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Mon Jun 24 13:44:59 2013 +0200
@@ -38,9 +38,7 @@
     @Override
     protected void run(StructuredGraph graph) {
         for (ReadNode node : graph.getNodes(ReadNode.class)) {
-            if (node.getWriteBarrierType() == WriteBarrierType.PRECISE) {
-                addReadNodeBarriers(node, graph);
-            }
+            addReadNodeBarriers(node, graph);
         }
         for (WriteNode node : graph.getNodes(WriteNode.class)) {
             addWriteNodeBarriers(node, graph);
@@ -56,8 +54,12 @@
     }
 
     private static void addReadNodeBarriers(ReadNode node, StructuredGraph graph) {
-        assert HotSpotReplacementsUtil.useG1GC();
-        graph.addAfterFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node, node.location(), false)));
+        if (node.getWriteBarrierType() == WriteBarrierType.PRECISE) {
+            assert HotSpotReplacementsUtil.useG1GC();
+            graph.addAfterFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node, node.location(), false)));
+        } else {
+            assert node.getWriteBarrierType() == WriteBarrierType.NONE : "Non precise write barrier has been attached to read node.";
+        }
     }
 
     private static void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) {