public final class RegisterSpecSet extends MutabilityControl
RegisterSpec instances, where a given register number
may appear only once in the set.| Modifier and Type | Field and Description |
|---|---|
static RegisterSpecSet |
EMPTY
non-null; no-element instance |
| Constructor and Description |
|---|
RegisterSpecSet(int maxSize)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
RegisterSpec |
findMatchingLocal(RegisterSpec spec)
Returns the spec in this set that's currently associated with a
given local (type, name, and signature), or
null if there is
none. |
RegisterSpec |
get(int reg)
Gets the element with the given register number, if any.
|
RegisterSpec |
get(RegisterSpec spec)
Gets the element with the same register number as the given
spec, if any.
|
int |
getMaxSize()
Gets the maximum number of registers that may be in this instance, which
is also the maximum-plus-one of register numbers that may be
represented.
|
int |
hashCode() |
void |
intersect(RegisterSpecSet other,
boolean localPrimary)
Intersects this instance with the given one, modifying this
instance.
|
RegisterSpec |
localItemToSpec(LocalItem local)
Returns the spec in this set that's currently associated with a given
local (name and signature), or
null if there is none. |
RegisterSpecSet |
mutableCopy()
Makes and return a mutable copy of this instance.
|
void |
put(RegisterSpec spec)
Puts the given spec into the set.
|
void |
putAll(RegisterSpecSet set)
Put the entire contents of the given set into this one.
|
void |
remove(RegisterSpec toRemove)
Removes a spec from the set.
|
int |
size()
Gets the current size of this instance.
|
java.lang.String |
toString() |
RegisterSpecSet |
withOffset(int delta)
Returns an instance that is identical to this one, except that
all register numbers are offset by the given amount.
|
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutablepublic static final RegisterSpecSet EMPTY
non-null; no-element instancepublic RegisterSpecSet(int maxSize)
maxSize - >= 0; the maximum register number (exclusive) that
may be represented in this instancepublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int getMaxSize()
>= 0; the maximum sizepublic int size()
>= 0; the sizepublic RegisterSpec get(int reg)
reg - >= 0; the desired register numbernull-ok; the element with the given register number or
null if there is nonepublic RegisterSpec get(RegisterSpec spec)
get(spec.getReg()).spec - non-null; spec with the desired register numbernull-ok; the element with the matching register number or
null if there is nonepublic RegisterSpec findMatchingLocal(RegisterSpec spec)
null if there is
none. This ignores the register number of the given spec but
matches on everything else.spec - non-null; local to look fornull-ok; first register found that matches, if anypublic RegisterSpec localItemToSpec(LocalItem local)
null if there is none.local - non-null; local item to search fornull-ok; first register found with matching name and signaturepublic void remove(RegisterSpec toRemove)
toRemove - non-null; register to remove.public void put(RegisterSpec spec)
spec - non-null; the register spec to put in the instancepublic void putAll(RegisterSpecSet set)
set - non-null; the set to put into this instancepublic void intersect(RegisterSpecSet other, boolean localPrimary)
RegisterSpec.intersect(com.android.dx.rop.code.RegisterSpec, boolean) of corresponding elements from
this instance and the given one where both are non-null.other - non-null; set to intersect withlocalPrimary - whether local variables are primary to
the intersection; if true, then the only non-null
result elements occur when registers being intersected have
equal names (or both have null names)public RegisterSpecSet withOffset(int delta)
delta - the amount to offset the register numbers bynon-null; an appropriately-constructed instancepublic RegisterSpecSet mutableCopy()
non-null; the mutable copyCopyright © 2020. All Rights Reserved.