Mercurial > hg > truffle
changeset 15727:fa66540676ce
Try to devirtualize using unique concrete method and subtype in MethodCallTargetNode.canonical
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Sat, 17 May 2014 15:05:25 +0200 |
parents | 668d158f780c |
children | 22f56c3eadb7 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Sat May 17 12:45:46 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Sat May 17 15:05:25 2014 +0200 @@ -150,6 +150,25 @@ targetMethod = resolvedMethod; return this; } + if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) { + ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype(); + if (uniqueConcreteType != null) { + ResolvedJavaMethod methodFromUniqueType = uniqueConcreteType.resolveMethod(targetMethod, invoke().getContextType()); + assert methodFromUniqueType != null; + tool.assumptions().recordConcreteSubtype(type, uniqueConcreteType); + invokeKind = InvokeKind.Special; + targetMethod = methodFromUniqueType; + return this; + } + + ResolvedJavaMethod uniqueConcreteMethod = type.findUniqueConcreteMethod(targetMethod); + if (uniqueConcreteMethod != null) { + tool.assumptions().recordConcreteMethod(targetMethod, type, uniqueConcreteMethod); + invokeKind = InvokeKind.Special; + targetMethod = uniqueConcreteMethod; + return this; + } + } } } return this;