Methods Summary |
---|
public void | annotate(com.android.dx.util.ExceptionWithContext ex)
for (int i = 0; i < locals.length; i++) {
TypeBearer type = locals[i];
String s = (type == null) ? "<invalid>" : type.toString();
ex.addContext("locals[" + Hex.u2(i) + "]: " + s);
}
|
public com.android.dx.cf.code.OneLocalsArray | copy()
OneLocalsArray result = new OneLocalsArray(locals.length);
System.arraycopy(locals, 0, result.locals, 0, locals.length);
return result;
|
public com.android.dx.rop.type.TypeBearer | get(int idx)
TypeBearer result = locals[idx];
if (result == null) {
return throwSimException(idx, "invalid");
}
return result;
|
public com.android.dx.rop.type.TypeBearer | getCategory1(int idx)
TypeBearer result = get(idx);
Type type = result.getType();
if (type.isUninitialized()) {
return throwSimException(idx, "uninitialized instance");
}
if (type.isCategory2()) {
return throwSimException(idx, "category-2");
}
return result;
|
public com.android.dx.rop.type.TypeBearer | getCategory2(int idx)
TypeBearer result = get(idx);
if (result.getType().isCategory1()) {
return throwSimException(idx, "category-1");
}
return result;
|
public int | getMaxLocals()
return locals.length;
|
public com.android.dx.rop.type.TypeBearer | getOrNull(int idx)
return locals[idx];
|
protected com.android.dx.cf.code.OneLocalsArray | getPrimary(){@inheritDoc}
return this;
|
public void | invalidate(int idx)
throwIfImmutable();
locals[idx] = null;
|
public void | makeInitialized(com.android.dx.rop.type.Type type)
int len = locals.length;
if (len == 0) {
// We have to check for this before checking for immutability.
return;
}
throwIfImmutable();
Type initializedType = type.getInitializedType();
for (int i = 0; i < len; i++) {
if (locals[i] == type) {
locals[i] = initializedType;
}
}
|
public LocalsArray | merge(LocalsArray other)
if (other instanceof OneLocalsArray) {
return merge((OneLocalsArray)other);
} else { //LocalsArraySet
// LocalsArraySet knows how to merge me.
return other.merge(this);
}
|
public com.android.dx.cf.code.OneLocalsArray | merge(com.android.dx.cf.code.OneLocalsArray other)Merges this OneLocalsArray instance with another OneLocalsArray
instance. A more-refined version of {@link #merge(LocalsArray) merge}
which is called by that method when appropriate.
try {
return Merger.mergeLocals(this, other);
} catch (SimException ex) {
ex.addContext("underlay locals:");
annotate(ex);
ex.addContext("overlay locals:");
other.annotate(ex);
throw ex;
}
|
public LocalsArraySet | mergeWithSubroutineCaller(LocalsArray other, int predLabel)
LocalsArraySet result = new LocalsArraySet(getMaxLocals());
return result.mergeWithSubroutineCaller(other, predLabel);
|
public void | set(int idx, com.android.dx.rop.type.TypeBearer type)
throwIfImmutable();
try {
type = type.getFrameType();
} catch (NullPointerException ex) {
// Elucidate the exception
throw new NullPointerException("type == null");
}
if (idx < 0) {
throw new IndexOutOfBoundsException("idx < 0");
}
// Make highest possible out-of-bounds check happen first.
if (type.getType().isCategory2()) {
locals[idx + 1] = null;
}
locals[idx] = type;
if (idx != 0) {
TypeBearer prev = locals[idx - 1];
if ((prev != null) && prev.getType().isCategory2()) {
locals[idx - 1] = null;
}
}
|
public void | set(com.android.dx.rop.code.RegisterSpec spec)
set(spec.getReg(), spec);
|
private static com.android.dx.rop.type.TypeBearer | throwSimException(int idx, java.lang.String msg)Throws a properly-formatted exception.
throw new SimException("local " + Hex.u2(idx) + ": " + msg);
|
public java.lang.String | toHuman(){@inheritDoc
StringBuilder sb = new StringBuilder();
for (int i = 0; i < locals.length; i++) {
TypeBearer type = locals[i];
String s = (type == null) ? "<invalid>" : type.toString();
sb.append("locals[" + Hex.u2(i) + "]: " + s + "\n");
}
return sb.toString();
|