changeset 11710:8d8a7d7f0259

Remove permanent flag on ValueAnchorNode. Memory aware scheduling fixes the problem with synchronized method return values.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 19 Sep 2013 01:50:08 +0200
parents 8fa3a9f1dda4
children f12b418ebc74
files graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java
diffstat 5 files changed, 4 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Sep 19 01:20:46 2013 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Sep 19 01:50:08 2013 +0200
@@ -1630,11 +1630,6 @@
         ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind);
         assert frameState.stackSize() == 0;
 
-        if (Modifier.isSynchronized(method.getModifiers())) {
-            append(new ValueAnchorNode(true, x));
-            assert !frameState.rethrowException();
-        }
-
         synchronizedEpilogue(FrameState.AFTER_BCI);
         if (frameState.lockDepth() != 0) {
             throw new BailoutException("unbalanced monitors");
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Thu Sep 19 01:20:46 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Thu Sep 19 01:50:08 2013 +0200
@@ -37,17 +37,10 @@
     @Input private final NodeInputList<ValueNode> anchored;
 
     public ValueAnchorNode(ValueNode... values) {
-        this(false, values);
-    }
-
-    public ValueAnchorNode(boolean permanent, ValueNode... values) {
         super(StampFactory.dependency());
-        this.permanent = permanent;
         this.anchored = new NodeInputList<>(this, values);
     }
 
-    private boolean permanent;
-
     @Override
     public void generate(LIRGeneratorTool gen) {
         // Nothing to emit, since this node is used for structural purposes only.
@@ -67,19 +60,8 @@
         return anchored;
     }
 
-    public void setPermanent(boolean permanent) {
-        this.permanent = permanent;
-    }
-
-    public boolean isPermanent() {
-        return permanent;
-    }
-
     @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
@@ -103,9 +85,6 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        if (permanent) {
-            return;
-        }
         for (ValueNode node : anchored.nonNull().and(isNotA(AbstractBeginNode.class))) {
             State state = tool.getObjectState(node);
             if (state == null || state.getState() != EscapeState.Virtual) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Thu Sep 19 01:20:46 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Thu Sep 19 01:50:08 2013 +0200
@@ -1025,7 +1025,7 @@
 
     /**
      * Determines if inlining is possible at the given invoke node.
-     *
+     * 
      * @param invoke the invoke that should be inlined
      * @return an instance of InlineInfo, or null if no inlining is possible at the given invoke
      */
@@ -1287,7 +1287,7 @@
 
     /**
      * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph.
-     *
+     * 
      * @param invoke the invoke that will be replaced
      * @param inlineGraph the graph that the invoke will be replaced with
      * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings,
@@ -1407,12 +1407,6 @@
                             frameState.setOuterFrameState(outerFrameState);
                         }
                     }
-                } else if (node instanceof ValueAnchorNode) {
-                    /*
-                     * Synchronized inlinees have a valid point to deopt to after the monitor exit
-                     * at the end, so there's no need for the value anchor to be permanent anymore.
-                     */
-                    ((ValueAnchorNode) node).setPermanent(false);
                 }
                 if (callerLockDepth != 0 && node instanceof MonitorReference) {
                     MonitorReference monitor = (MonitorReference) node;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java	Thu Sep 19 01:20:46 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java	Thu Sep 19 01:50:08 2013 +0200
@@ -80,7 +80,7 @@
                         state.anchoredValues.add(anchored);
                     }
                 }
-                if (!anchor.isPermanent() && anchor.getAnchoredNodes().isEmpty() && anchor.usages().isEmpty()) {
+                if (anchor.getAnchoredNodes().isEmpty() && anchor.usages().isEmpty()) {
                     node.graph().removeFixed(anchor);
                 }
             }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Thu Sep 19 01:20:46 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Thu Sep 19 01:50:08 2013 +0200
@@ -58,7 +58,7 @@
     }
 
     public NewFrameNode(ValueNode descriptor, ValueNode caller, ValueNode arguments) {
-        this(StampFactory.declaredNonNull(FRAME_TYPE), descriptor, caller, arguments);
+        this(StampFactory.exactNonNull(FRAME_TYPE), descriptor, caller, arguments);
     }
 
     public ValueNode getDescriptor() {