changeset 5053:c53115427ff9

added assertion
author Christian Haeubl <christian.haeubl@oracle.com>
date Wed, 07 Mar 2012 14:35:22 -0800
parents 7a019062451e
children 90c150a0a22b 2f2c6347fce4
files graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Mar 07 14:14:25 2012 -0800
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Mar 07 14:35:22 2012 -0800
@@ -1199,12 +1199,7 @@
     private FixedNode createTarget(double probability, Block block, FrameStateBuilder stateAfter) {
         assert probability >= 0 && probability <= 1;
         if (probability == 0 && config.useBranchPrediction()) {
-            BeginNode begin = currentGraph.add(new BeginNode());
-            DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateReprofile));
-            begin.setNext(deopt);
-            // Note: We are not allowed to set the stateAfter of the begin node, because we have to deoptimize to
-            // a bci _before_ the actual if, so that the interpreter can update the profiling information.
-            return begin;
+            return currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateReprofile));
         } else {
             return createTarget(block, stateAfter);
         }
@@ -1281,6 +1276,9 @@
         assert !(target instanceof BeginNode);
         BeginNode begin = currentGraph.add(new BeginNode());
         begin.setNext(target);
+
+        assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) :
+            "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize to a bci _before_ the actual if, so that the interpreter can update the profiling information.";
         return begin;
     }