changeset 20079:5b62fbf5f290

PartialEvaluator: method handle inlining now handled by HotSpotInvocationPlugins
author Andreas Woess <andreas.woess@oracle.com>
date Mon, 30 Mar 2015 14:26:46 +0200
parents e167fbc14714
children 826a51b9c5d1
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
diffstat 1 files changed, 1 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Mon Mar 30 14:23:20 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Mon Mar 30 14:26:46 2015 +0200
@@ -26,9 +26,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.MethodHandleAccessProvider.IntrinsicMethod;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
@@ -42,7 +40,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
@@ -71,7 +68,7 @@
     private final ResolvedJavaMethod callDirectMethod;
     private final ResolvedJavaMethod callInlinedMethod;
     private final ResolvedJavaMethod callSiteProxyMethod;
-    protected final ResolvedJavaMethod callRootMethod;
+    private final ResolvedJavaMethod callRootMethod;
     private final GraphBuilderConfiguration configForRoot;
 
     public PartialEvaluator(Providers providers, GraphBuilderConfiguration configForRoot, SnippetReflectionProvider snippetReflection) {
@@ -173,13 +170,6 @@
             if (original.getAnnotation(TruffleBoundary.class) != null) {
                 return null;
             }
-            IntrinsicMethod intrinsicMethod = builder.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(original);
-            if (intrinsicMethod != null) {
-                InlineInfo inlineInfo = getMethodHandleIntrinsicInlineInfo(builder, arguments, intrinsicMethod);
-                if (inlineInfo != null) {
-                    return inlineInfo;
-                }
-            }
             if (replacements != null && replacements.getMethodSubstitutionMethod(original) != null) {
                 return null;
             }
@@ -214,59 +204,6 @@
                 inlining.pop();
             }
         }
-
-        private InlineInfo getMethodHandleIntrinsicInlineInfo(GraphBuilderContext builder, ValueNode[] arguments, IntrinsicMethod intrinsicMethod) {
-            ResolvedJavaMethod targetMethod = null;
-            switch (intrinsicMethod) {
-                case INVOKE_BASIC:
-                    ValueNode methodHandleNode = arguments[0];
-                    if (methodHandleNode.isConstant()) {
-                        targetMethod = builder.getConstantReflection().getMethodHandleAccess().resolveInvokeBasicTarget(methodHandleNode.asJavaConstant(), true);
-                    }
-                    break;
-                case LINK_TO_STATIC:
-                case LINK_TO_SPECIAL:
-                case LINK_TO_VIRTUAL:
-                case LINK_TO_INTERFACE:
-                    ValueNode memberNameNode = arguments[arguments.length - 1];
-                    if (memberNameNode.isConstant()) {
-                        targetMethod = builder.getConstantReflection().getMethodHandleAccess().resolveLinkToTarget(memberNameNode.asJavaConstant());
-                    }
-                    break;
-                default:
-                    throw GraalInternalError.shouldNotReachHere();
-            }
-            if (targetMethod != null) {
-                // TODO maybe cast arguments
-
-                if (!targetMethod.canBeInlined()) {
-                    return null;
-                }
-                if (targetMethod.canBeStaticallyBound()) {
-                    return new InlineInfo(targetMethod, false, false);
-                }
-
-                // Try to get the most accurate receiver type
-                if (intrinsicMethod == IntrinsicMethod.LINK_TO_VIRTUAL || intrinsicMethod == IntrinsicMethod.LINK_TO_INTERFACE) {
-                    ResolvedJavaType receiverType = StampTool.typeOrNull(arguments[0].stamp());
-                    if (receiverType != null) {
-                        AssumptionResult<ResolvedJavaMethod> concreteMethod = receiverType.findUniqueConcreteMethod(targetMethod);
-                        if (concreteMethod != null) {
-                            builder.getAssumptions().record(concreteMethod);
-                            return new InlineInfo(concreteMethod.getResult(), false, false);
-                        }
-                    }
-                } else {
-                    AssumptionResult<ResolvedJavaMethod> concreteMethod = targetMethod.getDeclaringClass().findUniqueConcreteMethod(targetMethod);
-                    if (concreteMethod != null) {
-                        builder.getAssumptions().record(concreteMethod);
-                        return new InlineInfo(concreteMethod.getResult(), false, false);
-                    }
-                }
-            }
-
-            return null;
-        }
     }
 
     private class PELoopExplosionPlugin implements LoopExplosionPlugin {