public class SnippetTemplate extends Object
Snippet.ConstantParameter
parameters.
Snippet templates can be managed in a cache maintained by SnippetTemplate.AbstractTemplates
.Modifier and Type | Class and Description |
---|---|
static class |
SnippetTemplate.AbstractTemplates
Base class for snippet classes.
|
static class |
SnippetTemplate.Arguments
Values that are bound to the snippet method parameters.
|
(package private) static class |
SnippetTemplate.CacheKey |
protected static class |
SnippetTemplate.EagerSnippetInfo |
protected static class |
SnippetTemplate.LazySnippetInfo |
private static class |
SnippetTemplate.MemoryInputMap |
private class |
SnippetTemplate.MemoryOutputMap |
static class |
SnippetTemplate.SnippetInfo
Holds the
ResolvedJavaMethod of the snippet, together with some information about the
method that needs to be computed only once. |
static interface |
SnippetTemplate.UsageReplacer
Logic for replacing a snippet-lowered node at its usages with the return value of the
snippet.
|
(package private) static class |
SnippetTemplate.Varargs
Wrapper for the prototype value of a varargs parameter.
|
(package private) static class |
SnippetTemplate.VarargsPlaceholderNode |
Modifier and Type | Field and Description |
---|---|
private static Object |
CONSTANT_PARAMETER |
static SnippetTemplate.UsageReplacer |
DEFAULT_REPLACER
Represents the default
usage replacer logic which simply delegates to
Node.replaceAtUsages(Node) . |
private ArrayList<DeoptimizingNode> |
deoptNodes
Nodes that inherit a deoptimization
FrameState from the replacee during
instantiation. |
private SnippetTemplate.SnippetInfo |
info |
private DebugMetric |
instantiationCounter
Counts instantiations of this template.
|
private DebugTimer |
instantiationTimer
Times instantiations of this template.
|
static boolean |
LAZY_SNIPPETS |
private static String |
MAX_TEMPLATES_PER_SNIPPET_PROPERTY_NAME |
private static int |
MaxTemplatesPerSnippet |
private MemoryAnchorNode |
memoryAnchor
The memory anchor (if any) of the snippet.
|
private ArrayList<Node> |
nodes
The nodes to be inlined when this specialization is instantiated.
|
private Object[] |
parameters
The named parameters of this template that must be bound to values during instantiation.
|
private ReturnNode |
returnNode
The return node (if any) of the snippet.
|
private ArrayList<StateSplit> |
sideEffectNodes
Nodes that inherit the
StateSplit.stateAfter() from the replacee during
instantiation. |
private StructuredGraph |
snippet
The graph built from the snippet method.
|
private SnippetReflectionProvider |
snippetReflection |
private static DebugTimer |
SnippetTemplateCreationTime |
private static DebugMetric |
SnippetTemplates |
private ArrayList<ValueNode> |
stampNodes
The nodes that inherit the
ValueNode.stamp() from the replacee during instantiation. |
private static Object |
UNUSED_PARAMETER |
Modifier | Constructor and Description |
---|---|
protected |
SnippetTemplate(Providers providers,
SnippetReflectionProvider snippetReflection,
SnippetTemplate.Arguments args)
Creates a snippet template.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
assertSnippetKills(ValueNode replacee) |
private Map<Node,Node> |
bind(StructuredGraph replaceeGraph,
MetaAccessProvider metaAccess,
SnippetTemplate.Arguments args)
Gets the instantiation-time bindings to this template's parameters.
|
private static boolean |
checkAllVarargPlaceholdersAreDeleted(int parameterCount,
SnippetTemplate.VarargsPlaceholderNode[] placeholders) |
private static boolean |
checkConstantArgument(MetaAccessProvider metaAccess,
ResolvedJavaMethod method,
Signature signature,
int i,
String name,
Object arg,
Kind kind) |
private static boolean |
checkTemplate(MetaAccessProvider metaAccess,
SnippetTemplate.Arguments args,
ResolvedJavaMethod method,
Signature signature) |
private static boolean |
checkVarargs(MetaAccessProvider metaAccess,
ResolvedJavaMethod method,
Signature signature,
int i,
String name,
SnippetTemplate.Varargs varargs) |
StructuredGraph |
copySpecializedGraph()
Gets a copy of the specialized graph.
|
protected JavaConstant |
forBoxed(Object argument,
Kind localKind)
Converts a Java boxed value to a
JavaConstant of the right kind. |
protected Object[] |
getConstantArgs(SnippetTemplate.Arguments args) |
private static LocationIdentity |
getLocationIdentity(Node node) |
static boolean |
hasConstantParameter(ResolvedJavaMethod method)
Determines if any parameter of a given method is annotated with
Snippet.ConstantParameter . |
Map<Node,Node> |
instantiate(MetaAccessProvider metaAccess,
FixedNode replacee,
SnippetTemplate.UsageReplacer replacer,
SnippetTemplate.Arguments args)
Replaces a given fixed node with this specialized snippet.
|
void |
instantiate(MetaAccessProvider metaAccess,
FloatingNode replacee,
SnippetTemplate.UsageReplacer replacer,
LoweringTool tool,
SnippetTemplate.Arguments args)
Replaces a given floating node with this specialized snippet.
|
private void |
propagateStamp(Node node) |
private void |
replaceMemoryUsages(ValueNode node,
MemoryMap map) |
private void |
rewireMemoryGraph(ValueNode replacee,
Map<Node,Node> duplicates) |
String |
toString() |
private void |
updateStamps(ValueNode replacee,
Map<Node,Node> duplicates) |
public static boolean LAZY_SNIPPETS
private static final DebugTimer SnippetTemplateCreationTime
private static final DebugMetric SnippetTemplates
private static final String MAX_TEMPLATES_PER_SNIPPET_PROPERTY_NAME
private static final int MaxTemplatesPerSnippet
private static final Object UNUSED_PARAMETER
private static final Object CONSTANT_PARAMETER
private final SnippetReflectionProvider snippetReflection
private final StructuredGraph snippet
private final SnippetTemplate.SnippetInfo info
private final Object[] parameters
ParameterNode
instance or a ParameterNode
array. For an eliminated parameter,
the value is identical to the key.private final ReturnNode returnNode
private final MemoryAnchorNode memoryAnchor
private final ArrayList<StateSplit> sideEffectNodes
StateSplit.stateAfter()
from the replacee during
instantiation.private final ArrayList<DeoptimizingNode> deoptNodes
FrameState
from the replacee during
instantiation.private final ArrayList<ValueNode> stampNodes
ValueNode.stamp()
from the replacee during instantiation.private final ArrayList<Node> nodes
private final DebugTimer instantiationTimer
private final DebugMetric instantiationCounter
public static final SnippetTemplate.UsageReplacer DEFAULT_REPLACER
usage replacer
logic which simply delegates to
Node.replaceAtUsages(Node)
.protected SnippetTemplate(Providers providers, SnippetReflectionProvider snippetReflection, SnippetTemplate.Arguments args)
public static boolean hasConstantParameter(ResolvedJavaMethod method)
Snippet.ConstantParameter
.protected Object[] getConstantArgs(SnippetTemplate.Arguments args)
private static boolean checkAllVarargPlaceholdersAreDeleted(int parameterCount, SnippetTemplate.VarargsPlaceholderNode[] placeholders)
private static boolean checkConstantArgument(MetaAccessProvider metaAccess, ResolvedJavaMethod method, Signature signature, int i, String name, Object arg, Kind kind)
private static boolean checkVarargs(MetaAccessProvider metaAccess, ResolvedJavaMethod method, Signature signature, int i, String name, SnippetTemplate.Varargs varargs)
private Map<Node,Node> bind(StructuredGraph replaceeGraph, MetaAccessProvider metaAccess, SnippetTemplate.Arguments args)
protected JavaConstant forBoxed(Object argument, Kind localKind)
JavaConstant
of the right kind. This adjusts for the
limitation that a Local
's kind is a stack kind and
so cannot be used for re-boxing primitives smaller than an int.argument
- a Java boxed valuelocalKind
- the kind of the Local
to which argument
will be boundprivate boolean assertSnippetKills(ValueNode replacee)
private void rewireMemoryGraph(ValueNode replacee, Map<Node,Node> duplicates)
private static LocationIdentity getLocationIdentity(Node node)
private void replaceMemoryUsages(ValueNode node, MemoryMap map)
public Map<Node,Node> instantiate(MetaAccessProvider metaAccess, FixedNode replacee, SnippetTemplate.UsageReplacer replacer, SnippetTemplate.Arguments args)
metaAccess
- replacee
- the node that will be replacedreplacer
- object that replaces the usages of replacee
args
- the arguments to be bound to the flattened positional parameters of the snippetprivate void propagateStamp(Node node)
private void updateStamps(ValueNode replacee, Map<Node,Node> duplicates)
public StructuredGraph copySpecializedGraph()
public void instantiate(MetaAccessProvider metaAccess, FloatingNode replacee, SnippetTemplate.UsageReplacer replacer, LoweringTool tool, SnippetTemplate.Arguments args)
metaAccess
- replacee
- the node that will be replacedreplacer
- object that replaces the usages of replacee
args
- the arguments to be bound to the flattened positional parameters of the snippetprivate static boolean checkTemplate(MetaAccessProvider metaAccess, SnippetTemplate.Arguments args, ResolvedJavaMethod method, Signature signature)