# HG changeset patch # User Andreas Woess # Date 1427718406 -7200 # Node ID 5b62fbf5f290feab53c9b5988dd9f990ee2ff3f9 # Parent e167fbc147145dece93359be7c9bcbe52b075bab PartialEvaluator: method handle inlining now handled by HotSpotInvocationPlugins diff -r e167fbc14714 -r 5b62fbf5f290 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- 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 concreteMethod = receiverType.findUniqueConcreteMethod(targetMethod); - if (concreteMethod != null) { - builder.getAssumptions().record(concreteMethod); - return new InlineInfo(concreteMethod.getResult(), false, false); - } - } - } else { - AssumptionResult 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 {