public final class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable, SwitchFoldable
IntegerSwitchNode represents a switch on integer keys, with a sorted array of key
values. The actual implementation of the switch will be decided by the backend.Node.ConstantNodeParameter, Node.EdgeVisitor, Node.IndirectCanonicalization, Node.InjectedNodeParameter, Node.Input, Node.NodeInsertionStackTrace, Node.NodeIntrinsic, Node.NodeIntrinsicFactory, Node.OptionalInput, Node.Successor, Node.ValueNumberableSwitchFoldable.Helper, SwitchFoldable.QuickQueryKeyData, SwitchFoldable.QuickQueryList<T>| Modifier and Type | Field and Description |
|---|---|
protected boolean |
areKeysContiguous
True if keys are contiguous ([n, n+1, n+2, n+3, ..., n+k]).
|
protected int[] |
keys |
static NodeClass<IntegerSwitchNode> |
TYPE |
keySuccessors, profileData, successors, valueEMPTY_ARRAY, stampNODE_LIST, NOT_ITERABLE, TRACK_CREATION_POSITION, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdgesSORTER| Constructor and Description |
|---|
IntegerSwitchNode(ValueNode value,
AbstractBeginNode[] successors,
int[] keys,
int[] keySuccessors,
ProfileData.SwitchProbabilityData profileData) |
IntegerSwitchNode(ValueNode value,
int successorCount,
int[] keys,
int[] keySuccessors,
ProfileData.SwitchProbabilityData profileData) |
| Modifier and Type | Method and Description |
|---|---|
void |
cutOffCascadeNode()
Removes the successors of this node, while keeping it linked to the rest of the cascade.
|
void |
cutOffLowestCascadeNode()
Completely removes all successors from this node.
|
boolean |
equalKeys(SwitchNode switchNode)
Returns true if the switch has the same keys in the same order as this switch.
|
void |
generate(NodeLIRBuilderTool gen) |
AbstractBeginNode |
getDefault()
Returns the branch that will close this switch folding, assuming this is called on the lowest
node of the cascade.
|
Node |
getNextSwitchFoldableBranch()
Returns the direct successor in the branch to check for SwitchFoldability.
|
Stamp |
getValueStampForSuccessor(AbstractBeginNode beginNode) |
int |
intKeyAt(int i)
Gets the key at the specified index, as a java int.
|
boolean |
isInSwitch(ValueNode switchValue)
Determines whether the node should be folded in the current folding attempt.
|
boolean |
isNonInitializedProfile()
Heuristics that tries to determine whether or not a foldable node was profiled.
|
boolean |
isSorted() |
JavaConstant |
keyAt(int i)
Gets the key at the specified index.
|
int |
keyCount()
The number of distinct keys in this switch.
|
ProfileData.ProfileSource |
profileSource()
Returns the source of the information about branch probabilities of this node.
|
void |
simplify(SimplifierTool tool) |
AbstractBeginNode |
successorAtKey(int key) |
int |
successorIndexAtKey(int key) |
ValueNode |
switchValue()
Returns the value that will be used as the switch input.
|
boolean |
tryMergeCommonSuccessors()
Coalesces branches of the switch that trivially merges together.
|
boolean |
tryRemoveUnreachableKeys(SimplifierTool tool,
Stamp valueStamp)
Remove unreachable keys from the switch based on the stamp of the value, i.e., based on the
known range of the switch value.
|
blockSuccessor, blockSuccessorCount, defaultProbability, defaultSuccessor, defaultSuccessorIndex, dynamicNodeSizeEstimate, estimatedNodeCycles, getKeyProbabilities, getKeySuccessors, getPrimarySuccessor, getProfileData, getSuccessorCount, keyProbability, keySuccessor, keySuccessorIndex, killOtherSuccessors, probability, setBlockSuccessor, setProbability, structureEquals, valuesuccessorProbabilitiesasFixedNode, 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, waitdefaultProbability, isDefaultSuccessor, keyProbability, keySuccessor, maybeIsInSwitch, sameSwitchValue, switchTransformationOptimizationasNodepublic static final NodeClass<IntegerSwitchNode> TYPE
protected final int[] keys
protected final boolean areKeysContiguous
public IntegerSwitchNode(ValueNode value, AbstractBeginNode[] successors, int[] keys, int[] keySuccessors, ProfileData.SwitchProbabilityData profileData)
public IntegerSwitchNode(ValueNode value, int successorCount, int[] keys, int[] keySuccessors, ProfileData.SwitchProbabilityData profileData)
public boolean isSorted()
isSorted in class SwitchNodepublic JavaConstant keyAt(int i)
keyAt in class SwitchNodei - the indexpublic int intKeyAt(int i)
intKeyAt in interface SwitchFoldablepublic int keyCount()
SwitchNodekeyCount in interface SwitchFoldablekeyCount in class SwitchNodepublic boolean equalKeys(SwitchNode switchNode)
SwitchNodeequalKeys in class SwitchNodepublic void generate(NodeLIRBuilderTool gen)
generate in interface LIRLowerablepublic AbstractBeginNode successorAtKey(int key)
public int successorIndexAtKey(int key)
public void simplify(SimplifierTool tool)
simplify in interface Simplifiablepublic Node getNextSwitchFoldableBranch()
SwitchFoldablegetNextSwitchFoldableBranch in interface SwitchFoldablepublic boolean isInSwitch(ValueNode switchValue)
SwitchFoldableisInSwitch in interface SwitchFoldableswitchValue - the value of the switch that will spawn through this folding attempt.SwitchFoldable.maybeIsInSwitch(LogicNode),
SwitchFoldable.sameSwitchValue(LogicNode, ValueNode)public void cutOffCascadeNode()
SwitchFoldablecutOffCascadeNode in interface SwitchFoldablepublic void cutOffLowestCascadeNode()
SwitchFoldablecutOffLowestCascadeNode in interface SwitchFoldablepublic AbstractBeginNode getDefault()
SwitchFoldablegetDefault in interface SwitchFoldablepublic ValueNode switchValue()
SwitchFoldableswitchValue in interface SwitchFoldablepublic boolean isNonInitializedProfile()
SwitchFoldableisNonInitializedProfile in interface SwitchFoldablepublic ProfileData.ProfileSource profileSource()
SwitchFoldableprofileSource in interface SwitchFoldablepublic boolean tryMergeCommonSuccessors()
public boolean tryRemoveUnreachableKeys(SimplifierTool tool, Stamp valueStamp)
public Stamp getValueStampForSuccessor(AbstractBeginNode beginNode)
getValueStampForSuccessor in class SwitchNode