Mercurial > hg > graal-compiler
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java @ 18242:4bfe1359d98a
Resolved virtual calls are guaranteed to have as receiver type at least the holder of the virtual method.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 01 Jul 2014 15:52:18 +0200 |
parents | 5605c5e37a1e |
children | 691e2b53dc63 |
line wrap: on
line diff
--- 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