public class IntrinsicGraphBuilder extends Object implements GraphBuilderContext, InvocationPlugin.Receiver
GraphBuilderContext
used to produce a graph for a method based on an
InvocationPlugin
for the method.Modifier and Type | Field and Description |
---|---|
private ValueNode[] |
arguments |
private ConstantReflectionProvider |
constantReflection |
private StructuredGraph |
graph |
private int |
invokeBci |
private FixedWithNextNode |
lastInstr |
private MetaAccessProvider |
metaAccess |
private ResolvedJavaMethod |
method |
private ValueNode |
returnValue |
private StampProvider |
stampProvider |
Constructor and Description |
---|
IntrinsicGraphBuilder(MetaAccessProvider metaAccess,
ConstantReflectionProvider constantReflection,
StampProvider stampProvider,
ResolvedJavaMethod method,
int invokeBci) |
Modifier and Type | Method and Description |
---|---|
<T extends ValueNode> |
append(T v)
Raw operation for adding a node to the graph when neither
GraphBuilderContext.add(T) nor
GraphBuilderContext.addPush(Kind, ValueNode) can be used. |
BailoutException |
bailout(String string) |
int |
bci()
Gets the index of the bytecode instruction currently being parsed.
|
StructuredGraph |
buildGraph(InvocationPlugin plugin) |
ValueNode |
get()
Gets the receiver value, null checking it first if necessary.
|
ConstantReflectionProvider |
getConstantReflection() |
int |
getDepth()
Gets the inline depth of this context.
|
StructuredGraph |
getGraph()
Gets the graph being constructed.
|
IntrinsicContext |
getIntrinsic()
Gets the intrinsic of the current parsing context or
null if not
parsing an intrinsic . |
CallTargetNode.InvokeKind |
getInvokeKind()
Gets the kind of invocation currently being parsed.
|
JavaType |
getInvokeReturnType()
Gets the return type of the invocation currently being parsed.
|
MetaAccessProvider |
getMetaAccess() |
ResolvedJavaMethod |
getMethod()
Gets the method being parsed by this context.
|
GraphBuilderContext |
getParent()
Gets the parsing context for the method that inlines the method being parsed by this context.
|
StampProvider |
getStampProvider() |
void |
handleReplacedInvoke(CallTargetNode.InvokeKind invokeKind,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
boolean forceInlineEverything)
Handles an invocation that a plugin determines can replace the original invocation (i.e., the
one for which the plugin was applied).
|
void |
intrinsify(ResolvedJavaMethod targetMethod,
ResolvedJavaMethod substitute,
ValueNode[] args)
Intrinsifies an invocation of a given method by inlining the bytecodes of a given
substitution method.
|
boolean |
parsingIntrinsic()
Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
by an intrinsic.
|
void |
push(Kind kind,
ValueNode value)
Pushes a given value to the frame state stack using an explicit kind.
|
<T extends ValueNode> |
recursiveAppend(T v)
Adds the given node to the graph and also adds recursively all referenced inputs.
|
void |
setStateAfter(StateSplit sideEffect)
Creates a snap shot of the current frame state with the BCI of the instruction after the one
currently being parsed and assigns it to a given side
effect node.
|
String |
toString() |
private <T extends ValueNode> |
updateLastInstruction(T v) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, addPush, getAssumptions, getInvokeReturnStamp, getNonIntrinsicAncestor, nullCheckedValue
isConstant
private final MetaAccessProvider metaAccess
private final ConstantReflectionProvider constantReflection
private final StampProvider stampProvider
private final StructuredGraph graph
private final ResolvedJavaMethod method
private final int invokeBci
private FixedWithNextNode lastInstr
private ValueNode returnValue
public IntrinsicGraphBuilder(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, StampProvider stampProvider, ResolvedJavaMethod method, int invokeBci)
private <T extends ValueNode> void updateLastInstruction(T v)
public <T extends ValueNode> T append(T v)
GraphBuilderContext
GraphBuilderContext.add(T)
nor
GraphBuilderContext.addPush(Kind, ValueNode)
can be used.append
in interface GraphBuilderContext
public <T extends ValueNode> T recursiveAppend(T v)
GraphBuilderContext
recursiveAppend
in interface GraphBuilderContext
v
- the node to be added to the graphpublic void push(Kind kind, ValueNode value)
GraphBuilderContext
value.getKind()
is different from the kind that the bytecode instruction
currently being parsed pushes to the stack.push
in interface GraphBuilderContext
kind
- the kind to use when type checking this operationvalue
- the value to push to the stack. The value must already have been
appended.public void handleReplacedInvoke(CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, boolean forceInlineEverything)
GraphBuilderContext
handleReplacedInvoke
in interface GraphBuilderContext
invokeKind
- the kind of the replacement invocationtargetMethod
- the target of the replacement invocationargs
- the arguments to the replacement invocationforceInlineEverything
- specifies if all invocations encountered in the scope of
handling the replaced invoke are to be force inlinedpublic StampProvider getStampProvider()
getStampProvider
in interface GraphBuilderContext
public MetaAccessProvider getMetaAccess()
getMetaAccess
in interface GraphBuilderContext
public ConstantReflectionProvider getConstantReflection()
getConstantReflection
in interface GraphBuilderContext
public StructuredGraph getGraph()
GraphBuilderContext
getGraph
in interface GraphBuilderContext
public void setStateAfter(StateSplit sideEffect)
GraphBuilderContext
setStateAfter
in interface GraphBuilderContext
sideEffect
- a side effect node just appended to the graphpublic GraphBuilderContext getParent()
GraphBuilderContext
getParent
in interface GraphBuilderContext
public ResolvedJavaMethod getMethod()
GraphBuilderContext
getMethod
in interface GraphBuilderContext
public int bci()
GraphBuilderContext
bci
in interface GraphBuilderContext
public CallTargetNode.InvokeKind getInvokeKind()
GraphBuilderContext
getInvokeKind
in interface GraphBuilderContext
public JavaType getInvokeReturnType()
GraphBuilderContext
getInvokeReturnType
in interface GraphBuilderContext
public int getDepth()
GraphBuilderContext
getDepth
in interface GraphBuilderContext
public boolean parsingIntrinsic()
GraphBuilderContext
parsingIntrinsic
in interface GraphBuilderContext
public IntrinsicContext getIntrinsic()
GraphBuilderContext
null
if not
parsing an intrinsic
.getIntrinsic
in interface GraphBuilderContext
public BailoutException bailout(String string)
bailout
in interface GraphBuilderContext
public ValueNode get()
InvocationPlugin.Receiver
get
in interface InvocationPlugin.Receiver
public StructuredGraph buildGraph(InvocationPlugin plugin)
public void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args)
GraphBuilderContext
intrinsify
in interface GraphBuilderContext
targetMethod
- the method being intrinsifiedsubstitute
- the intrinsic implementationargs
- the arguments with which to inline the invocation