# HG changeset patch # User Gilles Duboscq # Date 1329478637 -3600 # Node ID ee91624e54e6a5a7b6bc8c74e3e48fbafc21aedf # Parent 73f935f28920ea535dbf24c3de7ef3cbe050e660 Fix checkcast type in polymorphic inlining diff -r 73f935f28920 -r ee91624e54e6 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Fri Feb 17 11:37:44 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Fri Feb 17 12:37:17 2012 +0100 @@ -326,10 +326,18 @@ for (int i = 0; i < calleeEntryNodes.length; i++) { BeginNode node = calleeEntryNodes[i]; Invoke invokeForInlining = (Invoke) node.next(); + int typeIdx = -1; + for (int j = 0; j < typesToConcretes.length; j++) { + if (typesToConcretes[j] == i) { + typeIdx = j; + break; + } + } + assert typeIdx >= 0; ValueNode receiver = invokeForInlining.callTarget().receiver(); - ConstantNode typeConst = graph.unique(ConstantNode.forCiConstant(types[i].getEncoding(Representation.ObjectHub), runtime, graph)); - CheckCastNode checkCast = graph.unique(new CheckCastNode(node, typeConst, types[i], receiver)); + ConstantNode typeConst = graph.unique(ConstantNode.forCiConstant(types[typeIdx].getEncoding(Representation.ObjectHub), runtime, graph)); + CheckCastNode checkCast = graph.unique(new CheckCastNode(node, typeConst, types[typeIdx], receiver)); invokeForInlining.callTarget().replaceFirstInput(receiver, checkCast); RiResolvedMethod concrete = concretes.get(i);