hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java
changeset 47084 630d326a3d15
parent 46640 70bdce04c59b
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Mon Aug 28 16:40:01 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Mon Aug 28 14:43:32 2017 -0700
@@ -707,10 +707,22 @@
             }
         }
 
+        LoopScope inlineLoopScope = createInitialLoopScope(inlineScope, predecessor);
+
+        /*
+         * The GraphEncoder assigns parameters a nodeId immediately after the fixed nodes.
+         * Initializing createdNodes here avoid decoding and immediately replacing the
+         * ParameterNodes.
+         */
+        int firstArgumentNodeId = inlineScope.maxFixedNodeOrderId + 1;
+        for (int i = 0; i < arguments.length; i++) {
+            inlineLoopScope.createdNodes[firstArgumentNodeId + i] = arguments[i];
+        }
+
         /*
          * Do the actual inlining by returning the initial loop scope for the inlined method scope.
          */
-        return createInitialLoopScope(inlineScope, predecessor);
+        return inlineLoopScope;
     }
 
     @Override
@@ -1028,9 +1040,7 @@
         if (node instanceof ParameterNode) {
             ParameterNode param = (ParameterNode) node;
             if (methodScope.isInlinedMethod()) {
-                Node result = methodScope.arguments[param.index()];
-                assert result != null;
-                return result;
+                throw GraalError.shouldNotReachHere("Parameter nodes are already registered when the inlined scope is created");
 
             } else if (parameterPlugin != null) {
                 assert !methodScope.isInlinedMethod();