public class GraphDecoder extends Object
encoded graphs
produced by GraphEncoder
. Support for
loop explosion during decoding is built into this class, because it requires many interactions
with the decoding process. Subclasses can provide canonicalization and simplification of nodes
during decoding, as well as method inlining during decoding.Modifier and Type | Class and Description |
---|---|
protected static class |
GraphDecoder.InvokeData
Additional information encoded for
Invoke nodes to allow method inlining without
decoding the frame state and successors beforehand. |
static class |
GraphDecoder.LoopExplosionKind |
protected static class |
GraphDecoder.LoopExplosionState |
protected static class |
GraphDecoder.LoopScope
Decoding state maintained for each loop in the encoded graph.
|
protected class |
GraphDecoder.MethodScope
Decoding state maintained for each encoded graph.
|
Modifier and Type | Field and Description |
---|---|
protected Architecture |
architecture |
Constructor and Description |
---|
GraphDecoder(Architecture architecture) |
Modifier and Type | Method and Description |
---|---|
protected Node |
addFloatingNode(GraphDecoder.MethodScope methodScope,
Node node) |
private static void |
addLoopExits(StructuredGraph currentGraph,
LoopBeginNode loopBegin,
LoopBeginNode inner,
IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap,
NodeBitMap visited) |
protected boolean |
allowLazyPhis() |
private static LoopBeginNode |
appendLoopBegin(StructuredGraph currentGraph,
FixedWithNextNode fixedWithNext) |
protected void |
checkLoopExplosionIteration(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope)
Hook for subclasses.
|
protected void |
cleanupGraph(GraphDecoder.MethodScope methodScope,
Graph.Mark start)
Removes unnecessary nodes from the graph after decoding.
|
protected void |
decode(GraphDecoder.MethodScope methodScope,
FixedWithNextNode startNode) |
void |
decode(StructuredGraph graph,
EncodedGraph encodedGraph) |
protected Node |
decodeFloatingNode(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
int nodeOrderId)
Decodes a non-fixed node, but does not do any post-processing and does not register it.
|
protected void |
detectLoops(StructuredGraph currentGraph,
FixedNode startInstruction) |
protected Node |
ensureNodeCreated(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
int nodeOrderId) |
protected void |
handleFixedNode(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
int nodeOrderId,
FixedNode node)
Hook for subclasses.
|
protected Node |
handleFloatingNodeAfterAdd(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
Node node)
Hook for subclasses to process a non-fixed node after it is added to the graph.
|
protected Node |
handleFloatingNodeBeforeAdd(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
Node node)
Hook for subclasses to process a non-fixed node before it is added to the graph.
|
protected void |
handleInvoke(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
GraphDecoder.InvokeData invokeData)
|
protected void |
handleLoopExplosionBegin(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
LoopBeginNode loopBegin) |
protected FixedNode |
handleLoopExplosionEnd(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
LoopEndNode loopEnd) |
protected void |
handleLoopExplosionProxyNodes(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
LoopExitNode loopExit,
int loopExitOrderId) |
protected void |
handlePhiFunctions(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope phiInputScope,
GraphDecoder.LoopScope phiNodeScope,
AbstractEndNode end,
AbstractMergeNode merge) |
protected void |
handleProxyNodes(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
LoopExitNode loopExit) |
private static void |
insertLoopEnds(StructuredGraph currentGraph,
FixedNode startInstruction) |
private static void |
insertLoopExits(StructuredGraph currentGraph,
LoopBeginNode loopBegin,
IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap) |
protected Node |
instantiateNode(GraphDecoder.MethodScope methodScope,
int nodeOrderId) |
protected Node |
lookupNode(GraphDecoder.LoopScope loopScope,
int nodeOrderId) |
protected void |
makeInputNodes(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
Node node,
boolean updateUsages)
Process the input edges of a node.
|
protected FixedNode |
makeStubNode(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
int nodeOrderId) |
protected void |
makeSuccessorStubs(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope,
Node node,
boolean updatePredecessors)
Process successor edges of a node.
|
protected GraphDecoder.LoopScope |
processNextNode(GraphDecoder.MethodScope methodScope,
GraphDecoder.LoopScope loopScope) |
private static void |
propagateCreatedNodes(GraphDecoder.LoopScope loopScope) |
private GraphDecoder.InvokeData |
readInvokeData(GraphDecoder.MethodScope methodScope,
int invokeOrderId,
Invoke invoke) |
protected Object |
readObject(GraphDecoder.MethodScope methodScope) |
protected int |
readOrderId(GraphDecoder.MethodScope methodScope) |
protected void |
readProperties(GraphDecoder.MethodScope methodScope,
Node node) |
protected void |
registerNode(GraphDecoder.LoopScope loopScope,
int nodeOrderId,
Node node,
boolean allowOverwrite,
boolean allowNull) |
protected static boolean |
skipEdge(Node node,
Edges edges,
int index,
boolean direct,
boolean decode)
Returns false for
Edges that are not necessary in the encoded graph because they are
reconstructed using other sources of information. |
protected boolean |
verifyEdges(GraphDecoder.MethodScope methodScope) |
protected final Architecture architecture
public GraphDecoder(Architecture architecture)
public final void decode(StructuredGraph graph, EncodedGraph encodedGraph)
protected final void decode(GraphDecoder.MethodScope methodScope, FixedWithNextNode startNode)
private static void propagateCreatedNodes(GraphDecoder.LoopScope loopScope)
protected GraphDecoder.LoopScope processNextNode(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope)
private GraphDecoder.InvokeData readInvokeData(GraphDecoder.MethodScope methodScope, int invokeOrderId, Invoke invoke)
protected void handleInvoke(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, GraphDecoder.InvokeData invokeData)
Invoke
nodes do not have the CallTargetNode
, FrameState
, and
successors encoded. Instead, this information is provided separately to allow method inlining
without decoding and adding them to the graph upfront. For non-inlined methods, this method
restores the normal state. Subclasses can override it to perform method inlining.protected void handleLoopExplosionBegin(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, LoopBeginNode loopBegin)
protected void checkLoopExplosionIteration(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope)
methodScope
- The current method.loopScope
- The current loop.protected FixedNode handleLoopExplosionEnd(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, LoopEndNode loopEnd)
protected void handleFixedNode(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, int nodeOrderId, FixedNode node)
methodScope
- The current method.loopScope
- The current loop.nodeOrderId
- The orderId of the node.node
- The node to be simplified.protected void handleProxyNodes(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, LoopExitNode loopExit)
protected void handleLoopExplosionProxyNodes(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, LoopExitNode loopExit, int loopExitOrderId)
protected void handlePhiFunctions(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope phiInputScope, GraphDecoder.LoopScope phiNodeScope, AbstractEndNode end, AbstractMergeNode merge)
protected boolean allowLazyPhis()
protected Node instantiateNode(GraphDecoder.MethodScope methodScope, int nodeOrderId)
protected void readProperties(GraphDecoder.MethodScope methodScope, Node node)
protected void makeInputNodes(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, Node node, boolean updateUsages)
protected Node ensureNodeCreated(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, int nodeOrderId)
protected Node addFloatingNode(GraphDecoder.MethodScope methodScope, Node node)
protected Node decodeFloatingNode(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, int nodeOrderId)
protected Node handleFloatingNodeBeforeAdd(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, Node node)
methodScope
- The current method.loopScope
- The current loop.node
- The node to be canonicalized.protected Node handleFloatingNodeAfterAdd(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, Node node)
methodScope
- The current method.loopScope
- The current loop.node
- The node to be canonicalized.protected void makeSuccessorStubs(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, Node node, boolean updatePredecessors)
processNextNode(com.oracle.graal.nodes.GraphDecoder.MethodScope, com.oracle.graal.nodes.GraphDecoder.LoopScope)
.protected FixedNode makeStubNode(GraphDecoder.MethodScope methodScope, GraphDecoder.LoopScope loopScope, int nodeOrderId)
protected static boolean skipEdge(Node node, Edges edges, int index, boolean direct, boolean decode)
Edges
that are not necessary in the encoded graph because they are
reconstructed using other sources of information.protected Node lookupNode(GraphDecoder.LoopScope loopScope, int nodeOrderId)
protected void registerNode(GraphDecoder.LoopScope loopScope, int nodeOrderId, Node node, boolean allowOverwrite, boolean allowNull)
protected int readOrderId(GraphDecoder.MethodScope methodScope)
protected Object readObject(GraphDecoder.MethodScope methodScope)
protected void detectLoops(StructuredGraph currentGraph, FixedNode startInstruction)
private static LoopBeginNode appendLoopBegin(StructuredGraph currentGraph, FixedWithNextNode fixedWithNext)
private static void insertLoopEnds(StructuredGraph currentGraph, FixedNode startInstruction)
private static void insertLoopExits(StructuredGraph currentGraph, LoopBeginNode loopBegin, IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap)
private static void addLoopExits(StructuredGraph currentGraph, LoopBeginNode loopBegin, LoopBeginNode inner, IdentityHashMap<LoopBeginNode,List<LoopBeginNode>> innerLoopsMap, NodeBitMap visited)
protected void cleanupGraph(GraphDecoder.MethodScope methodScope, Graph.Mark start)
methodScope
- The current method.start
- Marker for the begin of the current method in the graph.protected boolean verifyEdges(GraphDecoder.MethodScope methodScope)