Mercurial > hg > truffle
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java @ 8345:4e7a668054ea
added field to ValueAnchorNode to prevent canonicalization and virtualization; used new field to fix issue with return value materialization floating below the final monitorexit of a synchronized method
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 18 Mar 2013 18:06:33 +0100 |
parents | 7d6cee014fb8 |
children | ae815a4c112a |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Mar 18 18:05:33 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Mar 18 18:06:33 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -38,9 +37,16 @@ public final class ValueAnchorNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Virtualizable { public ValueAnchorNode(ValueNode... values) { + this(false, values); + } + + public ValueAnchorNode(boolean permanent, ValueNode... values) { super(StampFactory.dependency(), values); + this.permanent = permanent; } + private final boolean permanent; + @Override public void generate(LIRGeneratorTool gen) { // Nothing to emit, since this node is used for structural purposes only. @@ -54,6 +60,9 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { + if (permanent) { + return this; + } if (this.predecessor() instanceof ValueAnchorNode) { ValueAnchorNode previousAnchor = (ValueAnchorNode) this.predecessor(); if (previousAnchor.usages().isEmpty()) { // avoid creating cycles @@ -88,12 +97,8 @@ @Override public void virtualize(VirtualizerTool tool) { - // don't process this node if it is anchoring the return value - if (next() instanceof MonitorExitNode) { - MonitorExitNode monitorExit = (MonitorExitNode) next(); - if (monitorExit.stateAfter() != null && monitorExit.stateAfter().bci == FrameState.AFTER_BCI && monitorExit.next() instanceof ReturnNode) { - return; - } + if (permanent) { + return; } for (ValueNode node : dependencies().nonNull().and(isNotA(BeginNode.class))) { State state = tool.getObjectState(node);