Improvement of partail evaluator
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
In optimizing mode, when applying code/*, code like this :
public static int m(int a) {
int b = a + 1;
b = b + 2;
return b;
}
is transformed to this:
public static int m(int a) {
return a + 1 + 2;
}
Ideally the code would be transformed to return a + 3;
While not easy, it would be an evolution of constant propagation : do you plan such modification for ProGuard?
Handling limited cases might be relatively easy through peephole optimizations. Respecting the constant sizes in the generated instructions would be the trickiest part.
Handling the general case would indeed require extending the partial evaluator and related classes. Representing the expressions is easy, but applying the simplifications in the right places is not.
I'll consider the peephole optimizations.