# HG changeset patch # User Doug Simon # Date 1429551397 -7200 # Node ID 013a466838b9716652a9759168cae71d3613d951 # Parent 61730e3a9dce7f0835cd9fe18644d9eaa507b61b# Parent 43cec82445407fcb8e7ebdc356d1caffde0dae4c Merge. diff -r 43cec8244540 -r 013a466838b9 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java --- 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}) diff -r 43cec8244540 -r 013a466838b9 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java --- 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 com.google.common.collect.ArrayTable(ArrayTable other). + */ + @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; + } } diff -r 43cec8244540 -r 013a466838b9 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java --- 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 diff -r 43cec8244540 -r 013a466838b9 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java --- 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)));