Mercurial > hg > graal-compiler
changeset 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 | 57511d7d5a10 |
children | b363053f6cac |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
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