use of soot.IntegerType in project soot by Sable.
the class ConstraintCollector method caseIfStmt.
public void caseIfStmt(IfStmt stmt) {
if (uses) {
ConditionExpr cond = (ConditionExpr) stmt.getCondition();
BinopExpr expr = cond;
Value lv = expr.getOp1();
Value rv = expr.getOp2();
TypeVariable lop = null;
TypeVariable rop = null;
// ******** LEFT ********
if (lv instanceof Local) {
if (((Local) lv).getType() instanceof IntegerType) {
lop = resolver.typeVariable((Local) lv);
}
} else if (lv instanceof DoubleConstant) {
} else if (lv instanceof FloatConstant) {
} else if (lv instanceof IntConstant) {
int value = ((IntConstant) lv).value;
if (value < -32768) {
lop = resolver.INT;
} else if (value < -128) {
lop = resolver.SHORT;
} else if (value < 0) {
lop = resolver.BYTE;
} else if (value < 2) {
lop = resolver.R0_1;
} else if (value < 128) {
lop = resolver.R0_127;
} else if (value < 32768) {
lop = resolver.R0_32767;
} else if (value < 65536) {
lop = resolver.CHAR;
} else {
lop = resolver.INT;
}
} else if (lv instanceof LongConstant) {
} else if (lv instanceof NullConstant) {
} else if (lv instanceof StringConstant) {
} else if (lv instanceof ClassConstant) {
} else {
throw new RuntimeException("Unhandled binary expression left operand type: " + lv.getClass());
}
// ******** RIGHT ********
if (rv instanceof Local) {
if (((Local) rv).getType() instanceof IntegerType) {
rop = resolver.typeVariable((Local) rv);
}
} else if (rv instanceof DoubleConstant) {
} else if (rv instanceof FloatConstant) {
} else if (rv instanceof IntConstant) {
int value = ((IntConstant) rv).value;
if (value < -32768) {
rop = resolver.INT;
} else if (value < -128) {
rop = resolver.SHORT;
} else if (value < 0) {
rop = resolver.BYTE;
} else if (value < 2) {
rop = resolver.R0_1;
} else if (value < 128) {
rop = resolver.R0_127;
} else if (value < 32768) {
rop = resolver.R0_32767;
} else if (value < 65536) {
rop = resolver.CHAR;
} else {
rop = resolver.INT;
}
} else if (rv instanceof LongConstant) {
} else if (rv instanceof NullConstant) {
} else if (rv instanceof StringConstant) {
} else if (rv instanceof ClassConstant) {
} else {
throw new RuntimeException("Unhandled binary expression right operand type: " + rv.getClass());
}
if (rop != null && lop != null) {
TypeVariable common = resolver.typeVariable();
if (rop != null)
rop.addParent(common);
if (lop != null)
lop.addParent(common);
}
}
}
use of soot.IntegerType in project soot by Sable.
the class ConstraintCollector method caseIdentityStmt.
public void caseIdentityStmt(IdentityStmt stmt) {
Value l = stmt.getLeftOp();
Value r = stmt.getRightOp();
if (l instanceof Local) {
if (((Local) l).getType() instanceof IntegerType) {
TypeVariable left = resolver.typeVariable((Local) l);
TypeVariable right = resolver.typeVariable(r.getType());
right.addParent(left);
}
}
}
use of soot.IntegerType in project soot by Sable.
the class ConstraintCollector method handleInvokeExpr.
private void handleInvokeExpr(InvokeExpr ie) {
if (!uses)
return;
// Handle the parameters
SootMethodRef method = ie.getMethodRef();
for (int i = 0; i < ie.getArgCount(); i++) {
if (ie.getArg(i) instanceof Local) {
Local local = (Local) ie.getArg(i);
if (local.getType() instanceof IntegerType) {
TypeVariable localType = resolver.typeVariable(local);
localType.addParent(resolver.typeVariable(method.parameterType(i)));
}
}
}
if (ie instanceof DynamicInvokeExpr) {
DynamicInvokeExpr die = (DynamicInvokeExpr) ie;
SootMethodRef bootstrapMethod = die.getBootstrapMethodRef();
for (int i = 0; i < die.getBootstrapArgCount(); i++) {
if (die.getBootstrapArg(i) instanceof Local) {
Local local = (Local) die.getBootstrapArg(i);
if (local.getType() instanceof IntegerType) {
TypeVariable localType = resolver.typeVariable(local);
localType.addParent(resolver.typeVariable(bootstrapMethod.parameterType(i)));
}
}
}
}
}
Aggregations