[Soot-list] Interprocedural constant propagation and code folding

varun varun0007 at gmail.com
Thu Nov 12 01:26:26 EST 2009


Hi Attila,
  IF I am getting correctly then you are pointing out the static
evaluation of the expressions involved in determining the branch.
right ?
 My problem is simple . I have only booleans variables to deal with .
So this simplies the problem for me . Now I only need to track the
arguments which are boolean and passed as constant.
so code will be
A()
{
  B(false);
}

Now I just need to know while performing forwardflowanalysis
1) How inside B i get to know the hard coded value of parameter val in
method "A", i.e false [ This I can solve right now by storing the
variable and value in some datastructure, but I was wondering whether
Soot automatically do interprocedural constant propagation]
2) Main problem is in Jimple code once i know that one of the branch
in the if statement will not be executed [ as A calls B by hardcoding
value of parameter as false] then how I instruct forwardflowanalysis
framework to ignore the code of that unreachable branch.

I am extending ForwardFlowAnalysis interface and instantiate it as
ForwardFlowAnalysis<BriefUnitGraph,FlowSet>(BriefUnitGraph)

Thanks
Varun

On Wed, Nov 11, 2009 at 5:38 PM, Attila Bartha <at.bartha at gmail.com> wrote:
> Hi Varun
>
> It is not clear what your "target question" is, i.e. what result do you
> expect from your data analysis? Could you elaborate on that? What data do
> you want to calculate?
>
> The solution could be quite demanding. For instance, it could require
> symbolic calculation and algebra to deal with variables in conditions on the
> way. In this case, I am not aware of existing solutions using soot.
>
> To illustrate this, consider the example below. An interesting question
> would be:
>  What is the side effect of calling B, i.e. what "newScore" is "stored" and
> under which condition?
>
>
> B(boolean val){
>  if(val) {
>    print();
>    c();
>  }
>  else
>  {
>    int newScore = 0;
>    if (((cust.score > 100) && (cust.contracts.size() > 5)) || agent.role ==
> SUPERVISOR)
>    {
>      newScore = calcX(chances * 3);
>    }
>    else if (temperature > 21.5)
>    {
>      newScore = calcX((chances / 2 + cust.contracts.size() * 3);
>    }
>
>    if (newScore > cust.score)
>    {
>      store(cust, newScore);               <----- side effect
>    }
>  }
> }
>
> Best regards
>
> Attila
>
>
> -----Original Message-----
> From: soot-list-bounces at sable.mcgill.ca
> [mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of varun
> Sent: Mittwoch, 11. November 2009 19:13
> To: soot-list at sable.mcgill.ca
> Subject: [?? Probable Spam] [Soot-list] Interprocedural constant propagation
> and code folding
>
> Hi ,
>  I am new to soot. I have code similar to the following snippet
> A(){
>  boolean a = false;
>  B(a);
> }
>
>
> B(boolean val){
>  if(val){ print(); c();}
>  else{s();}
> }
>
> Now while performing interprocedural data analysis for method A , I
> retrieve the jimple body of method B. But now since argument val for B
> is false , I want to skip if part of the code in B. So somehow I need
> the constant propagation with dynamic code folding depending upon the
> parameters value. I am doing analysis in jimple format right now.
> Please let me know what can be the best way to achieve my target
> solution.
> Thanks
> Varun
> _______________________________________________
> 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