# HG changeset patch # User Doug Simon # Date 1415203260 -3600 # Node ID 6faee2dcebbf6fc6f33bcb5d50dd87732bcc3aa1 # Parent 4a41f32ed5520590edcc0b4d150e276a7631bdc1 moved MethodHandleAccessProvider to graal.api.meta and made it retrievable from MetaAccessProvider so that it does not need to be accessed via a global in MethodHandleNode (which is problematic for remote/replay compilation) (GRAAL-874) diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Wed Nov 05 17:01:00 2014 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.api.meta; +import java.lang.invoke.*; import java.lang.reflect.*; /** @@ -82,6 +83,11 @@ long getMemorySize(JavaConstant constant); /** + * Gets access to the internals of {@link MethodHandle}. + */ + MethodHandleAccessProvider getMethodHandleAccess(); + + /** * Parses a method * descriptor into a {@link Signature}. The behavior of this method is undefined if the diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MethodHandleAccessProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MethodHandleAccessProvider.java Wed Nov 05 17:01:00 2014 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.meta; + +import java.lang.invoke.*; + +/** + * Interface to access the internals of the {@link MethodHandle} implementation of the VM. An + * implementation of this interface is usually required to access non-public classes, methods, and + * fields of {@link MethodHandle}, i.e., data that is not standardized by the Java specification. + */ +public interface MethodHandleAccessProvider { + + /** + * Identification for methods defined on the class {@link MethodHandle} that are processed by + * the {@link MethodHandleAccessProvider}. + */ + public enum IntrinsicMethod { + /** The method {@code MethodHandle.invokeBasic}. */ + INVOKE_BASIC, + /** The method {@code MethodHandle.linkToStatic}. */ + LINK_TO_STATIC, + /** The method {@code MethodHandle.linkToSpecial}. */ + LINK_TO_SPECIAL, + /** The method {@code MethodHandle.linkToVirtual}. */ + LINK_TO_VIRTUAL, + /** The method {@code MethodHandle.linkToInterface}. */ + LINK_TO_INTERFACE + } + + /** + * Returns the method handle method intrinsic identifier for the provided method, or + * {@code null} if the method is not an intrinsic processed by this interface. + */ + IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method); + + /** + * Resolves the invocation target for an invocation of {@link IntrinsicMethod#INVOKE_BASIC + * MethodHandle.invokeBasic} with the given constant receiver {@link MethodHandle}. Returns + * {@code null} if the invocation target is not available at this time. + *

