[Soot-list] question about Soot optimization
Mu Zhang
muzhang82 at gmail.com
Tue Apr 24 19:29:48 EDT 2012
Hi,
I have a question about Soot optimization. I'm writing a program to
instrument Java bytecode and using Soot to remove redundant code. However,
I found Soot was not able to optimize the instrumented code in some cases.
Here is an example and the redundant instructions are in black:
public int cryptWrapper(int, tester.BoolWrapper, tester.BoolWrapper,
tester.BoolWrapper)
{
tester.B r0;
int i0, i1, $i2;
tester.BoolWrapper r1, r2, r3;
boolean z0, z1, z3, z4;
r0 := @this: tester.B;
i0 := @parameter0: int;
r1 := @parameter1: tester.BoolWrapper;
r2 := @parameter2: tester.BoolWrapper;
r3 := @parameter3: tester.BoolWrapper;
*z0 = r2.<tester.BoolWrapper: boolean b>;*
z1 = r1.<tester.BoolWrapper: boolean b>;
z3 = r3.<tester.BoolWrapper: boolean b>;
$i2 = r0.<tester.B: int key>;
i1 = i0 ^ $i2;
z4 = z1 | 0;
* r2.<tester.BoolWrapper: boolean b> = z0;*
r1.<tester.BoolWrapper: boolean b> = z1;
r3.<tester.BoolWrapper: boolean b> = z4;
return i1;
}
Basically, z0 is assigned with r2.b and later is assigned to r2.b without
any modification in between. I was wondering if it is because Soot
considers r2.b to be an object field with side-effects and thus doesn't
optimize it. If that is true, I'm curious to know how Soot determine
whether a local has side-effects or not. Does it simply consider all
objects have side-effects? Also, is there a way to trick Soot and bypass
the check, so that it can optimize some certain instructions that may have
side-effects?
Thanks,
Mu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120424/5e277c49/attachment.html
More information about the Soot-list
mailing list