Mercurial > hg > truffle
changeset 18313:6b8bceeecb30
MethodCallTargetNode: also simplify default method calls to virtual calls if possible.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 06 Nov 2014 12:40:28 +0100 |
parents | a968fd429ee5 |
children | 3cc813ce3cea |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Sun Nov 09 16:33:40 2014 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Thu Nov 06 12:40:28 2014 +0100 @@ -150,12 +150,15 @@ } } ResolvedJavaType declaredReceiverType = targetMethod().getDeclaringClass(); - if (declaredReceiverType.isInterface()) { + /* + * We need to check the invoke kind to avoid recursive simplification for default + * methods calls. + */ + if (declaredReceiverType.isInterface() && !invokeKind().equals(InvokeKind.Virtual)) { ResolvedJavaType singleImplementor = declaredReceiverType.getSingleImplementor(); if (singleImplementor != null && !singleImplementor.equals(declaredReceiverType)) { ResolvedJavaMethod singleImplementorMethod = singleImplementor.resolveMethod(targetMethod(), invoke().getContextType(), true); - // TODO (je): we can not yet deal with default methods - if (singleImplementorMethod != null && !singleImplementorMethod.isDefault()) { + if (singleImplementorMethod != null) { LogicNode condition = graph().unique(InstanceOfNode.create(singleImplementor, receiver, getProfile())); assert graph().getGuardsStage().ordinal() < StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal() : "Graph already fixed!"; GuardNode guard = graph().unique(