+ * The first invocations of a method handle can use an interpreter to lookup the actual invoked + * method; frequently executed method handles can use Java bytecode generation to avoid the + * interpreter overhead. If the parameter forceBytecodeGeneration is set to true, the VM should + * try to generate bytecodes before this method returns. + */ + ResolvedJavaMethod resolveInvokeBasicTarget(JavaConstant methodHandle, boolean forceBytecodeGeneration); + + /** + * Resolves the invocation target for an invocation of a {@code MethodHandle.linkTo*} method + * with the given constant member name. The member name is the last parameter of the + * {@code linkTo*} method. Returns {@code null} if the invocation target is not available at + * this time. + */ + ResolvedJavaMethod resolveLinkToTarget(JavaConstant memberName); +} diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodHandleAccessProvider.java --- a/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodHandleAccessProvider.java Wed Nov 05 13:09:49 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.api.replacements; - -import java.lang.invoke.*; - -import com.oracle.graal.api.meta.*; - -/** - * Interface to access the internals of the {@link MethodHandle} implementation of the VM. An - * implementation of this interface is usually required to access non-public classes, methods, and - * fields of {@link MethodHandle}, i.e., data that is not standardized by the Java specification. - */ -public interface MethodHandleAccessProvider { - - /** - * Identification for methods defined on the class {@link MethodHandle} that are processed by - * the {@link MethodHandleAccessProvider}. - */ - public enum IntrinsicMethod { - /** The method {@code MethodHandle.invokeBasic}. */ - INVOKE_BASIC, - /** The method {@code MethodHandle.linkToStatic}. */ - LINK_TO_STATIC, - /** The method {@code MethodHandle.linkToSpecial}. */ - LINK_TO_SPECIAL, - /** The method {@code MethodHandle.linkToVirtual}. */ - LINK_TO_VIRTUAL, - /** The method {@code MethodHandle.linkToInterface}. */ - LINK_TO_INTERFACE - } - - /** - * Returns the method handle method intrinsic identifier for the provided method, or - * {@code null} if the method is not an intrinsic processed by this interface. - */ - IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method); - - /** - * Resolves the invocation target for an invocation of {@link IntrinsicMethod#INVOKE_BASIC - * MethodHandle.invokeBasic} with the given constant receiver {@link MethodHandle}. Returns - * {@code null} if the invocation target is not available at this time. - *

- * The first invocations of a method handle can use an interpreter to lookup the actual invoked - * method; frequently executed method handles can use Java bytecode generation to avoid the - * interpreter overhead. If the parameter forceBytecodeGeneration is set to true, the VM should - * try to generate bytecodes before this method returns. - */ - ResolvedJavaMethod resolveInvokeBasicTarget(JavaConstant methodHandle, boolean forceBytecodeGeneration); - - /** - * Resolves the invocation target for an invocation of a {@code MethodHandle.linkTo*} method - * with the given constant member name. The member name is the last parameter of the - * {@code linkTo*} method. Returns {@code null} if the invocation target is not available at - * this time. - */ - ResolvedJavaMethod resolveLinkToTarget(JavaConstant memberName); -} diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Wed Nov 05 17:01:00 2014 +0100 @@ -113,7 +113,6 @@ Replacements replacements; HotSpotDisassemblerProvider disassembler; HotSpotSuitesProvider suites; - HotSpotMethodHandleAccessProvider methodHandleAccess; try (InitTimer t = timer("create providers")) { try (InitTimer rt = timer("create HotSpotRegisters provider")) { registers = createRegisters(); @@ -155,10 +154,7 @@ try (InitTimer rt = timer("create Suites provider")) { suites = createSuites(runtime); } - try (InitTimer rt = timer("create MethodHandleAccess provider")) { - methodHandleAccess = new HotSpotMethodHandleAccessProvider(); - } - providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, snippetReflection, methodHandleAccess); + providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, snippetReflection); } try (InitTimer rt = timer("instantiate backend")) { return createBackend(runtime, providers); diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackendFactory.java Wed Nov 05 17:01:00 2014 +0100 @@ -59,8 +59,7 @@ Replacements replacements = new HSAILHotSpotReplacementsImpl(p, host.getSnippetReflection(), assumptions, codeCache.getTarget(), host.getReplacements()); HotSpotDisassemblerProvider disassembler = host.getDisassembler(); SuitesProvider suites = new HotSpotSuitesProvider(runtime); - HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, host.getSnippetReflection(), - host.getMethodHandleAccess()); + HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, host.getSnippetReflection()); // pass registers info down to ReplacementsUtil (maybe a better way to do this?) HSAILHotSpotReplacementsUtil.initialize(providers.getRegisters()); diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Wed Nov 05 17:01:00 2014 +0100 @@ -77,8 +77,7 @@ try (InitTimer rt = timer("create HotSpotRegisters provider")) { registers = new HotSpotRegisters(PTX.tid, Register.None, Register.None); } - providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, host.getSnippetReflection(), - host.getMethodHandleAccess()); + providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, host.getSnippetReflection()); } try (InitTimer rt = timer("instantiate backend")) { return new PTXHotSpotBackend(runtime, providers); diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Wed Nov 05 17:01:00 2014 +0100 @@ -68,9 +68,7 @@ HotSpotReplacementsImpl replacements = new HotSpotReplacementsImpl(p, snippetReflection, runtime.getConfig(), assumptions, target); HotSpotDisassemblerProvider disassembler = new HotSpotDisassemblerProvider(runtime); HotSpotSuitesProvider suites = new HotSpotSuitesProvider(runtime); - HotSpotMethodHandleAccessProvider methodHandleAccess = new HotSpotMethodHandleAccessProvider(); - HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, snippetReflection, - methodHandleAccess); + HotSpotProviders providers = new HotSpotProviders(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements, disassembler, suites, registers, snippetReflection); return new SPARCHotSpotBackend(runtime, providers); } diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Nov 05 17:01:00 2014 +0100 @@ -446,8 +446,6 @@ return (T) this; } else if (clazz == SnippetReflectionProvider.class) { return (T) getHostProviders().getSnippetReflection(); - } else if (clazz == MethodHandleAccessProvider.class) { - return (T) getHostProviders().getMethodHandleAccess(); } else if (clazz == EventProvider.class) { return (T) eventProvider; } diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Wed Nov 05 17:01:00 2014 +0100 @@ -91,7 +91,7 @@ * the VM replicates them for every signature that they are actually used for. * Therefore, we cannot use the usual annotation-driven mechanism to define the */ - if (MethodHandleNode.lookupMethodHandleIntrinsic(method) != null) { + if (MethodHandleNode.lookupMethodHandleIntrinsic(method, providers.getMetaAccess().getMethodHandleAccess()) != null) { return MethodHandleNode.class; } } diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Wed Nov 05 17:01:00 2014 +0100 @@ -40,9 +40,15 @@ public class HotSpotMetaAccessProvider implements MetaAccessProvider { protected final HotSpotGraalRuntime runtime; + protected final HotSpotMethodHandleAccessProvider methodHandleAccess; public HotSpotMetaAccessProvider(HotSpotGraalRuntime runtime) { this.runtime = runtime; + methodHandleAccess = new HotSpotMethodHandleAccessProvider(); + } + + public MethodHandleAccessProvider getMethodHandleAccess() { + return methodHandleAccess; } public HotSpotResolvedJavaType lookupJavaType(Class clazz) { diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodHandleAccessProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodHandleAccessProvider.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodHandleAccessProvider.java Wed Nov 05 17:01:00 2014 +0100 @@ -27,7 +27,6 @@ import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.hotspot.*; diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java Wed Nov 05 17:01:00 2014 +0100 @@ -38,17 +38,15 @@ private final SuitesProvider suites; private final HotSpotRegistersProvider registers; private final SnippetReflectionProvider snippetReflection; - private final HotSpotMethodHandleAccessProvider methodHandleAccess; public HotSpotProviders(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, HotSpotDisassemblerProvider disassembler, SuitesProvider suites, HotSpotRegistersProvider registers, - SnippetReflectionProvider snippetReflection, HotSpotMethodHandleAccessProvider methodHandleAccess) { + SnippetReflectionProvider snippetReflection) { super(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements); this.disassembler = disassembler; this.suites = suites; this.registers = registers; this.snippetReflection = snippetReflection; - this.methodHandleAccess = methodHandleAccess; } @Override @@ -81,8 +79,4 @@ public SnippetReflectionProvider getSnippetReflection() { return snippetReflection; } - - public HotSpotMethodHandleAccessProvider getMethodHandleAccess() { - return methodHandleAccess; - } } diff -r 4a41f32ed552 -r 6faee2dcebbf graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Wed Nov 05 13:09:49 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Wed Nov 05 17:01:00 2014 +0100 @@ -22,14 +22,11 @@ */ package com.oracle.graal.hotspot.replacements; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; - import java.lang.invoke.*; import java.util.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.api.replacements.MethodHandleAccessProvider.IntrinsicMethod; +import com.oracle.graal.api.meta.MethodHandleAccessProvider.IntrinsicMethod; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; @@ -48,9 +45,6 @@ @NodeInfo public class MethodHandleNode extends MacroStateSplitNode implements Simplifiable { - /** The method that this node is representing. */ - protected final IntrinsicMethod intrinsicMethod; - // Replacement method data protected ResolvedJavaMethod replacementTargetMethod; protected JavaType replacementReturnType; @@ -64,8 +58,6 @@ super(invoke); MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget(); - intrinsicMethod = lookupMethodHandleIntrinsic(callTarget.targetMethod()); - assert intrinsicMethod != null; // See if we need to save some replacement method data. if (callTarget instanceof SelfReplacingMethodCallTargetNode) { @@ -83,22 +75,23 @@ * Returns the method handle method intrinsic identifier for the provided method, or * {@code null} if the method is not a method that can be handled by this class. */ - public static IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method) { - return methodHandleAccess().lookupMethodHandleIntrinsic(method); + public static IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method, MethodHandleAccessProvider methodHandleAccess) { + return methodHandleAccess.lookupMethodHandleIntrinsic(method); } @Override public void simplify(SimplifierTool tool) { InvokeNode invoke; + IntrinsicMethod intrinsicMethod = lookupMethodHandleIntrinsic(targetMethod, tool.getMetaAccess().getMethodHandleAccess()); switch (intrinsicMethod) { case INVOKE_BASIC: - invoke = getInvokeBasicTarget(); + invoke = getInvokeBasicTarget(tool, intrinsicMethod); break; case LINK_TO_STATIC: case LINK_TO_SPECIAL: case LINK_TO_VIRTUAL: case LINK_TO_INTERFACE: - invoke = getLinkToTarget(); + invoke = getLinkToTarget(tool, intrinsicMethod); break; default: throw GraalInternalError.shouldNotReachHere(); @@ -130,23 +123,15 @@ } /** - * Returns the {@link MethodHandleAccessProvider} that provides introspection of internal - * {@link MethodHandle} data. - */ - private static MethodHandleAccessProvider methodHandleAccess() { - return runtime().getHostProviders().getMethodHandleAccess(); - } - - /** * Used for the MethodHandle.invokeBasic method (the {@link IntrinsicMethod#INVOKE_BASIC } * method) to get the target {@link InvokeNode} if the method handle receiver is constant. * * @return invoke node for the {@link java.lang.invoke.MethodHandle} target */ - protected InvokeNode getInvokeBasicTarget() { + protected InvokeNode getInvokeBasicTarget(SimplifierTool tool, IntrinsicMethod intrinsicMethod) { ValueNode methodHandleNode = getReceiver(); if (methodHandleNode.isConstant()) { - return getTargetInvokeNode(methodHandleAccess().resolveInvokeBasicTarget(methodHandleNode.asJavaConstant(), false)); + return getTargetInvokeNode(tool.getMetaAccess().getMethodHandleAccess().resolveInvokeBasicTarget(methodHandleNode.asJavaConstant(), false), intrinsicMethod); } return null; } @@ -159,10 +144,10 @@ * * @return invoke node for the member name target */ - protected InvokeNode getLinkToTarget() { + protected InvokeNode getLinkToTarget(SimplifierTool tool, IntrinsicMethod intrinsicMethod) { ValueNode memberNameNode = getMemberName(); if (memberNameNode.isConstant()) { - return getTargetInvokeNode(methodHandleAccess().resolveLinkToTarget(memberNameNode.asJavaConstant())); + return getTargetInvokeNode(tool.getMetaAccess().getMethodHandleAccess().resolveLinkToTarget(memberNameNode.asJavaConstant()), intrinsicMethod); } return null; } @@ -174,7 +159,7 @@ * @param target the target, already loaded from the member name node * @return invoke node for the member name target */ - private InvokeNode getTargetInvokeNode(ResolvedJavaMethod target) { + private InvokeNode getTargetInvokeNode(ResolvedJavaMethod target, IntrinsicMethod intrinsicMethod) { if (target == null) { return null; } @@ -205,18 +190,18 @@ if (receiverType != null) { ResolvedJavaMethod concreteMethod = receiverType.findUniqueConcreteMethod(target); if (concreteMethod != null) { - return createTargetInvokeNode(concreteMethod); + return createTargetInvokeNode(concreteMethod, intrinsicMethod); } } } if (target.canBeStaticallyBound()) { - return createTargetInvokeNode(target); + return createTargetInvokeNode(target, intrinsicMethod); } ResolvedJavaMethod concreteMethod = target.getDeclaringClass().findUniqueConcreteMethod(target); if (concreteMethod != null) { - return createTargetInvokeNode(concreteMethod); + return createTargetInvokeNode(concreteMethod, intrinsicMethod); } return null; @@ -250,7 +235,7 @@ * @param target the method to be called * @return invoke node for the member name target */ - private InvokeNode createTargetInvokeNode(ResolvedJavaMethod target) { + private InvokeNode createTargetInvokeNode(ResolvedJavaMethod target, IntrinsicMethod intrinsicMethod) { InvokeKind targetInvokeKind = target.isStatic() ? InvokeKind.Static : InvokeKind.Special; JavaType targetReturnType = target.getSignature().getReturnType(null);