changeset 10775:0a8f1eefce51

Augment WriteBarrierVerificationTest with arrayCopy test case
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Tue, 16 Jul 2013 14:10:44 +0200
parents 0f8d0c86611d
children f587a69c63ae
files graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java	Tue Jul 16 14:10:10 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java	Tue Jul 16 14:10:44 2013 +0200
@@ -617,6 +617,15 @@
         test("test12Snippet", 8, new int[]{8});
     }
 
+    public static void test13Snippet(Object[] a, Object[] b) {
+        System.arraycopy(a, 0, b, 0, a.length);
+    }
+
+    @Test
+    public void test61() {
+        test("test13Snippet", 1, new int[]{});
+    }
+
     private void test(final String snippet, final int expectedBarriers, final int... removedBarrierIndices) {
 
         AssertionError expectedError = Debug.scope("WriteBarrierVerificationTest", new DebugDumpScope(snippet), new Callable<AssertionError>() {
@@ -624,20 +633,25 @@
             public AssertionError call() {
                 final StructuredGraph graph = parse(snippet);
                 HighTierContext highTierContext = new HighTierContext(runtime(), new Assumptions(false), replacements);
+                new InliningPhase(runtime(), null, replacements, new Assumptions(false), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph);
+
                 MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL);
 
                 new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, highTierContext);
                 new GuardLoweringPhase().apply(graph, midTierContext);
                 new SafepointInsertionPhase().apply(graph);
+                new LoweringPhase(LoweringType.AFTER_GUARDS).apply(graph, highTierContext);
+
                 new WriteBarrierAdditionPhase().apply(graph);
 
                 int barriers = 0;
                 // First, the total number of expected barriers is checked.
                 if (((HotSpotRuntime) runtime()).config.useG1GC) {
-                    barriers = graph.getNodes(G1PreWriteBarrier.class).count() + graph.getNodes(G1PostWriteBarrier.class).count();
+                    barriers = graph.getNodes(G1PreWriteBarrier.class).count() + graph.getNodes(G1PostWriteBarrier.class).count() + graph.getNodes(G1ArrayRangePreWriteBarrier.class).count() +
+                                    graph.getNodes(G1ArrayRangePostWriteBarrier.class).count();
                     Assert.assertTrue(expectedBarriers * 2 == barriers);
                 } else {
-                    barriers = graph.getNodes(SerialWriteBarrier.class).count();
+                    barriers = graph.getNodes(SerialWriteBarrier.class).count() + graph.getNodes(SerialArrayRangeWriteBarrier.class).count();
                     Assert.assertTrue(expectedBarriers == barriers);
                 }
                 // Iterate over all write nodes and remove barriers according to input indices.