diff graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java @ 21289:3b5ec1a2b3b5

consolidate frame state creation and processing for intrinsics into graph parsing, removing need for CollapseFrameForSingleSideEffectPhase
author Doug Simon <doug.simon@oracle.com>
date Mon, 11 May 2015 17:12:15 +0200
parents b97ec8aec2c7
children 710fc7216c56
line wrap: on
line diff
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java	Mon May 11 17:10:26 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java	Mon May 11 17:12:15 2015 +0200
@@ -115,7 +115,7 @@
         T equivalentValue = append(value);
         if (equivalentValue instanceof StateSplit) {
             StateSplit stateSplit = (StateSplit) equivalentValue;
-            if (stateSplit.stateAfter() == null) {
+            if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) {
                 setStateAfter(stateSplit);
             }
         }
@@ -149,7 +149,7 @@
         push(kind.getStackKind(), equivalentValue);
         if (equivalentValue instanceof StateSplit) {
             StateSplit stateSplit = (StateSplit) equivalentValue;
-            if (stateSplit.stateAfter() == null) {
+            if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) {
                 setStateAfter(stateSplit);
             }
         }
@@ -194,11 +194,12 @@
 
     /**
      * Creates a snap shot of the current frame state with the BCI of the instruction after the one
-     * currently being parsed and assigns it to a given state split node.
+     * currently being parsed and assigns it to a given {@linkplain StateSplit#hasSideEffect() side
+     * effect} node.
      *
-     * @param stateSplit a node just appended to the graph that needs a frame state
+     * @param sideEffect a side effect node just appended to the graph
      */
-    void setStateAfter(StateSplit stateSplit);
+    void setStateAfter(StateSplit sideEffect);
 
     /**
      * Gets the parsing context for the method that inlines the method being parsed by this context.
@@ -206,6 +207,18 @@
     GraphBuilderContext getParent();
 
     /**
+     * Gets the first ancestor parsing context that is not parsing a
+     * {@linkplain #parsingReplacement() replacement}.
+     */
+    default GraphBuilderContext getNonReplacementAncestor() {
+        GraphBuilderContext ancestor = getParent();
+        while (ancestor != null && ancestor.parsingReplacement()) {
+            ancestor = ancestor.getParent();
+        }
+        return ancestor;
+    }
+
+    /**
      * Gets the method currently being parsed.
      */
     ResolvedJavaMethod getMethod();