Mercurial > hg > graal-compiler
diff graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java @ 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 | c583759bbcfd |
children | ca19a71c8566 |
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;