FileDocCategorySizeDatePackage
LocalsArray.javaAPI DocAndroid 5.1 API6566Thu Mar 12 22:18:30 GMT 2015com.android.dx.cf.code

LocalsArray

public abstract class LocalsArray extends com.android.dx.util.MutabilityControl implements com.android.dx.util.ToHuman
Representation of an array of local variables, with Java semantics.

Note: For the most part, the documentation for this class ignores the distinction between {@link Type} and {@link TypeBearer}.

Fields Summary
Constructors Summary
protected LocalsArray(boolean mutable)
Constructs an instance, explicitly indicating the mutability.

param
mutable {@code true} if this instance is mutable

        super(mutable);
    
Methods Summary
public abstract voidannotate(com.android.dex.util.ExceptionWithContext ex)
Annotates (adds context to) the given exception with information about this instance.

param
ex {@code non-null;} the exception to annotate

public abstract com.android.dx.cf.code.LocalsArraycopy()
Makes and returns a mutable copy of this instance.

return
{@code non-null;} the copy

public abstract com.android.dx.rop.type.TypeBearerget(int idx)
Gets the type stored at the given local index, only succeeding if the given local contains a valid type (though it is allowed to be an uninitialized instance).

param
idx {@code >= 0, < getMaxLocals();} which local
return
{@code non-null;} the type of value stored in that local
throws
SimException thrown if {@code idx} is valid, but the contents are invalid

public abstract com.android.dx.rop.type.TypeBearergetCategory1(int idx)
Gets the type stored at the given local index, which is expected to be an initialized category-1 value.

param
idx {@code >= 0, < getMaxLocals();} which local
return
{@code non-null;} the type of value stored in that local
throws
SimException thrown if {@code idx} is valid, but one of the following holds: (a) the local is invalid; (b) the local contains an uninitialized instance; (c) the local contains a category-2 value

public abstract com.android.dx.rop.type.TypeBearergetCategory2(int idx)
Gets the type stored at the given local index, which is expected to be a category-2 value.

param
idx {@code >= 0, < getMaxLocals();} which local
return
{@code non-null;} the type of value stored in that local
throws
SimException thrown if {@code idx} is valid, but one of the following holds: (a) the local is invalid; (b) the local contains a category-1 value

public abstract intgetMaxLocals()
Gets the maximum number of locals this instance can refer to.

return
the max locals

public abstract com.android.dx.rop.type.TypeBearergetOrNull(int idx)
Gets the type stored at the given local index, or {@code null} if the given local is uninitialized / invalid.

param
idx {@code >= 0, < getMaxLocals();} which local
return
{@code null-ok;} the type of value stored in that local

protected abstract OneLocalsArraygetPrimary()
Gets the locals set appropriate for the current execution context. That is, if this is a {@code OneLocalsArray} instance, then return {@code this}, otherwise return {@code LocalsArraySet}'s primary.

return
locals for this execution context.

public abstract voidinvalidate(int idx)
Invalidates the local at the given index.

param
idx {@code >= 0, < getMaxLocals();} which local

public abstract voidmakeInitialized(com.android.dx.rop.type.Type type)
Replaces all the occurrences of the given uninitialized type in this array with its initialized equivalent.

param
type {@code non-null;} type to replace

public abstract com.android.dx.cf.code.LocalsArraymerge(com.android.dx.cf.code.LocalsArray other)
Merges this instance with {@code other}. If the merged result is the same as this instance, then this is returned (not a copy).

param
other {@code non-null;} another LocalsArray
return
{@code non-null;} the merge result, a new instance or this

public abstract LocalsArraySetmergeWithSubroutineCaller(com.android.dx.cf.code.LocalsArray other, int predLabel)
Merges this instance with a {@code LocalsSet} from a subroutine caller. To be used when merging in the first block of a subroutine.

param
other {@code other non-null;} another LocalsArray. The final locals state of a subroutine caller.
param
predLabel the label of the subroutine caller block.
return
{@code non-null;} the merge result, a new instance or this

public abstract voidset(int idx, com.android.dx.rop.type.TypeBearer type)
Sets the type stored at the given local index. If the given type is category-2, then (a) the index must be at least two less than {@link #getMaxLocals} and (b) the next index gets invalidated by the operation. In case of either category, if the previous local contains a category-2 value, then it too is invalidated by this operation.

param
idx {@code >= 0, < getMaxLocals();} which local
param
type {@code non-null;} new type for the local at {@code idx}

public abstract voidset(com.android.dx.rop.code.RegisterSpec spec)
Sets the type for the local indicated by the given register spec to that register spec (which includes type and optional name information). This is identical to calling {@code set(spec.getReg(), spec)}.

param
spec {@code non-null;} register spec to use as the basis for the update