use of com.android.dx.rop.type.Type in project J2ME-Loader by nikita36078.
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 J2ME-Loader by nikita36078.
the class EscapeAnalysis method replaceDef.
/**
* Replaces the instructions that define an array with equivalent registers.
* For each entry in the array, a register is created, initialized to zero.
* A mapping between this register and the corresponding array index is
* added.
*
* @param def {@code non-null;} move result instruction for array
* @param prev {@code non-null;} instruction for instantiating new array
* @param length size of the new array
* @param newRegs {@code non-null;} mapping of array indices to new
* registers to be populated
*/
private void replaceDef(SsaInsn def, SsaInsn prev, int length, ArrayList<RegisterSpec> newRegs) {
Type resultType = def.getResult().getType();
// Create new zeroed out registers for each element in the array
for (int i = 0; i < length; i++) {
Constant newZero = Zeroes.zeroFor(resultType.getComponentType());
TypedConstant typedZero = (TypedConstant) newZero;
RegisterSpec newReg = RegisterSpec.make(ssaMeth.makeNewSsaReg(), typedZero);
newRegs.add(newReg);
insertPlainInsnBefore(def, RegisterSpecList.EMPTY, newReg, RegOps.CONST, newZero);
}
}
Aggregations