# HG changeset patch # User Doug Simon # Date 1427194570 -3600 # Node ID fa9d90e73569591f9c366a0897bc60fdbcc149f5 # Parent 3cbb0846337c80ac5d4a5e9f41214d2c2f68d88c check whether a StateSplit node being added via GraphBuilderContext has a null stateAfter before setting one diff -r 3cbb0846337c -r fa9d90e73569 graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java --- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java Tue Mar 24 11:36:52 2015 +0100 +++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java Tue Mar 24 11:56:10 2015 +0100 @@ -85,49 +85,55 @@ void push(Kind kind, ValueNode value); /** - * Appends a node with a void kind to the graph. If the node is a {@link StateSplit}, then its - * {@linkplain StateSplit#stateAfter() frame state} is also set. + * Appends a node with a void kind to the graph. If the returned node is a {@link StateSplit}, + * with a null {@linkplain StateSplit#stateAfter() frame state}, the frame state is initialized. + * + * @param value the value to add to the graph and push to the stack. The {@code value.getKind()} + * kind is used when type checking this operation. + * @return a node equivalent to {@code value} in the graph */ default T add(T value) { assert value.getKind() == Kind.Void; T appended = append(value); if (appended instanceof StateSplit) { StateSplit stateSplit = (StateSplit) appended; - assert stateSplit.stateAfter() == null; - stateSplit.setStateAfter(createStateAfter()); + if (stateSplit.stateAfter() == null) { + stateSplit.setStateAfter(createStateAfter()); + } } return appended; } /** - * Adds a node with a non-void kind to the graph, pushes it to the stack. If the node is a - * {@link StateSplit}, then its {@linkplain StateSplit#stateAfter() frame state} is also set. + * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node + * is a {@link StateSplit}, with a null {@linkplain StateSplit#stateAfter() frame state}, the + * frame state is initialized. * - * @param value the value to push to the stack. The value must already have been - * {@linkplain #append(ValueNode) appended}. The {@code value.getKind()} kind is used - * when type checking this operation. - * @return the version of {@code value} in the graph which may be different than {@code value} + * @param value the value to add to the graph and push to the stack. The {@code value.getKind()} + * kind is used when type checking this operation. + * @return a node equivalent to {@code value} in the graph */ default T addPush(T value) { return addPush(value.getKind().getStackKind(), value); } /** - * Adds a node with a non-void kind to the graph, pushes it to the stack. If the node is a - * {@link StateSplit}, then its {@linkplain StateSplit#stateAfter() frame state} is also set. + * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node + * is a {@link StateSplit}, with a null {@linkplain StateSplit#stateAfter() frame state}, the + * frame state is initialized. * * @param kind the kind to use when type checking this operation - * @param value the value to push to the stack. The value must already have been - * {@linkplain #append(ValueNode) appended}. - * @return the version of {@code value} in the graph which may be different than {@code value} + * @param value the value to add to the graph and push to the stack + * @return a node equivalent to {@code value} in the graph */ default T addPush(Kind kind, T value) { T appended = append(value); push(kind, appended); if (appended instanceof StateSplit) { StateSplit stateSplit = (StateSplit) appended; - assert stateSplit.stateAfter() == null; - stateSplit.setStateAfter(createStateAfter()); + if (stateSplit.stateAfter() == null) { + stateSplit.setStateAfter(createStateAfter()); + } } return appended; } diff -r 3cbb0846337c -r fa9d90e73569 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Mar 24 11:36:52 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Mar 24 11:56:10 2015 +0100 @@ -2413,6 +2413,7 @@ } public void push(Kind kind, ValueNode value) { + assert value.isAlive(); assert kind == kind.getStackKind(); frameState.push(kind, value); }