public final class MethodHandleNode extends MacroStateSplitNode implements Simplifiable
MethodHandle
.Node.ConstantNodeParameter, Node.InjectedNodeParameter, Node.Input, Node.NodeIntrinsic, Node.OptionalInput, Node.Successor, Node.ValueNumberable
MemoryCheckpoint.Multi, MemoryCheckpoint.Single, MemoryCheckpoint.TypeAssertion
Modifier and Type | Field and Description |
---|---|
protected MethodHandleAccessProvider.IntrinsicMethod |
intrinsicMethod |
static NodeClass<MethodHandleNode> |
TYPE |
stateAfter
arguments, bci, invokeKind, returnType, targetMethod
next
NODE_LIST, NOT_ITERABLE, USE_UNSAFE_TO_CLONE, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges
Constructor and Description |
---|
MethodHandleNode(MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
CallTargetNode.InvokeKind invokeKind,
ResolvedJavaMethod targetMethod,
int bci,
JavaType returnType,
ValueNode... arguments) |
Modifier and Type | Method and Description |
---|---|
private static InvokeNode |
createTargetInvokeNode(MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
ResolvedJavaMethod target,
ResolvedJavaMethod original,
int bci,
JavaType returnType,
ValueNode[] arguments)
Creates an
InvokeNode for the given target method. |
private static InvokeNode |
getInvokeBasicTarget(Assumptions assumptions,
MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
MethodHandleAccessProvider methodHandleAccess,
ResolvedJavaMethod original,
int bci,
JavaType returnType,
ValueNode[] arguments)
Used for the MethodHandle.invokeBasic method (the
MethodHandleAccessProvider.IntrinsicMethod.INVOKE_BASIC
method) to get the target InvokeNode if the method handle receiver is constant. |
private static InvokeNode |
getLinkToTarget(Assumptions assumptions,
MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
MethodHandleAccessProvider methodHandleAccess,
ResolvedJavaMethod original,
int bci,
JavaType returnType,
ValueNode[] arguments)
Used for the MethodHandle.linkTo* methods (the
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_STATIC ,
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_SPECIAL , MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_VIRTUAL , and
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_INTERFACE methods) to get the target InvokeNode if
the member name argument is constant. |
private static ValueNode |
getMemberName(ValueNode[] arguments)
Get the MemberName argument of a MethodHandle.linkTo* call.
|
private static ValueNode |
getReceiver(ValueNode[] arguments)
Get the receiver of a MethodHandle.invokeBasic call.
|
private static InvokeNode |
getTargetInvokeNode(Assumptions assumptions,
MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
int bci,
JavaType returnType,
ValueNode[] arguments,
ResolvedJavaMethod target,
ResolvedJavaMethod original)
Helper function to get the
InvokeNode for the targetMethod of a
java.lang.invoke.MemberName. |
private static void |
maybeCastArgument(ValueNode[] arguments,
int index,
JavaType type)
Inserts a node to cast the argument at index to the given type if the given type is more
concrete than the argument type.
|
void |
simplify(SimplifierTool tool)
Must be overridden by subclasses that implement
Simplifiable . |
static InvokeNode |
tryResolveTargetInvoke(Assumptions assumptions,
MethodHandleAccessProvider methodHandleAccess,
MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod,
ResolvedJavaMethod original,
int bci,
JavaType returnType,
ValueNode... arguments)
Attempts to transform application of an intrinsifiable
MethodHandle method into an
invocation on another method with possibly transformed arguments. |
getLocationIdentity, hasSideEffect, replaceSnippetInvokes, setStateAfter, stateAfter
createInvoke, getBci, getLoweredSnippetGraph, getLoweredSubstitutionGraph, getReturnType, getTargetMethod, lower, lowerReplacement, replaceWithInvoke
asNode, next, setNext
asConstant, asJavaConstant, getKind, graph, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isNullConstant, setStamp, stamp, updateStamp
acceptInputs, acceptSuccessors, afterClone, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearSuccessors, copyWithInputs, copyWithInputs, equals, fail, formatTo, getDebugProperties, getDebugProperties, getId, getNodeClass, getUsageAt, getUsageCount, hashCode, hasNoUsages, hasUsages, inputs, isAlive, isDeleted, markDeleted, modCount, newIdentityMap, newIdentityMap, newIdentityMap, newMap, newMap, newMap, newSet, newSet, predecessor, pushInputs, removeUsage, replaceAndDelete, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceFirstInput, replaceFirstSuccessor, safeDelete, successors, toString, toString, updatePredecessor, updateUsages, updateUsagesInterface, usages, valueEquals, verifyEdges, verifyInputs
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asNode
states
public static final NodeClass<MethodHandleNode> TYPE
protected final MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod
public MethodHandleNode(MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, int bci, JavaType returnType, ValueNode... arguments)
public static InvokeNode tryResolveTargetInvoke(Assumptions assumptions, MethodHandleAccessProvider methodHandleAccess, MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, ResolvedJavaMethod original, int bci, JavaType returnType, ValueNode... arguments)
MethodHandle
method into an
invocation on another method with possibly transformed arguments.assumptions
- object for recording any speculations made during the transformationmethodHandleAccess
- objects for accessing the implementation internals of a
MethodHandle
intrinsicMethod
- denotes the intrinsifiable MethodHandle
method being processedbci
- the BCI of the original MethodHandle
callreturnType
- return type of the original MethodHandle
callarguments
- arguments to the original MethodHandle
callMethodHandle
call or nullpublic void simplify(SimplifierTool tool)
Node
Simplifiable
. The implementation in
Node
exists to obviate the need to cast a node before invoking
Simplifiable.simplify(SimplifierTool)
.simplify
in interface Simplifiable
simplify
in class Node
private static ValueNode getReceiver(ValueNode[] arguments)
private static ValueNode getMemberName(ValueNode[] arguments)
private static InvokeNode getInvokeBasicTarget(Assumptions assumptions, MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, MethodHandleAccessProvider methodHandleAccess, ResolvedJavaMethod original, int bci, JavaType returnType, ValueNode[] arguments)
MethodHandleAccessProvider.IntrinsicMethod.INVOKE_BASIC
method) to get the target InvokeNode
if the method handle receiver is constant.MethodHandle
targetprivate static InvokeNode getLinkToTarget(Assumptions assumptions, MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, MethodHandleAccessProvider methodHandleAccess, ResolvedJavaMethod original, int bci, JavaType returnType, ValueNode[] arguments)
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_STATIC
,
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_SPECIAL
, MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_VIRTUAL
, and
MethodHandleAccessProvider.IntrinsicMethod.LINK_TO_INTERFACE
methods) to get the target InvokeNode
if
the member name argument is constant.private static InvokeNode getTargetInvokeNode(Assumptions assumptions, MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, int bci, JavaType returnType, ValueNode[] arguments, ResolvedJavaMethod target, ResolvedJavaMethod original)
InvokeNode
for the targetMethod of a
java.lang.invoke.MemberName.target
- the target, already loaded from the member name nodeprivate static void maybeCastArgument(ValueNode[] arguments, int index, JavaType type)
index
- of the argument to be casttype
- the type the argument should be cast toprivate static InvokeNode createTargetInvokeNode(MethodHandleAccessProvider.IntrinsicMethod intrinsicMethod, ResolvedJavaMethod target, ResolvedJavaMethod original, int bci, JavaType returnType, ValueNode[] arguments)
InvokeNode
for the given target method. The CallTargetNode
passed
to the InvokeNode is in fact a ResolvedMethodHandleCallTargetNode
.