public interface GraphBuilderContext extends GraphBuilderTool
GraphBuilderPlugin to interface with an object that parses the bytecode of a
single method as part of building a graph .| Modifier and Type | Interface and Description |
|---|---|
static interface |
GraphBuilderContext.ExternalInliningContext
Interface whose instances hold inlining information about the current context, in a wider
sense.
|
| Modifier and Type | Method and Description |
|---|---|
default <T extends ValueNode> |
add(T value)
Adds a node and all its inputs to the graph.
|
default ValueNode |
addNonNullCast(ValueNode value) |
default <T extends ValueNode> |
addPush(JavaKind kind,
T value)
Adds a node with a non-void kind to the graph, pushes it to the stack.
|
default boolean |
allowDeoptInPlugins()
When this returns false, the parser will report an error if an
InvocationPlugin
inserts a DeoptimizeNode or FixedGuardNode. |
BailoutException |
bailout(String string) |
int |
bci()
Gets the index of the bytecode instruction currently being parsed.
|
default boolean |
bciCanBeDuplicated() |
default boolean |
canMergeIntrinsicReturns()
Some
InvocationPlugins have to build a MergeNode to handle
multiple return paths but not all contexts can do this. |
default AbstractBeginNode |
emitBytecodeExceptionCheck(LogicNode condition,
boolean passingOnTrue,
BytecodeExceptionNode.BytecodeExceptionKind exceptionKind,
ValueNode... arguments) |
default void |
genCheckcastDynamic(ValueNode object,
ValueNode javaClass) |
default AbstractBeginNode |
genExplicitExceptionEdge(BytecodeExceptionNode.BytecodeExceptionKind exceptionKind,
ValueNode... exceptionArguments)
Generates an exception edge for the current bytecode.
|
Bytecode |
getCode()
Gets the code being parsed.
|
default int |
getDepth()
Gets the inline depth of this context.
|
default GraphBuilderContext.ExternalInliningContext |
getExternalInliningContext() |
IntrinsicContext |
getIntrinsic()
Gets the intrinsic of the current parsing context or
null if not
parsing an intrinsic. |
default FrameState |
getInvocationPluginBeforeState()
Build a FrameState that represents the represents the state before an intrinsic was invoked.
|
default FrameState |
getInvocationPluginReturnState(JavaKind returnKind,
ValueNode returnValue)
Build a FrameState that represents the return from an intrinsic with
returnValue on
the top of stack. |
CallTargetNode.InvokeKind |
getInvokeKind()
Gets the kind of invocation currently being parsed.
|
default StampPair |
getInvokeReturnStamp(Assumptions assumptions) |
JavaType |
getInvokeReturnType()
Gets the return type of the invocation currently being parsed.
|
ResolvedJavaMethod |
getMethod()
Gets the method being parsed by this context.
|
default GraphBuilderContext |
getNonIntrinsicAncestor()
Gets the first ancestor parsing context that is not parsing a intrinsic.
|
GraphBuilderContext |
getParent()
Gets the parsing context for the method that inlines the method being parsed by this context.
|
Invoke |
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 |
handleReplacedInvoke(CallTargetNode callTarget,
JavaKind resultType) |
default GuardingNode |
intrinsicRangeCheck(LogicNode condition,
boolean negated)
Emit a range check for an intrinsic.
|
default Invoke |
invokeFallback(FixedWithNextNode predecessor,
EndNode end) |
boolean |
isParsingInvocationPlugin() |
default boolean |
isPluginEnabled(GraphBuilderPlugin plugin)
Determines if a graph builder plugin is enabled under current context.
|
default ValueNode |
maskSubWordValue(ValueNode value,
JavaKind kind)
Adds masking to a given subword value according to a given , such that the
masked value falls in the range of the given kind.
|
default GuardingNode |
maybeEmitExplicitDivisionByZeroCheck(ValueNode divisor) |
default ValueNode |
maybeEmitExplicitNegativeArraySizeCheck(ValueNode arrayLength) |
default ValueNode |
maybeEmitExplicitNegativeArraySizeCheck(ValueNode arrayLength,
BytecodeExceptionNode.BytecodeExceptionKind exceptionKind)
When
GraphBuilderContext.needsExplicitException() is true, the method returns a node with a stamp that is
always positive and emits code that throws the provided exceptionKind for a negative length. |
default boolean |
needsExplicitException() |
default ValueNode |
nullCheckedValue(ValueNode value) |
default ValueNode |
nullCheckedValue(ValueNode value,
DeoptimizationAction action)
Gets a version of a given value that has a non-null stamp.
|
default boolean |
parsingIntrinsic()
Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
by an intrinsic.
|
default ValueNode |
pop(JavaKind slotKind)
Pops a value from the frame state stack using an explicit kind.
|
default ValueNode[] |
popArguments(int argSize) |
void |
push(JavaKind kind,
ValueNode value)
Pushes a given value to the frame state stack using an explicit kind.
|
default int |
recursiveInliningDepth(ResolvedJavaMethod method)
Computes the recursive inlining depth of the provided method, i.e., counts how often the
provided method is already in the
GraphBuilderContext.getParent() chain starting at this context. |
default void |
replacePlugin(GeneratedInvocationPlugin plugin,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
PluginReplacementNode.ReplacementFunction replacementFunction)
Replaces an invocation of a given method by inserting a
PluginReplacementNode that
defers the application of an
InvocationPlugin. |
default void |
replacePluginWithException(GeneratedInvocationPlugin plugin,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
PluginReplacementWithExceptionNode.ReplacementWithExceptionFunction replacementFunction)
Replaces an invocation of a given method by inserting a
PluginReplacementWithExceptionNode that
defers the application of an
InvocationPlugin. |
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.
|
append, canDeferPlugin, getAssumptions, getDebug, getGraph, getOptions, shouldDeferPlugingetConstantFieldProvider, getConstantReflection, getForeignCalls, getLoopsDataProvider, getLowerer, getMetaAccess, getMetaAccessExtensionProvider, getPlatformConfigurationProvider, getReplacements, getStampProvider, getWordVerificationvoid push(JavaKind kind,
ValueNode value)
value.getJavaKind() is different from the kind that the bytecode instruction
currently being parsed pushes to the stack.kind - the kind to use when type checking this operationvalue - the value to push to the stack. The value must already have been
appended.default ValueNode pop(JavaKind slotKind)
slotKind - the kind to use when type checking this operationdefault ValueNode[] popArguments(int argSize)
default <T extends ValueNode> T add(T value)
StateSplit with a null
frame state , the frame state is initialized.value - the value to add to the graph. The value.getJavaKind() kind is used when
type checking this operation.value in the graphdefault <T extends ValueNode> T addPush(JavaKind kind, T value)
StateSplit with a null frame state, the
frame state is initialized.kind - the kind to use when type checking this operationvalue - the value to add to the graph and push to the stackvalue in the graphInvoke handleReplacedInvoke(CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, boolean forceInlineEverything)
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 inlinedvoid handleReplacedInvoke(CallTargetNode callTarget, JavaKind resultType)
void setStateAfter(StateSplit sideEffect)
sideEffect - a side effect node just appended to the graphGraphBuilderContext getParent()
default GraphBuilderContext getNonIntrinsicAncestor()
Bytecode getCode()
ResolvedJavaMethod getMethod()
int bci()
default boolean bciCanBeDuplicated()
CallTargetNode.InvokeKind getInvokeKind()
JavaType getInvokeReturnType()
default StampPair getInvokeReturnStamp(Assumptions assumptions)
default int getDepth()
default int recursiveInliningDepth(ResolvedJavaMethod method)
GraphBuilderContext.getParent() chain starting at this context.default boolean parsingIntrinsic()
parsingIntrinsic in interface GraphBuilderTooldefault boolean isPluginEnabled(GraphBuilderPlugin plugin)
IntrinsicContext getIntrinsic()
null if not
parsing an intrinsic.boolean isParsingInvocationPlugin()
BailoutException bailout(String string)
default GuardingNode intrinsicRangeCheck(LogicNode condition, boolean negated)
default ValueNode nullCheckedValue(ValueNode value, DeoptimizationAction action)
default ValueNode maybeEmitExplicitNegativeArraySizeCheck(ValueNode arrayLength, BytecodeExceptionNode.BytecodeExceptionKind exceptionKind)
GraphBuilderContext.needsExplicitException() is true, the method returns a node with a stamp that is
always positive and emits code that throws the provided exceptionKind for a negative length.default ValueNode maybeEmitExplicitNegativeArraySizeCheck(ValueNode arrayLength)
default GuardingNode maybeEmitExplicitDivisionByZeroCheck(ValueNode divisor)
default AbstractBeginNode emitBytecodeExceptionCheck(LogicNode condition, boolean passingOnTrue, BytecodeExceptionNode.BytecodeExceptionKind exceptionKind, ValueNode... arguments)
default boolean canMergeIntrinsicReturns()
InvocationPlugins have to build a MergeNode to handle
multiple return paths but not all contexts can do this.GraphBuilderContext.getInvocationPluginReturnState(JavaKind, ValueNode) cannot be
called (i.e. it unconditionally raises an error)default FrameState getInvocationPluginReturnState(JavaKind returnKind, ValueNode returnValue)
returnValue on
the top of stack. Usually this will be a state in the caller after the call site.default FrameState getInvocationPluginBeforeState()
default boolean allowDeoptInPlugins()
InvocationPlugin
inserts a DeoptimizeNode or FixedGuardNode.default Invoke invokeFallback(FixedWithNextNode predecessor, EndNode end)
default GraphBuilderContext.ExternalInliningContext getExternalInliningContext()
default ValueNode maskSubWordValue(ValueNode value, JavaKind kind)
value - the value to be maskedkind - the kind that specifies the range of the masked valuedefault boolean needsExplicitException()
default AbstractBeginNode genExplicitExceptionEdge(BytecodeExceptionNode.BytecodeExceptionKind exceptionKind, ValueNode... exceptionArguments)
GraphBuilderContext.needsExplicitException()
returns true, this method should return non-null begin nodes.exceptionKind - the type of exception to be created.exceptionArguments - the arguments for the exception.default void replacePlugin(GeneratedInvocationPlugin plugin, ResolvedJavaMethod targetMethod, ValueNode[] args, PluginReplacementNode.ReplacementFunction replacementFunction)
PluginReplacementNode that
defers the application of an
InvocationPlugin.plugin - the InvocationPlugin that is deferredtargetMethod - the target of the replacement invocationargs - the arguments to the replacement invocationreplacementFunction - the replacement function for deferred application of the
plugindefault void replacePluginWithException(GeneratedInvocationPlugin plugin, ResolvedJavaMethod targetMethod, ValueNode[] args, PluginReplacementWithExceptionNode.ReplacementWithExceptionFunction replacementFunction)
PluginReplacementWithExceptionNode that
defers the application of an
InvocationPlugin.plugin - the InvocationPlugin that is deferredtargetMethod - the target of the replacement invocationargs - the arguments to the replacement invocationreplacementFunction - the replacement function for deferred application of the
plugin