# HG changeset patch # User Christos Kotselidis # Date 1372074299 -7200 # Node ID a1b3863e3fc592f62abfa010f9f21a2ce62bfb02 # Parent ba607afddc8b5ef32bfa8be267536b676dc7498a Move barrier check inside addReadNodeBarriers method, better assertions diff -r ba607afddc8b -r a1b3863e3fc5 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java --- 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) {