# HG changeset patch # User Christos Kotselidis # Date 1373977002 -7200 # Node ID f587a69c63aedd4e235026790584647a1b715e8d # Parent 0a8f1eefce5139759e1ef054b9a7d60421522fdb Minor refactoring diff -r 0a8f1eefce51 -r f587a69c63ae graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Tue Jul 16 14:10:44 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Tue Jul 16 14:16:42 2013 +0200 @@ -712,7 +712,7 @@ try { ReentrantNodeIterator.apply(closure, graph.start(), false, null); Debug.setConfig(Debug.fixedConfig(false, false, false, false, config.dumpHandlers(), config.output())); - new WriteBarrierVerificationPhase(((HotSpotRuntime) runtime()).config.useG1GC).apply(graph); + new WriteBarrierVerificationPhase().apply(graph); } catch (AssertionError error) { /* * Catch assertion, test for expected one and re-throw in order to validate unit diff -r 0a8f1eefce51 -r f587a69c63ae graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Jul 16 14:10:44 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Jul 16 14:16:42 2013 +0200 @@ -1241,7 +1241,7 @@ ret.getMidTier().appendPhase(new WriteBarrierAdditionPhase()); if (VerifyPhases.getValue()) { - ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase(config.useG1GC)); + ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase()); } return ret; diff -r 0a8f1eefce51 -r f587a69c63ae graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Tue Jul 16 14:10:44 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Tue Jul 16 14:16:42 2013 +0200 @@ -23,9 +23,12 @@ package com.oracle.graal.hotspot.phases; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; + import java.util.*; 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.*; @@ -41,18 +44,12 @@ */ public class WriteBarrierVerificationPhase extends Phase { - private final boolean useG1GC; - - public WriteBarrierVerificationPhase(boolean useG1GC) { - this.useG1GC = useG1GC; - } - @Override protected void run(StructuredGraph graph) { processWrites(graph); } - private void processWrites(StructuredGraph graph) { + private static void processWrites(StructuredGraph graph) { for (Node node : graph.getNodes()) { if (isObjectWrite(node) || isObjectArrayRangeWrite(node)) { validateWrite(node); @@ -60,7 +57,7 @@ } } - private void validateWrite(Node write) { + private static void validateWrite(Node write) { /* * The currently validated write is checked in order to discover if it has an appropriate * attached write barrier. @@ -74,7 +71,7 @@ while (iterator.hasNext()) { Node currentNode = iterator.next(); assert !isSafepoint(currentNode) : "Write barrier must be present"; - if (useG1GC) { + if (useG1GC()) { if (!(currentNode instanceof G1PostWriteBarrier) || ((currentNode instanceof G1PostWriteBarrier) && !validateBarrier(write, (WriteBarrier) currentNode))) { expandFrontier(frontier, currentNode); } @@ -87,10 +84,10 @@ } } - private boolean hasAttachedBarrier(FixedWithNextNode node) { + private static boolean hasAttachedBarrier(FixedWithNextNode node) { final Node next = node.next(); final Node previous = node.predecessor(); - if (useG1GC) { + if (HotSpotReplacementsUtil.useG1GC()) { if (isObjectWrite(node)) { return next instanceof G1PostWriteBarrier && previous instanceof G1PreWriteBarrier && validateBarrier(node, (G1PostWriteBarrier) next) && validateBarrier(node, (G1PreWriteBarrier) previous);