# HG changeset patch # User Gilles Duboscq # Date 1400331925 -7200 # Node ID fa66540676cee2212fdcd6f8c6aba7dd215f76ef # Parent 668d158f780c52af8f0264d964db0ac9f4891e9d Try to devirtualize using unique concrete method and subtype in MethodCallTargetNode.canonical diff -r 668d158f780c -r fa66540676ce 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 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;