use of com.android.dx.rop.type.Type in project buck by facebook.
the class CodeItem method addContents.
/** {@inheritDoc} */
public void addContents(DexFile file) {
MixedItemSection byteData = file.getByteData();
TypeIdsSection typeIds = file.getTypeIds();
if (code.hasPositions() || code.hasLocals()) {
debugInfo = new DebugInfoItem(code, isStatic, ref);
byteData.add(debugInfo);
}
if (code.hasAnyCatches()) {
for (Type type : code.getCatchTypes()) {
typeIds.intern(type);
}
catches = new CatchStructs(code);
}
for (Constant c : code.getInsnConstants()) {
file.internIfAppropriate(c);
}
}
use of com.android.dx.rop.type.Type in project buck by facebook.
the class CstBaseMethodRef method getPrototype.
/**
* Gets the prototype of this method as either a
* {@code static} or instance method. In the case of a
* {@code static} method, this is the same as the raw
* prototype. In the case of an instance method, this has an
* appropriately-typed {@code this} argument as the first
* one.
*
* @param isStatic whether the method should be considered static
* @return {@code non-null;} the method prototype
*/
public final Prototype getPrototype(boolean isStatic) {
if (isStatic) {
return prototype;
} else {
if (instancePrototype == null) {
Type thisType = getDefiningClass().getClassType();
instancePrototype = prototype.withFirstParameter(thisType);
}
return instancePrototype;
}
}
use of com.android.dx.rop.type.Type in project buck by facebook.
the class TypeIdsSection method get.
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
if (cst == null) {
throw new NullPointerException("cst == null");
}
throwIfNotPrepared();
Type type = ((CstType) cst).getClassType();
IndexedItem result = typeIds.get(type);
if (result == null) {
throw new IllegalArgumentException("not found: " + cst);
}
return result;
}
use of com.android.dx.rop.type.Type in project buck by facebook.
the class RegisterSpec method withSimpleType.
/**
* Returns an instance that is identical to this one, except that
* the type bearer is replaced by the actual underlying type
* (thereby stripping off non-type information) with any
* initialization information stripped away as well.
*
* @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec withSimpleType() {
TypeBearer orig = type;
Type newType;
if (orig instanceof Type) {
newType = (Type) orig;
} else {
newType = orig.getType();
}
if (newType.isUninitialized()) {
newType = newType.getInitializedType();
}
if (newType == orig) {
return this;
}
return makeLocalOptional(reg, newType, local);
}
use of com.android.dx.rop.type.Type in project buck by facebook.
the class Rop method toString.
/** {@inheritDoc} */
@Override
public String toString() {
StringBuffer sb = new StringBuffer(40);
sb.append("Rop{");
sb.append(RegOps.opName(opcode));
if (result != Type.VOID) {
sb.append(" ");
sb.append(result);
} else {
sb.append(" .");
}
sb.append(" <-");
int sz = sources.size();
if (sz == 0) {
sb.append(" .");
} else {
for (int i = 0; i < sz; i++) {
sb.append(' ');
sb.append(sources.getType(i));
}
}
if (isCallLike) {
sb.append(" call");
}
sz = exceptions.size();
if (sz != 0) {
sb.append(" throws");
for (int i = 0; i < sz; i++) {
sb.append(' ');
Type one = exceptions.getType(i);
if (one == Type.THROWABLE) {
sb.append("<any>");
} else {
sb.append(exceptions.getType(i));
}
}
} else {
switch(branchingness) {
case BRANCH_NONE:
sb.append(" flows");
break;
case BRANCH_RETURN:
sb.append(" returns");
break;
case BRANCH_GOTO:
sb.append(" gotos");
break;
case BRANCH_IF:
sb.append(" ifs");
break;
case BRANCH_SWITCH:
sb.append(" switches");
break;
default:
sb.append(" " + Hex.u1(branchingness));
break;
}
}
sb.append('}');
return sb.toString();
}
Aggregations