# HG changeset patch # User Christos Kotselidis # Date 1373203479 -7200 # Node ID 1d245cc635e35ff07b416ff5eeb440839e41cf36 # Parent e9241e9cfcd5f72d7c92cfcaed41fcf23946eda4 Augment Write Barrier Verification Test for G1 diff -r e9241e9cfcd5 -r 1d245cc635e3 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 Sun Jul 07 15:24:17 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Sun Jul 07 15:24:39 2013 +0200 @@ -32,6 +32,7 @@ import com.oracle.graal.compiler.test.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.internal.*; +import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; @@ -630,10 +631,15 @@ new SafepointInsertionPhase().apply(graph); new WriteBarrierAdditionPhase().apply(graph); + int barriers = 0; // First, the total number of expected barriers is checked. - final int barriers = graph.getNodes(SerialWriteBarrier.class).count(); - Assert.assertTrue(expectedBarriers == barriers); - + if (((HotSpotRuntime) runtime()).config.useG1GC) { + barriers = graph.getNodes(G1PreWriteBarrier.class).count() + graph.getNodes(G1PostWriteBarrier.class).count(); + Assert.assertTrue(expectedBarriers * 2 == barriers); + } else { + barriers = graph.getNodes(SerialWriteBarrier.class).count(); + Assert.assertTrue(expectedBarriers == barriers); + } // Iterate over all write nodes and remove barriers according to input indices. NodeIteratorClosure closure = new NodeIteratorClosure() { @@ -653,10 +659,10 @@ } } } - } else if (node instanceof SerialWriteBarrier) { + } else if (node instanceof SerialWriteBarrier || node instanceof G1PostWriteBarrier) { // Remove flagged write barriers. if (currentState) { - graph.removeFixed(((SerialWriteBarrier) node)); + graph.removeFixed(((FixedWithNextNode) node)); return false; } } @@ -692,7 +698,7 @@ try { ReentrantNodeIterator.apply(closure, graph.start(), false, null); Debug.setConfig(Debug.fixedConfig(false, false, false, false, config.dumpHandlers(), config.output())); - new WriteBarrierVerificationPhase().apply(graph); + new WriteBarrierVerificationPhase(((HotSpotRuntime) runtime()).config.useG1GC).apply(graph); } catch (AssertionError error) { /* * Catch assertion, test for expected one and re-throw in order to validate unit