private class SwitchStrategy.EffortClosure extends Object implements SwitchStrategy.SwitchClosure
Modifier and Type | Field and Description |
---|---|
private int |
defaultCount |
private int |
defaultEffort |
private int[] |
keyCounts |
private int[] |
keyEfforts |
private LabelRef[] |
keyTargets |
Constructor and Description |
---|
EffortClosure(LabelRef[] keyTargets) |
Modifier and Type | Method and Description |
---|---|
void |
bind(Label label)
Binds a label returned by
SwitchStrategy.SwitchClosure.conditionalJump(int, Condition) . |
Label |
conditionalJump(int index,
Condition condition)
Create a new label and generate a conditional jump to it.
|
void |
conditionalJump(int index,
Condition condition,
boolean defaultTarget)
Generates a conditional or unconditional jump.
|
void |
conditionalJumpOrDefault(int index,
Condition condition,
boolean canFallThrough)
Generates a conditional jump to the target with the specified index.
|
double |
getAverageEffort() |
boolean |
isSameTarget(int index1,
int index2)
Return true iff the target of both indexes is the same.
|
private int defaultEffort
private int defaultCount
private final int[] keyEfforts
private final int[] keyCounts
private final LabelRef[] keyTargets
public EffortClosure(LabelRef[] keyTargets)
public void conditionalJump(int index, Condition condition, boolean defaultTarget)
SwitchStrategy.SwitchClosure
conditionalJump
in interface SwitchStrategy.SwitchClosure
index
- Index of the value and the jump target (only used if defaultTarget == false)condition
- The condition on which to jump (can be null)defaultTarget
- true if the jump should go to the default target, false if index
should be used.public void conditionalJumpOrDefault(int index, Condition condition, boolean canFallThrough)
SwitchStrategy.SwitchClosure
conditionalJumpOrDefault
in interface SwitchStrategy.SwitchClosure
index
- Index of the value and the jump targetcondition
- The condition on which to jumpcanFallThrough
- true if this is the last instruction in the switch statement, to
allow for fall-through optimizations.public Label conditionalJump(int index, Condition condition)
SwitchStrategy.SwitchClosure
conditionalJump
in interface SwitchStrategy.SwitchClosure
index
- Index of the value and the jump targetcondition
- The condition on which to jumppublic void bind(Label label)
SwitchStrategy.SwitchClosure
SwitchStrategy.SwitchClosure.conditionalJump(int, Condition)
.bind
in interface SwitchStrategy.SwitchClosure
public boolean isSameTarget(int index1, int index2)
SwitchStrategy.SwitchClosure
isSameTarget
in interface SwitchStrategy.SwitchClosure
public double getAverageEffort()