| Modifier and Type | Field and Description |
|---|---|
| private static boolean | COLLECT_ONE_LOCAL
If true, allow one local var to be involved with a collected const. |
| private static boolean | COLLECT_STRINGS
Also collect string consts, although they can throw exceptions. |
| private static final int | MAX_COLLECTED_CONSTANTS
Maximum constants to collect per method. |
| private final SsaMethod | ssaMeth
method we're processing |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | fixLocalAssignment(RegisterSpec
non-null; original registernon-null; new register that will replace
origRegInserts mark-locals if necessary when changing a register. |
| private ArrayList | Returns: non-null; list of constants in most-to-least used orderGets all of the collectable constant values used in this method, sorted by most used first. |
| public static void | |
| private void | |
| private void | updateConstUses(HashMap<TypedConstant, RegisterSpec>
non-null; mapping between constant and new reg>=0; original SSA reg count, not including
newly added constant regsUpdates all uses of various consts to use the values in the newly assigned registers. |
| COLLECT_ONE_LOCAL | back to summary |
|---|---|
| private static boolean COLLECT_ONE_LOCAL If true, allow one local var to be involved with a collected const. Turned off because it mostly just inserts more moves. | |
| COLLECT_STRINGS | back to summary |
|---|---|
| private static boolean COLLECT_STRINGS Also collect string consts, although they can throw exceptions. This is off now because it just doesn't seem to gain a whole lot. TODO if you turn this on, you must change SsaInsn.hasSideEffect() to return false for const-string insns whose exceptions are not caught in the current method. | |
| MAX_COLLECTED_CONSTANTS | back to summary |
|---|---|
| private static final int MAX_COLLECTED_CONSTANTS Maximum constants to collect per method. Puts cap on reg use | |
| ssaMeth | back to summary |
|---|---|
| private final SsaMethod ssaMeth method we're processing | |
| ConstCollector | back to summary |
|---|---|
| private ConstCollector(SsaMethod ssaMethod) Constructs an instance.
| |
| fixLocalAssignment | back to summary |
|---|---|
| private void fixLocalAssignment(RegisterSpec origReg, RegisterSpec newReg) Inserts mark-locals if necessary when changing a register. If
the definition of
| |
| getConstsSortedByCountUse | back to summary |
|---|---|
| private ArrayList Gets all of the collectable constant values used in this method, sorted by most used first. Skips non-collectable consts, such as non-string object constants
| |
| process | back to summary |
|---|---|
| public static void process(SsaMethod ssaMethod) Processes a method.
| |
| run | back to summary |
|---|---|
| private void run() Applies the optimization. | |
| updateConstUses | back to summary |
|---|---|
| private void updateConstUses(HashMap<TypedConstant, RegisterSpec> newRegs, int origRegCount) Updates all uses of various consts to use the values in the newly assigned registers.
| |