Class FillArrayTransformer
- java.lang.Object
-
- com.googlecode.dex2jar.ir.ts.StatedTransformer
-
- com.googlecode.dex2jar.ir.ts.array.FillArrayTransformer
-
- All Implemented Interfaces:
Transformer
public class FillArrayTransformer extends StatedTransformer
require SSA, usually run after ConstTransformer 1. array is fixed size. 2. array object init and use once, (exclude the element assignment) 3. all elements are init with fixed index before use. 4. the array is not in PhiExpr 5. and for array object init at A, use at B; A and B must in same loop/path, so G(A->B), G(A->C->B), G(A->C, A->D,C->B,D->B), G(A->C,C->D,D->C,C->B) and G(A->C,C->A,C->B) is ok to transform, but for G(A->C,C->B, B->D,D->C), B is in a loop (B->D->C->B), should not transformed.transform
a=new String[3] a[0]="123" a[2]="1234" a[1]="12345" return ato
return new String[3] { "123", "12345", "1234" }1. This Transformer is useful when cleanup the tool-injected reflection code
// before transform ... Class a[]=new Class[2] a[0]=String.class a[1]=int.class Method m=x.getMethod("methodA",a) Object b[]=new Object[2] b[0]="123"; b[1]=Integer.valueOf(1); m.invoke(c,b) // after transform Method m=x.getMethod("methodA", new Class[2] { String.class ,int.class }); m.invoke(b,new Object[]{"123",Integer.valueOf(1)})2. Suggest decompilers generate better code
// for following code, before transform, the decompiler generate same source Object[]a=new Object[2]; a[0]=b; a[1]=c String.format("b is %s, c is %s",a) // after transform, then decompile generate the following source String.format("b is %s, c is %s",b,c)FIXME also handle not full filled array
int a[] = new int[5]; // a[0]=0; a[1] = 1; a[2] = 3; a[3] = 4; a[4] = 7;
-
-
Constructor Summary
Constructors Constructor Description FillArrayTransformer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String... args)protected java.util.Set<com.googlecode.dex2jar.ir.ts.array.FillArrayTransformer.ArrayObjectValue>markUsed(java.util.Collection<com.googlecode.dex2jar.ir.ts.array.FillArrayTransformer.ArrayObjectValue> values)booleantransformReportChanged(IrMethod method)-
Methods inherited from class com.googlecode.dex2jar.ir.ts.StatedTransformer
transform
-
-
-
-
Method Detail
-
main
public static void main(java.lang.String... args)
-
transformReportChanged
public boolean transformReportChanged(IrMethod method)
- Specified by:
transformReportChangedin classStatedTransformer
-
markUsed
protected java.util.Set<com.googlecode.dex2jar.ir.ts.array.FillArrayTransformer.ArrayObjectValue> markUsed(java.util.Collection<com.googlecode.dex2jar.ir.ts.array.FillArrayTransformer.ArrayObjectValue> values)
-
-