public class GraphKit extends CoreProvidersDelegate implements GraphBuilderTool
| Modifier and Type | Class and Description |
|---|---|
protected static class |
GraphKit.IfState |
protected static class |
GraphKit.Structure |
| Modifier and Type | Field and Description |
|---|---|
protected StructuredGraph |
graph |
protected GraphBuilderConfiguration.Plugins |
graphBuilderPlugins |
protected FixedWithNextNode |
lastFixedNode |
protected WordTypes |
wordTypes |
| Constructor and Description |
|---|
GraphKit(DebugContext debug,
ResolvedJavaMethod stubMethod,
Providers providers,
WordTypes wordTypes,
GraphBuilderConfiguration.Plugins graphBuilderPlugins,
CompilationIdentifier compilationId,
String name,
boolean trackNodeSourcePosition,
boolean recordInlinedMethods) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ValueNode> |
add(T node) |
<T extends ValueNode> |
append(T node)
Adds the given node to the graph and also adds recursively all referenced inputs.
|
JavaKind |
asKind(JavaType type) |
<T extends ValueNode> |
changeToWord(T node) |
boolean |
checkArgs(ResolvedJavaMethod method,
ValueNode... args)
Determines if a given set of arguments is compatible with the signature of a given method.
|
protected ExceptionObjectNode |
createExceptionObjectNode(FrameStateBuilder frameStateBuilder,
int exceptionEdgeBci) |
protected GraphBuilderPhase.Instance |
createGraphBuilderInstance(GraphBuilderConfiguration graphBuilderConfig,
OptimisticOptimizations optimisticOpts,
IntrinsicContext initialIntrinsicContext) |
InvokeNode |
createIntrinsicInvoke(ResolvedJavaMethod method,
ValueNode... args) |
InvokeNode |
createInvoke(Class<?> declaringClass,
String name,
CallTargetNode.InvokeKind invokeKind,
FrameStateBuilder frameStateBuilder,
int bci,
ValueNode... args)
Creates and appends an
InvokeNode for a call to a given method with a given set of
arguments. |
InvokeNode |
createInvoke(Class<?> declaringClass,
String name,
ValueNode... args) |
InvokeNode |
createInvoke(ResolvedJavaMethod method,
CallTargetNode.InvokeKind invokeKind,
FrameStateBuilder frameStateBuilder,
int bci,
ValueNode... args)
Creates and appends an
InvokeNode for a call to a given method with a given set of
arguments. |
InvokeWithExceptionNode |
createInvokeWithExceptionAndUnwind(MethodCallTargetNode callTarget,
FrameStateBuilder frameStateBuilder,
int invokeBci) |
InvokeWithExceptionNode |
createInvokeWithExceptionAndUnwind(ResolvedJavaMethod method,
CallTargetNode.InvokeKind invokeKind,
FrameStateBuilder frameStateBuilder,
int invokeBci,
ValueNode... args) |
protected MethodCallTargetNode |
createMethodCallTarget(CallTargetNode.InvokeKind invokeKind,
ResolvedJavaMethod targetMethod,
ValueNode[] args,
StampPair returnStamp,
int bci) |
void |
elsePart() |
AbstractMergeNode |
endIf()
Ends an if block started with
#startIf(LogicNode, BranchProbabilityData). |
AbstractMergeNode |
endInvokeWithException()
|
ExceptionObjectNode |
exceptionObject() |
void |
exceptionPart() |
ResolvedJavaMethod |
findMethod(Class<?> declaringClass,
String name,
boolean isStatic) |
ResolvedJavaMethod |
findMethod(Class<?> declaringClass,
String name,
Class<?>... parameterTypes) |
StructuredGraph |
getGraph()
Gets the graph being constructed.
|
protected <T extends GraphKit.Structure> |
getTopStructure(Class<T> expectedClass) |
void |
inline(Invoke invoke,
String reason,
String phase) |
void |
inlineAsIntrinsic(Invoke invoke,
String reason,
String phase)
Inlines a given invocation to a method.
|
void |
inlineInvokesAsIntrinsics(String reason,
String phase)
Recursively inlines all invocations currently in the graph.
|
void |
noExceptionPart() |
boolean |
parsingIntrinsic()
Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
by an intrinsic.
|
protected void |
popStructure() |
protected void |
pushStructure(GraphKit.Structure structure) |
protected void |
setStateAfterException(FrameStateBuilder frameStateBuilder,
int exceptionEdgeBci,
StateSplit exceptionObject,
boolean rethrow) |
IfNode |
startIf(LogicNode condition,
ProfileData.BranchProbabilityData profileData)
Starts an if-block.
|
InvokeWithExceptionNode |
startInvokeWithException(CallTargetNode callTarget,
FrameStateBuilder frameStateBuilder,
int invokeBci) |
InvokeWithExceptionNode |
startInvokeWithException(ResolvedJavaMethod method,
CallTargetNode.InvokeKind invokeKind,
FrameStateBuilder frameStateBuilder,
int invokeBci,
ValueNode... args) |
void |
thenPart() |
<T extends FloatingNode & Node.ValueNumberable> |
unique(T node)
Ensures a floating node is added to or already present in the graph via
Graph.unique(T). |
Stamp |
wordStamp(ResolvedJavaType type) |
getConstantFieldProvider, getConstantReflection, getForeignCalls, getLoopsDataProvider, getLowerer, getMetaAccess, getMetaAccessExtensionProvider, getPlatformConfigurationProvider, getProviders, getReplacements, getStampProvider, getWordVerificationclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanDeferPlugin, getAssumptions, getDebug, getOptions, shouldDeferPlugingetConstantFieldProvider, getConstantReflection, getForeignCalls, getLoopsDataProvider, getLowerer, getMetaAccess, getMetaAccessExtensionProvider, getPlatformConfigurationProvider, getReplacements, getStampProvider, getWordVerificationprotected final StructuredGraph graph
protected final WordTypes wordTypes
protected final GraphBuilderConfiguration.Plugins graphBuilderPlugins
protected FixedWithNextNode lastFixedNode
public GraphKit(DebugContext debug, ResolvedJavaMethod stubMethod, Providers providers, WordTypes wordTypes, GraphBuilderConfiguration.Plugins graphBuilderPlugins, CompilationIdentifier compilationId, String name, boolean trackNodeSourcePosition, boolean recordInlinedMethods)
public StructuredGraph getGraph()
GraphBuilderToolgetGraph in interface GraphBuilderToolpublic boolean parsingIntrinsic()
GraphBuilderToolparsingIntrinsic in interface GraphBuilderToolpublic <T extends FloatingNode & Node.ValueNumberable> T unique(T node)
Graph.unique(T).node if one exists, otherwise nodepublic <T extends ValueNode> T add(T node)
public <T extends ValueNode> T changeToWord(T node)
public Stamp wordStamp(ResolvedJavaType type)
public final JavaKind asKind(JavaType type)
public <T extends ValueNode> T append(T node)
GraphBuilderToolappend in interface GraphBuilderToolnode - the node to be added to the graphpublic InvokeNode createInvoke(Class<?> declaringClass, String name, ValueNode... args)
public InvokeNode createInvoke(Class<?> declaringClass, String name, CallTargetNode.InvokeKind invokeKind, FrameStateBuilder frameStateBuilder, int bci, ValueNode... args)
InvokeNode for a call to a given method with a given set of
arguments. The method is looked up via reflection based on the declaring class and name.declaringClass - the class declaring the invoked methodname - the name of the invoked methodargs - the arguments to the invocationpublic ResolvedJavaMethod findMethod(Class<?> declaringClass, String name, boolean isStatic)
public ResolvedJavaMethod findMethod(Class<?> declaringClass, String name, Class<?>... parameterTypes)
public InvokeNode createInvoke(ResolvedJavaMethod method, CallTargetNode.InvokeKind invokeKind, FrameStateBuilder frameStateBuilder, int bci, ValueNode... args)
InvokeNode for a call to a given method with a given set of
arguments.public InvokeNode createIntrinsicInvoke(ResolvedJavaMethod method, ValueNode... args)
public InvokeWithExceptionNode createInvokeWithExceptionAndUnwind(ResolvedJavaMethod method, CallTargetNode.InvokeKind invokeKind, FrameStateBuilder frameStateBuilder, int invokeBci, ValueNode... args)
public InvokeWithExceptionNode createInvokeWithExceptionAndUnwind(MethodCallTargetNode callTarget, FrameStateBuilder frameStateBuilder, int invokeBci)
protected MethodCallTargetNode createMethodCallTarget(CallTargetNode.InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, StampPair returnStamp, int bci)
public boolean checkArgs(ResolvedJavaMethod method,
ValueNode... args)
args are compatible with the signature if methodAssertionError - if args are not compatible with the signature if
methodpublic void inlineInvokesAsIntrinsics(String reason, String phase)
public void inlineAsIntrinsic(Invoke invoke, String reason, String phase)
protected GraphBuilderPhase.Instance createGraphBuilderInstance(GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts, IntrinsicContext initialIntrinsicContext)
protected void pushStructure(GraphKit.Structure structure)
protected <T extends GraphKit.Structure> T getTopStructure(Class<T> expectedClass)
protected void popStructure()
public IfNode startIf(LogicNode condition, ProfileData.BranchProbabilityData profileData)
GraphKit.thenPart() to start
emitting the code executed when the condition hold; and a call to GraphKit.elsePart() to start
emititng the code when the condition does not hold. It must be followed by a call to
GraphKit.endIf() to close the if-block.condition - The condition for the if-blockprofileData - The estimated probability the condition is trueIfNode.public void thenPart()
public void elsePart()
public AbstractMergeNode endIf()
#startIf(LogicNode, BranchProbabilityData).null if no merge node was required (for example,
when one part ended with a control sink).public InvokeWithExceptionNode startInvokeWithException(ResolvedJavaMethod method, CallTargetNode.InvokeKind invokeKind, FrameStateBuilder frameStateBuilder, int invokeBci, ValueNode... args)
public InvokeWithExceptionNode startInvokeWithException(CallTargetNode callTarget, FrameStateBuilder frameStateBuilder, int invokeBci)
protected ExceptionObjectNode createExceptionObjectNode(FrameStateBuilder frameStateBuilder, int exceptionEdgeBci)
protected void setStateAfterException(FrameStateBuilder frameStateBuilder, int exceptionEdgeBci, StateSplit exceptionObject, boolean rethrow)
public void noExceptionPart()
public void exceptionPart()
public ExceptionObjectNode exceptionObject()
public AbstractMergeNode endInvokeWithException()
GraphKit.startInvokeWithException(ResolvedJavaMethod, org.graalvm.compiler.nodes.CallTargetNode.InvokeKind, org.graalvm.compiler.java.FrameStateBuilder, int, org.graalvm.compiler.nodes.ValueNode...). If necessary, creates
a merge of the non-exception and exception edges. The merge node is returned and the
non-exception edge is the first forward end of the merge, the exception edge is the second
forward end (relevant for phi nodes).