changeset 21048:013a466838b9

Merge.
author Doug Simon <doug.simon@oracle.com>
date Mon, 20 Apr 2015 19:36:37 +0200
parents 61730e3a9dce (diff) 43cec8244540 (current diff)
children 50fe6a0c6f1d
files
diffstat 4 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Mon Apr 20 10:07:32 2015 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Mon Apr 20 19:36:37 2015 +0200
@@ -132,6 +132,13 @@
     public static final int INVALID_FRAMESTATE_BCI = -6;
 
     /**
+     * Determines if a given BCI matches one of the synthetic BCI contants defined in this class.
+     */
+    public static boolean isSyntheticBci(int bci) {
+        return bci < 0;
+    }
+
+    /**
      * Creates a new frame object.
      *
      * @param caller the caller frame (which may be {@code null})
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Mon Apr 20 10:07:32 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Mon Apr 20 19:36:37 2015 +0200
@@ -251,4 +251,25 @@
         return dst;
     }
 
+    /**
+     * Test case derived from assertion while compiling <a href=
+     * "https://code.google.com/r/baggiogamp-guava/source/browse/guava/src/com/google/common/collect/ArrayTable.java?r=d2e06112416223cb5437d43c12a989c0adc7345b#181"
+     * > com.google.common.collect.ArrayTable(ArrayTable other)</a>.
+     */
+    @Ignore
+    @Test
+    public void testCopyRows() {
+        mustIntrinsify = false;
+        Object[][] rows = {{"a1", "a2", "a3", "a4"}, {"b1", "b2", "b3", "b4"}, {"c1", "c2", "c3", "c4"}};
+        test("copyRows", rows, 4, new Integer(rows.length));
+        mustIntrinsify = true;
+    }
+
+    public static Object[][] copyRows(Object[][] rows, int rowSize, Integer rowCount) {
+        Object[][] copy = new Object[rows.length][rowSize];
+        for (int i = 0; i < rowCount.intValue(); i++) {
+            System.arraycopy(rows[i], 0, copy[i], 0, rows[i].length);
+        }
+        return copy;
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Mon Apr 20 10:07:32 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Mon Apr 20 19:36:37 2015 +0200
@@ -293,6 +293,9 @@
      * is that a stateAfter is being transformed into a stateDuring, so the stack depth may change.
      */
     private boolean checkStackDepth(int oldBci, int oldStackSize, boolean oldDuringCall, boolean oldRethrowException, int newBci, int newStackSize, boolean newDuringCall, boolean newRethrowException) {
+        if (BytecodeFrame.isSyntheticBci(oldBci)) {
+            return true;
+        }
         /*
          * It would be nice to have a complete check of the shape of the FrameState based on a
          * dataflow of the bytecodes but for now just check for obvious expression stack depth
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java	Mon Apr 20 10:07:32 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java	Mon Apr 20 19:36:37 2015 +0200
@@ -135,6 +135,8 @@
                         state = state.addSideEffect(stateSplit);
                     } else if (currentState.invalid) {
                         setStateAfter(node.graph(), stateSplit, INVALID_FRAMESTATE_BCI, false);
+                    } else if (stateSplit instanceof StartNode) {
+                        setStateAfter(node.graph(), stateSplit, BEFORE_BCI, false);
                     } else {
                         stateSplit.setStateAfter(null);
                         if (frameState.hasNoUsages()) {
@@ -219,13 +221,13 @@
          *
          * @param graph the graph context
          * @param node the node whose frame state is updated
-         * @param bci {@link BytecodeFrame#AFTER_BCI}, {@link BytecodeFrame#AFTER_EXCEPTION_BCI} or
+         * @param bci {@link BytecodeFrame#BEFORE_BCI}, {@link BytecodeFrame#AFTER_EXCEPTION_BCI} or
          *            {@link BytecodeFrame#INVALID_FRAMESTATE_BCI}
          * @param replaceOnly only perform the update if the node currently has a non-null frame
          *            state
          */
         private static void setStateAfter(StructuredGraph graph, StateSplit node, int bci, boolean replaceOnly) {
-            assert bci == AFTER_BCI || bci == AFTER_EXCEPTION_BCI || bci == INVALID_FRAMESTATE_BCI;
+            assert (bci == BEFORE_BCI && node instanceof StartNode) || bci == AFTER_BCI || bci == AFTER_EXCEPTION_BCI || bci == INVALID_FRAMESTATE_BCI;
             FrameState currentStateAfter = node.stateAfter();
             if (currentStateAfter != null || !replaceOnly) {
                 node.setStateAfter(graph.add(new FrameState(bci)));