[Soot-list] Soot and abc updates

Laurie Hendren, Prof hendren at cs.mcgill.ca
Mon Aug 28 14:06:43 EDT 2006


Jingwu Li has recently submitted a masters project on the topic of
speeding up soot/abc.

You can read the details of his work at:

http://www.sable.mcgill.ca/publications/techreports/#report2006-3


Here is a brief summary of the changes that he made in both the
abc cvs and the soot svn repositories.

Changes made in Soot:
=====================

The changes in soot are trivial. The changes are mainly for HashSet
operations in flowanalysis.

(1) soot/toolkits/scalar/SmartLocalDefs.LocalDefsAnalysis.flowThrow()
In the original code, there are two places to invoke localDef() method
with same parameter "u". This can be reduced to one method call by
introduce a variable to store the result returned from localDef() method.

Another potential performance penalty in this method is that it will add
local "inU" into HashSet "out" even if "inU" is contained in defsOf(l).
Later on, it uses removeAll() to get rid of those added local elements
contained in defsOf(l). To reduce the cost, we can check whether "inU" is
contained by defsOf(l) before add it into HashSet "out" variable.

(2) soot/toolkits/scalar/SmartLocalDefs.LocalDefsAnalysis.copy()
The old method first clear the destination set then add all elements
from the source set into destination set. If some elements in the source
set already contained in the destination set, we may waste time to
remove the elements then add them again. So we use two iterations to
achieve the copy
operation. First iteration performs intersection of two sets. Second
iteration adds all elements contained in source set but not contained in
destination set into destination set.

(3) soot/toolkits/graph/UnitGraph.getSuccsOf()
In the old method, the returned result of unitToSuccs.get(u) itself can 
be used to check whether the map unitToSuccs contains key "u" or not. So 
we can avoid the call to unitToSuccs.containsKey(u) method to check the
existence of "u".

Changes made in abc:
====================

(1) around weaving:
Before creating a new shadow extracted method, we check whether there is
any identical shadow extracted method already residing in the shadow 
class or not. If there is one, we will use that one without creation of 
an new one.
abc/weaving/weaver/around/AdviceApplicationInfo.doWeave()
 
AdviceApplicationInfo.extractShadowIntoStaticMethodNew()
                           some helper classes

(2) around inlining:
In original abc, it does not check whether the new created "inline\$"
method exists in the advice class or not. So this cause abc generates 
many duplicated methods and uses an additional phase to remove those 
duplicated methods.
To improve the performance, when doing inlining, we first check whether
there is an identical "inline\$" method in the target class or not by
using the signature constructed by contacting three integer type arguments
values, arguments types, method's signature and target class name. If
there exits one, we just reuse it instead of creating an new "inline$"
method.
abc/weaving/weaver/AdviceInliner.inlineMethods()

In both AdviceInliner.java and AdviceApplicationInfo.java class, set
isEnableDupCheck filed to true to enable
the checking the duplication for new created methods. Set isEnableDupCheck
to false, will use the original strategy.


More information about the Soot-list mailing list