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, waitadd, addPush, getAssumptions, getInvokeReturnStamp, getNonIntrinsicAncestor, nullCheckedValueisConstantprivate 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)
GraphBuilderContextGraphBuilderContext.add(T) nor
GraphBuilderContext.addPush(Kind, ValueNode) can be used.append in interface GraphBuilderContextpublic <T extends ValueNode> T recursiveAppend(T v)
GraphBuilderContextrecursiveAppend in interface GraphBuilderContextv - the node to be added to the graphpublic void push(Kind kind, ValueNode value)
GraphBuilderContextvalue.getKind() is different from the kind that the bytecode instruction
currently being parsed pushes to the stack.push in interface GraphBuilderContextkind - 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)
GraphBuilderContexthandleReplacedInvoke in interface GraphBuilderContextinvokeKind - 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 GraphBuilderContextpublic MetaAccessProvider getMetaAccess()
getMetaAccess in interface GraphBuilderContextpublic ConstantReflectionProvider getConstantReflection()
getConstantReflection in interface GraphBuilderContextpublic StructuredGraph getGraph()
GraphBuilderContextgetGraph in interface GraphBuilderContextpublic void setStateAfter(StateSplit sideEffect)
GraphBuilderContextsetStateAfter in interface GraphBuilderContextsideEffect - a side effect node just appended to the graphpublic GraphBuilderContext getParent()
GraphBuilderContextgetParent in interface GraphBuilderContextpublic ResolvedJavaMethod getMethod()
GraphBuilderContextgetMethod in interface GraphBuilderContextpublic int bci()
GraphBuilderContextbci in interface GraphBuilderContextpublic CallTargetNode.InvokeKind getInvokeKind()
GraphBuilderContextgetInvokeKind in interface GraphBuilderContextpublic JavaType getInvokeReturnType()
GraphBuilderContextgetInvokeReturnType in interface GraphBuilderContextpublic int getDepth()
GraphBuilderContextgetDepth in interface GraphBuilderContextpublic boolean parsingIntrinsic()
GraphBuilderContextparsingIntrinsic in interface GraphBuilderContextpublic IntrinsicContext getIntrinsic()
GraphBuilderContextnull if not
parsing an intrinsic.getIntrinsic in interface GraphBuilderContextpublic BailoutException bailout(String string)
bailout in interface GraphBuilderContextpublic ValueNode get()
InvocationPlugin.Receiverget in interface InvocationPlugin.Receiverpublic StructuredGraph buildGraph(InvocationPlugin plugin)
public void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args)
GraphBuilderContextintrinsify in interface GraphBuilderContexttargetMethod - the method being intrinsifiedsubstitute - the intrinsic implementationargs - the arguments with which to inline the invocation