# HG changeset patch # User Josef Eisl # Date 1415103778 -3600 # Node ID 34cb95edfc9780645f361dbf653376e87ac979ac # Parent e41787b05c98e1a925621617d98307528b801e1f MethodCallTargetNode: get profile from TypeProfileProxy if available. diff -r e41787b05c98 -r 34cb95edfc97 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 11:20:39 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Tue Nov 04 13:22:58 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();