# HG changeset patch # User Christos Kotselidis # Date 1372325997 -7200 # Node ID a75e7e25aedf0fa27106645ccc0cf3e7c3b9bc57 # Parent ca8efaf18f27d4f300453615e6bccea11775ef2b Small refactoring diff -r ca8efaf18f27 -r a75e7e25aedf 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 Thu Jun 27 11:37:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Thu Jun 27 11:39:57 2013 +0200 @@ -22,8 +22,9 @@ */ package com.oracle.graal.hotspot.phases; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; + import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.replacements.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.extended.*; @@ -55,7 +56,7 @@ private static void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { if (node.getWriteBarrierType() == WriteBarrierType.PRECISE) { - assert HotSpotReplacementsUtil.useG1GC(); + assert 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."; @@ -65,14 +66,14 @@ private static void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) { WriteBarrierType barrierType = node.getWriteBarrierType(); if (barrierType == WriteBarrierType.PRECISE) { - if (HotSpotReplacementsUtil.useG1GC()) { + if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), true))); } else { graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.location(), true))); } } else if (barrierType == WriteBarrierType.IMPRECISE) { - if (HotSpotReplacementsUtil.useG1GC()) { + if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), false))); } else { @@ -87,14 +88,14 @@ private static void addCASBarriers(CompareAndSwapNode node, StructuredGraph graph) { WriteBarrierType barrierType = node.getWriteBarrierType(); if (barrierType == WriteBarrierType.PRECISE) { - if (HotSpotReplacementsUtil.useG1GC()) { + if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.expected(), node.getLocation(), false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.newValue(), node.getLocation(), true))); } else { graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), true))); } } else if (barrierType == WriteBarrierType.IMPRECISE) { - if (HotSpotReplacementsUtil.useG1GC()) { + if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.expected(), node.getLocation(), false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.newValue(), node.getLocation(), false))); } else { @@ -106,7 +107,7 @@ } private static void addArrayRangeBarriers(ArrayRangeWriteNode node, StructuredGraph graph) { - if (HotSpotReplacementsUtil.useG1GC()) { + if (useG1GC()) { throw new GraalInternalError("G1 does not yet support barriers for ArrayCopy Intrinsics. Run with -G:-IntrinsifyArrayCopy"); } else { SerialArrayRangeWriteBarrier serialArrayRangeWriteBarrier = graph.add(new SerialArrayRangeWriteBarrier(node.getArray(), node.getIndex(), node.getLength()));