FileDocCategorySizeDatePackage
LocalsArray.javaAPI DocAndroid 1.5 API6561Wed May 06 22:41:02 BST 2009com.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 true if this instance is mutable

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

param
ex non-null; the exception to annotate

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

return
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 >= 0, < getMaxLocals(); which local
return
non-null; the type of value stored in that local
throws
SimException thrown if 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 >= 0, < getMaxLocals(); which local
return
non-null; the type of value stored in that local
throws
SimException thrown if 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 >= 0, < getMaxLocals(); which local
return
non-null; the type of value stored in that local
throws
SimException thrown if 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 null if the given local is uninitialized / invalid.

param
idx >= 0, < getMaxLocals(); which local
return
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 OneLocalsArray instance, then return this, otherwise return LocalsArraySet's primary.

return
locals for this execution context.

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

param
idx >= 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 non-null; type to replace

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

param
other non-null; another LocalsArray
return
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 LocalsSet from a subroutine caller. To be used when merging in the first block of a subroutine.

param
other other non-null; another LocalsArray. The final locals state of a subroutine caller.
param
predLabel the label of the subroutine caller block.
return
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 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 >= 0, < getMaxLocals(); which local
param
type non-null; new type for the local at 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 set(spec.getReg(), spec).

param
spec non-null; register spec to use as the basis for the update