changeset 21063:ae5710f20011

renamed BytecodeFrame.isSyntheticBci to isPlaceholderBci and added getPlaceholderBciName
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Apr 2015 09:51:03 +0200
parents 09d9141cf7d8
children 28117ede7606
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java
diffstat 4 files changed, 37 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Wed Apr 15 14:47:48 2015 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Tue Apr 21 09:51:03 2015 +0200
@@ -132,10 +132,31 @@
     public static final int INVALID_FRAMESTATE_BCI = -6;
 
     /**
-     * Determines if a given BCI matches one of the synthetic BCI contants defined in this class.
+     * Determines if a given BCI matches one of the placeholder BCI constants defined in this class.
+     */
+    public static boolean isPlaceholderBci(int bci) {
+        return bci < 0;
+    }
+
+    /**
+     * Gets the name of a given placeholder BCI.
      */
-    public static boolean isSyntheticBci(int bci) {
-        return bci < 0;
+    public static String getPlaceholderBciName(int bci) {
+        assert isPlaceholderBci(bci);
+        if (bci == BytecodeFrame.AFTER_BCI) {
+            return "AFTER_BCI";
+        } else if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI) {
+            return "AFTER_EXCEPTION_BCI";
+        } else if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
+            return "INVALID_FRAMESTATE_BCI";
+        } else if (bci == BytecodeFrame.BEFORE_BCI) {
+            return "BEFORE_BCI";
+        } else if (bci == BytecodeFrame.UNKNOWN_BCI) {
+            return "UNKNOWN_BCI";
+        } else {
+            assert bci == BytecodeFrame.UNWIND_BCI;
+            return "UNWIND_BCI";
+        }
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Wed Apr 15 14:47:48 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Tue Apr 21 09:51:03 2015 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.hotspot;
 
+import static com.oracle.graal.api.code.BytecodeFrame.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
@@ -60,7 +62,7 @@
 
     @Override
     protected BytecodeFrame computeFrameForState(FrameState state) {
-        assert state.bci >= 0 || state.bci == BytecodeFrame.BEFORE_BCI : state.bci;
+        assert !isPlaceholderBci(state.bci) || state.bci == BytecodeFrame.BEFORE_BCI : state.bci;
         return super.computeFrameForState(state);
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Wed Apr 15 14:47:48 2015 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Tue Apr 21 09:51:03 2015 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.nodes;
 
+import static com.oracle.graal.api.code.BytecodeFrame.*;
+
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
@@ -293,7 +295,7 @@
      * 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)) {
+        if (BytecodeFrame.isPlaceholderBci(oldBci)) {
             return true;
         }
         /*
@@ -449,18 +451,8 @@
                 properties.put("sourceLine", ste.getLineNumber());
             }
         }
-        if (bci == BytecodeFrame.AFTER_BCI) {
-            properties.put("bci", "AFTER_BCI");
-        } else if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI) {
-            properties.put("bci", "AFTER_EXCEPTION_BCI");
-        } else if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
-            properties.put("bci", "INVALID_FRAMESTATE_BCI");
-        } else if (bci == BytecodeFrame.BEFORE_BCI) {
-            properties.put("bci", "BEFORE_BCI");
-        } else if (bci == BytecodeFrame.UNKNOWN_BCI) {
-            properties.put("bci", "UNKNOWN_BCI");
-        } else if (bci == BytecodeFrame.UNWIND_BCI) {
-            properties.put("bci", "UNWIND_BCI");
+        if (isPlaceholderBci(bci)) {
+            properties.put("bci", getPlaceholderBciName(bci));
         }
         properties.put("locksSize", values.size() - stackSize - localsSize);
         return properties;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Wed Apr 15 14:47:48 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Tue Apr 21 09:51:03 2015 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.replacements.nodes;
 
+import static com.oracle.graal.api.code.BytecodeFrame.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
@@ -74,7 +76,7 @@
         this.targetMethod = targetMethod;
         this.returnType = returnType;
         this.invokeKind = invokeKind;
-        assert bci >= 0;
+        assert !isPlaceholderBci(bci);
     }
 
     public int getBci() {
@@ -171,8 +173,8 @@
             InliningUtil.inline(invoke, replacementGraph, false, null);
             Debug.dump(graph(), "After inlining replacement %s", replacementGraph);
         } else {
-            if (invoke.bci() < 0) {
-                throw new GraalInternalError("%s: cannot lower to invoke with invalid BCI: %s", graph(), this);
+            if (isPlaceholderBci(invoke.bci())) {
+                throw new GraalInternalError("%s: cannot lower to invoke with placeholder BCI: %s", graph(), this);
             }
 
             if (invoke.stateAfter() == null) {