public abstract class SwitchNode extends ControlSplitNode
SwitchNode class is the base of both lookup and table switches.Node.ConstantNodeParameter, Node.EdgeVisitor, Node.IndirectCanonicalization, Node.InjectedNodeParameter, Node.Input, Node.NodeInsertionStackTrace, Node.NodeIntrinsic, Node.NodeIntrinsicFactory, Node.OptionalInput, Node.Successor, Node.ValueNumberable| Modifier and Type | Field and Description |
|---|---|
protected int[] |
keySuccessors |
protected ProfileData.SwitchProbabilityData |
profileData |
protected NodeSuccessorList<AbstractBeginNode> |
successors |
static NodeClass<SwitchNode> |
TYPE |
protected ValueNode |
value |
EMPTY_ARRAY, stampNODE_LIST, NOT_ITERABLE, TRACK_CREATION_POSITION, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges| Modifier | Constructor and Description |
|---|---|
protected |
SwitchNode(NodeClass<? extends SwitchNode> c,
ValueNode value,
AbstractBeginNode[] successors,
int[] keySuccessors,
ProfileData.SwitchProbabilityData profileData)
Constructs a new Switch.
|
| Modifier and Type | Method and Description |
|---|---|
AbstractBeginNode |
blockSuccessor(int i) |
int |
blockSuccessorCount() |
double |
defaultProbability()
Returns the probability of taking the default branch.
|
AbstractBeginNode |
defaultSuccessor()
Gets the successor corresponding to the default (fall through) case.
|
int |
defaultSuccessorIndex()
Returns the index of the default (fall through) successor of this switch.
|
protected NodeSize |
dynamicNodeSizeEstimate()
Node subclasses should override this method if they need to specify a dynamically calculated
NodeSize value. |
abstract boolean |
equalKeys(SwitchNode switchNode)
Returns true if the switch has the same keys in the same order as this switch.
|
NodeCycles |
estimatedNodeCycles() |
protected double[] |
getKeyProbabilities() |
int[] |
getKeySuccessors() |
AbstractBeginNode |
getPrimarySuccessor()
Primary successor of the control split.
|
ProfileData.SwitchProbabilityData |
getProfileData()
Returns the source of this node's knowledge about its successor probabilities.
|
int |
getSuccessorCount()
Returns the number of successors.
|
abstract Stamp |
getValueStampForSuccessor(AbstractBeginNode beginNode) |
abstract boolean |
isSorted() |
abstract Constant |
keyAt(int i)
The key at the specified position, encoded in a Constant.
|
abstract int |
keyCount()
The number of distinct keys in this switch.
|
double |
keyProbability(int i)
Returns the probability of the key at the given index.
|
AbstractBeginNode |
keySuccessor(int i)
Returns the successor for the key at the given index.
|
int |
keySuccessorIndex(int i)
Returns the index of the successor belonging to the key at the specified index.
|
protected void |
killOtherSuccessors(SimplifierTool tool,
int survivingEdge)
Delete all other successors except for the one reached by
survivingEdge. |
double |
probability(AbstractBeginNode successor) |
void |
setBlockSuccessor(int i,
AbstractBeginNode s) |
boolean |
setProbability(AbstractBeginNode successor,
ProfileData.BranchProbabilityData successorProfileData)
Attempts to set the probability for the given successor to the passed value (which has to be
in the range of 0.0 and 1.0).
|
boolean |
structureEquals(SwitchNode switchNode) |
ValueNode |
value() |
successorProbabilitiesasFixedNode, verifyasConstant, asJavaConstant, asNode, asSerializableConstant, checkReplaceAtUsagesInvariants, getStackKind, graph, hasUsagesOtherThan, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isDefaultConstant, isIllegalConstant, isJavaConstant, isNullConstant, isSerializableConstant, recursivelyDataFlowEqualsUpTo, setStamp, stamp, updateStamp, updateUsagesInterfaceafterClone, applyInputs, applySuccessors, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearNodeSourcePosition, clearSuccessors, copyWithInputs, copyWithInputs, dataFlowEquals, estimatedNodeSize, fail, formatTo, getCreationPosition, getDebug, getDebugProperties, getDebugProperties, getInsertionPosition, getNodeClass, getNodeSourcePosition, getOptions, getUsageCount, hasExactlyOneUsage, hashCode, hasMoreThanOneUsage, hasNoUsages, hasOnlyUsagesOfType, hasUsages, hasUsagesOfType, inputPositions, inputs, isAlive, isDeleted, isUnregistered, markDeleted, maybeNotifyZeroUsages, modCount, predecessor, pushInputs, removeUsage, replaceAllInputs, replaceAndDelete, replaceAtAllUsages, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsagesAndDelete, replaceAtUsagesAndDelete, replaceFirstInput, replaceFirstSuccessor, safeDelete, setCreationPosition, setInsertionPosition, setNodeSourcePosition, singleUsage, successorPositions, successors, toString, toString, updateNodeSourcePosition, updatePredecessor, updateUsages, usages, valueEquals, verifyEdges, verifyInputs, verifySourcePosition, withNodeSourcePositionclone, equals, getClass, notify, notifyAll, wait, wait, waitasNodepublic static final NodeClass<SwitchNode> TYPE
protected NodeSuccessorList<AbstractBeginNode> successors
protected ValueNode value
protected final int[] keySuccessors
protected ProfileData.SwitchProbabilityData profileData
protected SwitchNode(NodeClass<? extends SwitchNode> c, ValueNode value, AbstractBeginNode[] successors, int[] keySuccessors, ProfileData.SwitchProbabilityData profileData)
value - the instruction that provides the value to be switched oversuccessors - the list of successors of this switchprotected double[] getKeyProbabilities()
public int getSuccessorCount()
ControlSplitNodegetSuccessorCount in class ControlSplitNodepublic double probability(AbstractBeginNode successor)
probability in class ControlSplitNodepublic boolean setProbability(AbstractBeginNode successor, ProfileData.BranchProbabilityData successorProfileData)
ControlSplitNodeprofileData's profile source.setProbability in class ControlSplitNodepublic ProfileData.SwitchProbabilityData getProfileData()
ControlSplitNodegetProfileData in class ControlSplitNodepublic ValueNode value()
public abstract boolean isSorted()
public abstract int keyCount()
public abstract Constant keyAt(int i)
public boolean structureEquals(SwitchNode switchNode)
public abstract boolean equalKeys(SwitchNode switchNode)
public int keySuccessorIndex(int i)
public AbstractBeginNode keySuccessor(int i)
public double keyProbability(int i)
public double defaultProbability()
public int defaultSuccessorIndex()
public AbstractBeginNode blockSuccessor(int i)
public void setBlockSuccessor(int i,
AbstractBeginNode s)
public int blockSuccessorCount()
public AbstractBeginNode defaultSuccessor()
public AbstractBeginNode getPrimarySuccessor()
ControlSplitNodegetPrimarySuccessor in class ControlSplitNodeprotected void killOtherSuccessors(SimplifierTool tool, int survivingEdge)
survivingEdge.tool - survivingEdge - index of the edge in the SwitchNode.successors listpublic abstract Stamp getValueStampForSuccessor(AbstractBeginNode beginNode)
public NodeCycles estimatedNodeCycles()
estimatedNodeCycles in class Nodeprotected NodeSize dynamicNodeSizeEstimate()
NodeNodeSize value. If the node size is static please use NodeInfo.size().
NOTE: When overriding this method, make sure that *all* field reads are null checked (even if
Java semantics seemingly make the value of the field non-null). This is necessary because
node size estimates are needed even during graph decoding which, for some nodes, first
reflectively creates a stub and then later, reflectively, populates its fields. This method
could be invoked between these two points. For this reason, when overriding this method
assume that all fields can and will be null.dynamicNodeSizeEstimate in class Nodepublic int[] getKeySuccessors()