--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java 2017-08-28 14:09:44.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java 2017-08-28 14:09:44.000000000 -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();