use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.
the class RemoveLocalFromSSATest method t001.
@Test
public void t001() {
Local a = addLocal("a");
Local b = addLocal("b");
Local c = addLocal("c");
Stmt sa = addStmt(nAssign(a, nInt(0)));
addStmt(nAssign(b, a));
addStmt(nAssign(c, b));
Stmt sb = addStmt(nReturn(c));
transform();
Assert.assertEquals(sa.getOp1(), sb.getOp());
Assert.assertEquals("1 local should left", 1, locals.size());
}
use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.
the class SSATransformerTest method test01HugeLocalStmt.
/**
* Test for huge local and stmt size
*/
@Test
public void test01HugeLocalStmt() {
for (int i = 0; i < 2000; i++) {
Local b = addLocal("a");
addStmt(nAssign(b, nString("123")));
}
Local b = addLocal("a");
for (int i = 0; i < 20000; i++) {
addStmt(nAssign(b, nString("123")));
}
addStmt(nReturn(b));
transform();
}
use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.
the class SSATransformerTest method test03NotInsertPhiInLoop.
@Test
public void test03NotInsertPhiInLoop() {
Local b = addLocal("a");
addStmt(nAssign(b, nString("123")));
LabelStmt L1 = newLabel();
LabelStmt L2 = newLabel();
addStmt(L1);
addStmt(Stmts.nIf(Exprs.niEq(nInt(0), nInt(9)), L2));
addStmt(Stmts.nNop());
addStmt(Stmts.nIf(Exprs.niEq(nInt(0), nInt(9)), L1));
addStmt(L2);
addStmt(nReturn(b));
transform();
Assert.assertEquals(1, method.locals.size());
}
use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.
the class SSATransformerTest method test04NotInsertPhiLoop2.
@Test
public void test04NotInsertPhiLoop2() {
Local b = addLocal("a");
addStmt(nAssign(b, nString("123")));
LabelStmt L1 = newLabel();
LabelStmt L2 = newLabel();
addStmt(L1);
addStmt(Stmts.nIf(Exprs.niEq(nInt(0), nInt(9)), L2));
addStmt(Stmts.nNop());
addStmt(Stmts.nIf(Exprs.niEq(nInt(0), nInt(9)), L1));
addStmt(Stmts.nNop());
addStmt(L2);
addStmt(Stmts.nIf(Exprs.niEq(nInt(0), nInt(9)), L1));
addStmt(Stmts.nNop());
addStmt(nReturn(b));
transform();
Assert.assertTrue("no phi should add", method.locals.size() == 1);
}
use of com.googlecode.dex2jar.ir.expr.Local in project dex2jar by pxb1988.
the class StmtListTest method toStringTest.
@Test
public void toStringTest() {
StmtList list = new StmtList();
Local a = nLocal("this");
Local b = nLocal("b");
Local c = nLocal("c");
Local d = nLocal("d");
LabelStmt L1 = Stmts.nLabel();
list.add(Stmts.nIdentity(a, nThisRef("La/Some;")));
list.add(Stmts.nIdentity(b, nParameterRef("I", 0)));
list.add(Stmts.nIdentity(c, nParameterRef("J", 1)));
list.add(Stmts.nIdentity(d, nParameterRef("F", 2)));
list.add(Stmts.nIf(nGt(b, nInt(0), "I"), L1));
list.add(Stmts.nAssign(c, nCast(d, "F", "J")));
list.add(L1);
list.toString();
}
Aggregations