| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final boolean | DEBUG
local debug flag |
| private final ArrayList | invokeRangeInsns
list of invoke-range instructions seen in this method |
| private final Map | localVariables
maps local variable to a list of associated SSA registers |
| private final InterferenceRegisterMapper | mapper
Register mapper which will be our result |
| private final boolean | minimizeRegisters
true if converter should take steps to minimize rop-form registers |
| private final ArrayList | moveResultPseudoInsns
list of move-result-pesudo instructions seen in this method |
| private final int | paramRangeEnd
end of rop registers range (starting at 0) reserved for parameters |
| private final ArrayList | phiInsns
list of phi instructions seen in this method |
| private final BitSet | reservedRopRegs
set of rop registers reserved for parameters or local variables |
| private final BitSet | ssaRegsMapped
indexed by SSA reg; the set of SSA regs we've mapped |
| private final BitSet | usedRopRegs
set of rop registers that have been used by anything |
| Access | Constructor and Description |
|---|---|
| public | FirstFitLocalCombiningAllocator(SsaMethod
non-null; method to processnon-null interference graph for SSA registers interference, boolean true if converter should take steps to
minimize rop-form registers minimizeRegisters)Constructs instance. |
| Modifier and Type | Method and Description |
|---|---|
| private void | addMapping(RegisterSpec
non-null; SSA register to map from>=0; rop register to map toAdds a mapping from an SSA register to a rop register. |
| private void | adjustAndMapSourceRangeRange(NormalSsaInsn
non-null; insn whos sources to processMaps the source registers of the specified instruction such that they will fall in a contiguous range in rop form. |
| public RegisterMapper | allocateRegisters()
Implements abstract org. |
| private void | analyzeInstructions()
Analyze each instruction and find out all the local variable assignments and move-result-pseudo/invoke-range instrucitons. |
| private boolean | Returns: true if mapping is possiblenon-null; SSA specprosepctive new-namespace reg ropReg)Checks to see if |
| private boolean | Returns: true if all unmapped registers can be mappednon-null; SSA registers to check>=0; rop register to check mapping toChecks to see if a list of SSA registers can all be mapped into the same rop reg. Ignores registers that have already been mapped, and checks the interference graph and ensures the range does not cross the parameter range. |
| private int | Returns: the rop register that starts the fitting rangenon-null; insn to build range for>=0; length required in register unitsnon-null; indexed by source index;
the category for each sourcenon-null; an output parameter indexed by
source index that will contain the set of sources which need
moves insertedFinds an unreserved range that will fit the sources of the specified instruction. |
| private int | Returns: >= 0; start of available register range.>= 0; a rop register to start the search at> 0; the width, in registers, required.Finds a range of unreserved rop registers. |
| private int | Returns: >= 0; rop register of start of rangenon-null; the insn whose sources need to
fit. Must be last insn in basic block.Find a contiguous rop register range that fits the specified instruction's sources. |
| private int | Returns: >= 0; start of available register range.>= 0; a rop register to start the search at> 0; the width, in registers, required.Finds a range of rop regs that can be used for local variables. |
| private int | Returns: the width of the fit that that does not involve added moves or-1 if "no fit possible">= 0; rop reg that begins rangenon-null; insn to plan range fornon-null; indexed by source index;
the category for each sourcenon-null; an output parameter indexed by
source index that will contain the set of sources which need
moves insertedAttempts to build a plan for fitting a range of sources into rop registers. |
| private LocalItem | Returns: null-ok; associated local item or null>= 0; SSA registerGets a local item associated with an ssa register, if one exists. |
| private int | Returns: parameter index or-1 if not a parameter>=0; SSA register to look upGets the parameter index for SSA registers that are method parameters. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | handleUnassociatedParameters()
Maps any parameter that isn't local-associated, which can happen in the case where there is no java debug info. |
| private boolean | Returns: true if the "this" pointer is located here.rop register startReg)Returns true if given rop register represents the |
| private void | markReserved(int
>= 0; rop register to reserve> 0; width to reserveMarks a range of rop registers as "reserved for a local variable." |
| private void | |
| private void | |
| private boolean | Returns: true if any register in range is marked reserved>= 0; lowest rop register> 0; number of rop registers in range.Checks to see if any rop registers in the specified range are reserved for local variables or parameters. |
| private boolean | Returns: true in the case noted aboveregister in new namespace ssaReg, int width that the register will have category)Returns true if the specified rop register + category
will cross the boundry between the lower |
| pack-priv RegisterSpecList | Returns: list of RegisterSpecs as noted abovenon-null; set of SSA registersConverts a bit set of SSA registers into a RegisterSpecList containing the definition specs of all the registers. |
| private boolean | Returns: true if map succeeded, false if notnon-null; SSA register>=0; rop register1..2; the maximum category
that the SSA register is allowed to beTries to map an SSA register to a rop register. |
| private boolean | Returns: true if all registers were mapped, false
if some remain unmappednon-null; SSA registers to attempt to map>=0; rop register to map to1..2; maximum category
allowed in mapping.do so if markReserved)trueTries to map a list of SSA registers into the a rop reg, marking used rop space as reserved. |
| public boolean | wantsParamsMovedHigh()
Implements abstract org. |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG local debug flag | |
| invokeRangeInsns | back to summary |
|---|---|
| private final ArrayList<NormalSsaInsn> invokeRangeInsns list of invoke-range instructions seen in this method | |
| localVariables | back to summary |
|---|---|
| private final Map<LocalItem, ArrayList<RegisterSpec>> localVariables maps local variable to a list of associated SSA registers | |
| mapper | back to summary |
|---|---|
| private final InterferenceRegisterMapper mapper Register mapper which will be our result | |
| minimizeRegisters | back to summary |
|---|---|
| private final boolean minimizeRegisters true if converter should take steps to minimize rop-form registers | |
| moveResultPseudoInsns | back to summary |
|---|---|
| private final ArrayList<NormalSsaInsn> moveResultPseudoInsns list of move-result-pesudo instructions seen in this method | |
| paramRangeEnd | back to summary |
|---|---|
| private final int paramRangeEnd end of rop registers range (starting at 0) reserved for parameters | |
| phiInsns | back to summary |
|---|---|
| private final ArrayList<PhiInsn> phiInsns list of phi instructions seen in this method | |
| reservedRopRegs | back to summary |
|---|---|
| private final BitSet reservedRopRegs set of rop registers reserved for parameters or local variables | |
| ssaRegsMapped | back to summary |
|---|---|
| private final BitSet ssaRegsMapped indexed by SSA reg; the set of SSA regs we've mapped | |
| usedRopRegs | back to summary |
|---|---|
| private final BitSet usedRopRegs set of rop registers that have been used by anything | |
| FirstFitLocalCombiningAllocator | back to summary |
|---|---|
| public FirstFitLocalCombiningAllocator(SsaMethod ssaMeth, InterferenceGraph interference, boolean minimizeRegisters) Constructs instance.
| |
| addMapping | back to summary |
|---|---|
| private void addMapping(RegisterSpec ssaSpec, int ropReg) Adds a mapping from an SSA register to a rop register.
| |
| adjustAndMapSourceRangeRange | back to summary |
|---|---|
| private void adjustAndMapSourceRangeRange(NormalSsaInsn insn) Maps the source registers of the specified instruction such that they will fall in a contiguous range in rop form. Moves are inserted as necessary to allow the range to be allocated.
| |
| allocateRegisters | back to summary |
|---|---|
| public RegisterMapper allocateRegisters() Implements abstract org. Doc from org. Runs the algorithm.
| |
| analyzeInstructions | back to summary |
|---|---|
| private void analyzeInstructions() Analyze each instruction and find out all the local variable assignments and move-result-pseudo/invoke-range instrucitons. | |
| canMapReg | back to summary |
|---|---|
| private boolean canMapReg(RegisterSpec ssaSpec, int ropReg) Checks to see if
| |
| canMapRegs | back to summary |
|---|---|
| private boolean canMapRegs(ArrayList<RegisterSpec> specs, int ropReg) Checks to see if a list of SSA registers can all be mapped into the same rop reg. Ignores registers that have already been mapped, and checks the interference graph and ensures the range does not cross the parameter range.
| |
| findAnyFittingRange | back to summary |
|---|---|
| private int findAnyFittingRange(NormalSsaInsn insn, int rangeLength, int[] categoriesForIndex, BitSet outMovesRequired) Finds an unreserved range that will fit the sources of the specified instruction. Does not bother trying to center the range around an already-mapped source register;
| |
| findNextUnreservedRopReg | back to summary |
|---|---|
| private int findNextUnreservedRopReg(int startReg, int width) Finds a range of unreserved rop registers.
| |
| findRangeAndAdjust | back to summary |
|---|---|
| private int findRangeAndAdjust(NormalSsaInsn insn) Find a contiguous rop register range that fits the specified instruction's sources. First, try to center the range around sources that have already been mapped to rop registers. If that fails, just find a new contiguous range that doesn't interfere.
| |
| findRopRegForLocal | back to summary |
|---|---|
| private int findRopRegForLocal(int startReg, int width) Finds a range of rop regs that can be used for local variables.
If
| |
| fitPlanForRange | back to summary |
|---|---|
| private int fitPlanForRange(int ropReg, NormalSsaInsn insn, int[] categoriesForIndex, BitSet outMovesRequired) Attempts to build a plan for fitting a range of sources into rop registers.
| |
| getLocalItemForReg | back to summary |
|---|---|
| private LocalItem getLocalItemForReg(int ssaReg) Gets a local item associated with an ssa register, if one exists.
| |
| getParameterIndexForReg | back to summary |
|---|---|
| private int getParameterIndexForReg(int ssaReg) Gets the parameter index for SSA registers that are method parameters.
| |
| handleCheckCastResults | back to summary |
|---|---|
| private void handleCheckCastResults() Handles check cast results to reuse the same source register. Inserts a move if it can't map the same register to both and the check cast is not caught. | |
| handleInvokeRangeInsns | back to summary |
|---|---|
| private void handleInvokeRangeInsns() Handles all insns that want a register range for their sources. | |
| handleLocalAssociatedOther | back to summary |
|---|---|
| private void handleLocalAssociatedOther() Maps all local-associated registers that are not parameters. Tries to find an unreserved range that's wide enough for all of the SSA registers, and then tries to map them all to that range. If not all fit, a new range is tried until all registers have been fit. | |
| handleLocalAssociatedParams | back to summary |
|---|---|
| private void handleLocalAssociatedParams() Maps all local-associated parameters to rop registers. | |
| handleNormalUnassociated | back to summary |
|---|---|
| private void handleNormalUnassociated() Maps all non-parameter, non-local variable registers. | |
| handlePhiInsns | back to summary |
|---|---|
| private void handlePhiInsns() Handles all phi instructions, trying to map them to a common register. | |
| handleUnassociatedParameters | back to summary |
|---|---|
| private void handleUnassociatedParameters() Maps any parameter that isn't local-associated, which can happen in the case where there is no java debug info. | |
| isThisPointerReg | back to summary |
|---|---|
| private boolean isThisPointerReg(int startReg) Returns true if given rop register represents the
| |
| markReserved | back to summary |
|---|---|
| private void markReserved(int ropReg, int category) Marks a range of rop registers as "reserved for a local variable."
| |
| printLocalVars | back to summary |
|---|---|
| private void printLocalVars() Dumps local variable table to stdout for debugging. | |
| processPhiInsn | back to summary |
|---|---|
| private void processPhiInsn(PhiInsn insn) Attempts to map the sources and result of a phi to a common register. Will try existing mappings first, from most to least common. If none of the registers have mappings yet, a new mapping is created. | |
| rangeContainsReserved | back to summary |
|---|---|
| private boolean rangeContainsReserved(int ropRangeStart, int width) Checks to see if any rop registers in the specified range are reserved for local variables or parameters.
| |
| spansParamRange | back to summary |
|---|---|
| private boolean spansParamRange(int ssaReg, int category) Returns true if the specified rop register + category
will cross the boundry between the lower
| |
| ssaSetToSpecs | back to summary |
|---|---|
| pack-priv RegisterSpecList ssaSetToSpecs(IntSet ssaSet) Converts a bit set of SSA registers into a RegisterSpecList containing the definition specs of all the registers.
| |
| tryMapReg | back to summary |
|---|---|
| private boolean tryMapReg(RegisterSpec ssaSpec, int ropReg, int maxAllowedCategory) Tries to map an SSA register to a rop register.
| |
| tryMapRegs | back to summary |
|---|---|
| private boolean tryMapRegs(ArrayList<RegisterSpec> specs, int ropReg, int maxAllowedCategory, boolean markReserved) Tries to map a list of SSA registers into the a rop reg, marking used rop space as reserved. SSA registers that don't fit are left unmapped.
| |
| wantsParamsMovedHigh | back to summary |
|---|---|
| public boolean wantsParamsMovedHigh() Implements abstract org. Doc from org. Indicates whether the method params were allocated at the bottom of the namespace, and thus should be moved up to the top of the namespace after phi removal.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int[] | |
| private final int[] | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | Returns: element with the highest countSearches the set for the element that has been added the most. |
| public int |
| count | back to summary |
|---|---|
| private final int[] count | |
| reg | back to summary |
|---|---|
| private final int[] reg | |
| size | back to summary |
|---|---|
| private int size | |
| Multiset | back to summary |
|---|---|
| public Multiset(int maxSize) Constructs an instance.
| |
| add | back to summary |
|---|---|
| public void add(int element) Adds an element to the set.
| |
| getAndRemoveHighestCount | back to summary |
|---|---|
| public int getAndRemoveHighestCount() Searches the set for the element that has been added the most. In the case of a tie, the element that was added first is returned. Then, it clears the count on that element. The size of the set remains unchanged.
| |
| getSize | back to summary |
|---|---|
| public int getSize() Gets the number of distinct elements in the set.
| |