public class NodeIntrinsificationPhase extends Phase
Node.NodeIntrinsic
s with nodes and calls to methods annotated with
Fold
with the result of invoking the annotated method via reflection.Modifier and Type | Field and Description |
---|---|
private ConstantReflectionProvider |
constantReflection |
static JavaConstant |
COULD_NOT_FOLD |
private ForeignCallsProvider |
foreignCalls |
private MetaAccessProvider |
metaAccess |
private SnippetReflectionProvider |
snippetReflection |
private StampProvider |
stampProvider |
BEFORE_PHASE_DUMP_LEVEL, PHASE_DUMP_LEVEL
Constructor and Description |
---|
NodeIntrinsificationPhase(MetaAccessProvider metaAccess,
ConstantReflectionProvider constantReflection,
SnippetReflectionProvider snippetReflection,
ForeignCallsProvider foreignCalls,
StampProvider stampProvider) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
areAllConstant(List<ValueNode> arguments) |
private static void |
checkCheckCastUsage(StructuredGraph graph,
Node intrinsifiedNode,
Node input,
Node usage) |
private static boolean |
checkNoMoreInjected(ResolvedJavaMethod c,
int start) |
void |
cleanUpReturnCheckCast(Node newInstance) |
ValueNode |
createIntrinsicNode(List<ValueNode> arguments,
Stamp stamp,
ResolvedJavaMethod method,
StructuredGraph graph,
Node.NodeIntrinsic intrinsic)
Attempts to create a node to replace a call to a
Node.NodeIntrinsic annotated method. |
protected ValueNode |
createNodeInstance(StructuredGraph graph,
ResolvedJavaType nodeClass,
ResolvedJavaType[] parameterTypes,
Stamp invokeStamp,
boolean setStampFromReturnType,
Object[] nodeConstructorArguments) |
Node.NodeIntrinsic |
getIntrinsic(ResolvedJavaMethod method)
Permits a subclass to override the default definition of "intrinsic".
|
ResolvedJavaType |
getNodeClass(ResolvedJavaMethod target,
Node.NodeIntrinsic intrinsic) |
protected Object |
invokeConstructor(ResolvedJavaMethod constructor,
Object[] arguments) |
boolean |
isFoldable(ResolvedJavaMethod method)
Permits a subclass to override the default definition of "foldable".
|
private Object[] |
match(StructuredGraph graph,
Stamp invokeStamp,
ResolvedJavaMethod c,
ResolvedJavaType[] parameterTypes,
Object[] nodeConstructorArguments) |
private Object[] |
prepareArguments(List<ValueNode> arguments,
ResolvedJavaType[] parameterTypes,
ResolvedJavaMethod target,
boolean folding)
Converts the arguments of an invoke node to object values suitable for use as the arguments
to a reflective invocation of a Java constructor or method.
|
protected void |
run(StructuredGraph graph) |
private static String |
sigString(ResolvedJavaType[] types) |
private static String |
sourceLocation(Node n) |
JavaConstant |
tryFold(List<ValueNode> args,
ResolvedJavaType[] parameterTypes,
ResolvedJavaMethod target) |
protected boolean |
tryIntrinsify(MethodCallTargetNode methodCallTargetNode,
List<Node> cleanUpReturnList) |
apply, apply, createName, getName
private final MetaAccessProvider metaAccess
private final ConstantReflectionProvider constantReflection
private final SnippetReflectionProvider snippetReflection
private final ForeignCallsProvider foreignCalls
private final StampProvider stampProvider
public static final JavaConstant COULD_NOT_FOLD
public NodeIntrinsificationPhase(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, StampProvider stampProvider)
protected void run(StructuredGraph graph)
protected boolean tryIntrinsify(MethodCallTargetNode methodCallTargetNode, List<Node> cleanUpReturnList)
public JavaConstant tryFold(List<ValueNode> args, ResolvedJavaType[] parameterTypes, ResolvedJavaMethod target)
private static boolean areAllConstant(List<ValueNode> arguments)
public ValueNode createIntrinsicNode(List<ValueNode> arguments, Stamp stamp, ResolvedJavaMethod method, StructuredGraph graph, Node.NodeIntrinsic intrinsic)
Node.NodeIntrinsic
annotated method.arguments
- the arguments of the callstamp
- the stamp to use for the returned nodemethod
- the method annotated with Node.NodeIntrinsic
graph
- the graph into which the created node will be addedConstantNode
if the intrinsic could be
folded, null
if intrinsification could
not (yet) be performed, otherwise the node representing the intrinsicpublic Node.NodeIntrinsic getIntrinsic(ResolvedJavaMethod method)
public boolean isFoldable(ResolvedJavaMethod method)
private Object[] prepareArguments(List<ValueNode> arguments, ResolvedJavaType[] parameterTypes, ResolvedJavaMethod target, boolean folding)
folding
- specifies if the invocation is for handling a Fold
annotationinvoke
that is expected to be constant isn'tpublic ResolvedJavaType getNodeClass(ResolvedJavaMethod target, Node.NodeIntrinsic intrinsic)
protected ValueNode createNodeInstance(StructuredGraph graph, ResolvedJavaType nodeClass, ResolvedJavaType[] parameterTypes, Stamp invokeStamp, boolean setStampFromReturnType, Object[] nodeConstructorArguments)
protected Object invokeConstructor(ResolvedJavaMethod constructor, Object[] arguments)
private static String sigString(ResolvedJavaType[] types)
private static boolean checkNoMoreInjected(ResolvedJavaMethod c, int start)
private Object[] match(StructuredGraph graph, Stamp invokeStamp, ResolvedJavaMethod c, ResolvedJavaType[] parameterTypes, Object[] nodeConstructorArguments)
private static String sourceLocation(Node n)
public void cleanUpReturnCheckCast(Node newInstance)
private static void checkCheckCastUsage(StructuredGraph graph, Node intrinsifiedNode, Node input, Node usage)