public abstract class LocalsArray extends MutabilityControl implements ToHuman
Note: For the most part, the documentation for this class
ignores the distinction between Type and TypeBearer.
| Modifier | Constructor and Description |
|---|---|
protected |
LocalsArray(boolean mutable)
Constructs an instance, explicitly indicating the mutability.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
annotate(ExceptionWithContext ex)
Annotates (adds context to) the given exception with information
about this instance.
|
abstract LocalsArray |
copy()
Makes and returns a mutable copy of this instance.
|
abstract TypeBearer |
get(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).
|
abstract TypeBearer |
getCategory1(int idx)
Gets the type stored at the given local index, which is expected
to be an initialized category-1 value.
|
abstract TypeBearer |
getCategory2(int idx)
Gets the type stored at the given local index, which is expected
to be a category-2 value.
|
abstract int |
getMaxLocals()
Gets the maximum number of locals this instance can refer to.
|
abstract TypeBearer |
getOrNull(int idx)
Gets the type stored at the given local index, or
null
if the given local is uninitialized / invalid. |
protected abstract OneLocalsArray |
getPrimary()
Gets the locals set appropriate for the current execution context.
|
abstract void |
invalidate(int idx)
Invalidates the local at the given index.
|
abstract void |
makeInitialized(Type type)
Replaces all the occurrences of the given uninitialized type in
this array with its initialized equivalent.
|
abstract LocalsArray |
merge(LocalsArray other)
Merges this instance with
other. |
abstract LocalsArraySet |
mergeWithSubroutineCaller(LocalsArray other,
int predLabel)
Merges this instance with a
LocalsSet from a subroutine
caller. |
abstract void |
set(int idx,
TypeBearer type)
Sets the type stored at the given local index.
|
abstract void |
set(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).
|
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutableprotected LocalsArray(boolean mutable)
mutable - true if this instance is mutablepublic abstract LocalsArray copy()
non-null; the copypublic abstract void annotate(ExceptionWithContext ex)
ex - non-null; the exception to annotatepublic abstract void makeInitialized(Type type)
type - non-null; type to replacepublic abstract int getMaxLocals()
public abstract void set(int idx,
TypeBearer type)
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.idx - >= 0, < getMaxLocals(); which localtype - non-null; new type for the local at idxpublic abstract void set(RegisterSpec spec)
set(spec.getReg(), spec).spec - non-null; register spec to use as the basis for the updatepublic abstract void invalidate(int idx)
idx - >= 0, < getMaxLocals(); which localpublic abstract TypeBearer getOrNull(int idx)
null
if the given local is uninitialized / invalid.idx - >= 0, < getMaxLocals(); which localnull-ok; the type of value stored in that localpublic abstract TypeBearer get(int idx)
idx - >= 0, < getMaxLocals(); which localnon-null; the type of value stored in that localSimException - thrown if idx is valid, but
the contents are invalidpublic abstract TypeBearer getCategory1(int idx)
idx - >= 0, < getMaxLocals(); which localnon-null; the type of value stored in that localSimException - 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 valuepublic abstract TypeBearer getCategory2(int idx)
idx - >= 0, < getMaxLocals(); which localnon-null; the type of value stored in that localSimException - thrown if idx is valid, but
one of the following holds: (a) the local is invalid; (b) the local
contains a category-1 valuepublic abstract LocalsArray merge(LocalsArray other)
other. If the merged result is
the same as this instance, then this is returned (not a copy).other - non-null; another LocalsArraynon-null; the merge result, a new instance or thispublic abstract LocalsArraySet mergeWithSubroutineCaller(LocalsArray other, int predLabel)
LocalsSet from a subroutine
caller. To be used when merging in the first block of a subroutine.other - other non-null; another LocalsArray. The final locals
state of a subroutine caller.predLabel - the label of the subroutine caller block.non-null; the merge result, a new instance or thisprotected abstract OneLocalsArray getPrimary()
OneLocalsArray instance, then return
this, otherwise return LocalsArraySet's
primary.Copyright © 2020. All Rights Reserved.