[Soot-list] Extract method with preserved jumps
Eric Bodden
bodden at st.informatik.tu-darmstadt.de
Wed Nov 25 13:51:09 EST 2009
Hi Attila.
You should never ever try to use the *same* Unit instances in multiple
method bodies. Always try to clone the units or to somehow else make
copies of them. Otherwise you will definitely run into the problems
you mention.
JimpleBody implements a clone() method. I think that should help you there.
Eric
--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478 Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
2009/11/25 Attila Bartha <at.bartha at gmail.com>:
> Hi
>
>
>
> I am trying to extract selected Jimple code into a new method, i.e. move a
> range of units from body A to a new method’s body B.
>
> Adding the units to the B’s unit chain works fine. Jumps are preserved.
>
> However, when I remove those units form A’s unit chain, the jumps are
> removed, too. Thus, it changes the units in B!
>
> This is probably because PatchingChain remove(Object) calls
> ((Unit)obj).redirectJumpsToThisTo(successor); , and there is no alternative
> remove method.
>
>
>
> How can I make sure that the jumps are preserved when removing them from A?
>
> Is there such an example in one of the existing transformations?
>
> Or can it be fixed by replacing A’s unit chain with a new one to avoid
> having to call remove() ?
>
>
>
> Regards
>
>
>
> Attila
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
More information about the Soot-list
mailing list