# HG changeset patch # User Doug Simon # Date 1415186795 -3600 # Node ID 01e268964aa4c72c61df31b1b23f4d691bebf66d # Parent edb88f5425e60098ded93f7a982ec734e5d7b8bf# Parent 34cb95edfc9780645f361dbf653376e87ac979ac Merge. diff -r edb88f5425e6 -r 01e268964aa4 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed Nov 05 12:23:57 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed Nov 05 12:26:35 2014 +0100 @@ -156,9 +156,7 @@ ResolvedJavaMethod newResolvedMethod = single.resolveMethod(targetMethod(), invoke().getContextType(), true); // TODO (je): we can not yet deal with default methods if (newResolvedMethod != null && !newResolvedMethod.isDefault()) { - ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo(); - JavaTypeProfile profile = profilingInfo.getTypeProfile(invoke().bci()); - LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, profile)); + LogicNode condition = graph().unique(InstanceOfNode.create(single, receiver, getProfile())); assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!"; GuardNode guard = graph().unique( GuardNode.create(condition, BeginNode.prevBegin(invoke().asNode()), DeoptimizationReason.OptimizedTypeCheckViolated, DeoptimizationAction.InvalidateRecompile, @@ -173,6 +171,17 @@ } } + private JavaTypeProfile getProfile() { + assert !isStatic(); + if (receiver() instanceof TypeProfileProxyNode) { + // get profile from TypeProfileProxy + return ((TypeProfileProxyNode) receiver()).getProfile(); + } + // get profile from invoke() + ProfilingInfo profilingInfo = invoke().getContextMethod().getProfilingInfo(); + return profilingInfo.getTypeProfile(invoke().bci()); + } + @Override public Stamp returnStamp() { Kind returnKind = targetMethod().getSignature().getReturnKind(); diff -r edb88f5425e6 -r 01e268964aa4 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Wed Nov 05 12:23:57 2014 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Wed Nov 05 12:26:35 2014 +0100 @@ -74,10 +74,10 @@ assertInGraph(graph, intrinsicClass); } - // Force compilation - InstalledCode code = getCode(testJavaMethod); - assert optional || code != null; for (Object l : args) { + // Force compilation + InstalledCode code = getCode(testJavaMethod); + assert optional || code != null; // Verify that the original method and the substitution produce the same value Object expected = invokeSafe(realJavaMethod, null, l); assertDeepEquals(expected, invokeSafe(testJavaMethod, null, l));