# HG changeset patch # User Thomas Wuerthinger # Date 1404222738 -7200 # Node ID 4bfe1359d98a36663d1a501a1d56dbad9f250cd5 # Parent 57511d7d5a1083a4b1595ab12bf8fe4043991774 Resolved virtual calls are guaranteed to have as receiver type at least the holder of the virtual method. diff -r 57511d7d5a10 -r 4bfe1359d98a 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 Tue Jul 01 15:50:12 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Tue Jul 01 15:52:18 2014 +0200 @@ -140,6 +140,10 @@ // check if the type of the receiver can narrow the result ValueNode receiver = receiver(); ResolvedJavaType type = StampTool.typeOrNull(receiver); + if (type == null && invokeKind == InvokeKind.Virtual) { + // For virtual calls, we are guaranteed to receive a correct receiver type. + type = targetMethod.getDeclaringClass(); + } if (type != null && (invoke().stateAfter() != null || invoke().stateDuring() != null)) { /* * either the holder class is exact, or the receiver object has an exact type, or