[Soot-list] Re: Global variables in soot

Eric Bodden eric.bodden at mail.mcgill.ca
Fri May 4 15:57:56 EDT 2007


So in your example, would it ot suffice to say that...

 $i2 = <Test: int a>;

... here the expression "<Test: int a>" is available in $i2?

So whenever a field reference is assigned to a local, it's expression
is available in that local.

Eric

On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
> Hi,
>     I am trying to implement inter-procedural available expression
> analysis using call string approach. As far as i know, i have to take care
> of expressions which have only one or both operands as global and create a
> bitvector of only those expressions. If both variables in the expression
> are local then i need not care for such type of expressions. But its
> getting difficult for me now...
>
>
>
>
>
> On Fri, 4 May 2007, Eric Bodden wrote:
>
> > Hi again.
> >
> > Sorry but I overlooked something. As Patrick just reminded me,
> > points-to analysis only works for reference types, while the field in
> > your example is an int. So it seems like you would have to write your
> > own analysis for this.
> >
> > What are you actually trying to achieve?
> >
> > Eric
> >
> > On 04/05/07, Eric Bodden <eric.bodden at mail.mcgill.ca> wrote:
> >> Ah, I see.
> >>
> >> In this case, I think you need points-to analysis. You want to find
> >> out which values $i2 could possibly point to. We have some tutorials
> >> and papers about how to use points-to analysis in Soot online.
> >>
> >> Eric
> >>
> >> On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
> >> > for my below program, jimple is giving the following output
> >> >         int i0, i1, $i2, $i3;
> >> >          $i2 = <Test: int a>;
> >> >          i1 = $i2 * i0;
> >> >
> >> > so its treating $i2 as local since its getting declared. But actually it
> >> > represents variable 'a' which is global. I need this information for
> >> > interprocedural available expression analysis. So how do i resolve it ?
> >> >
> >> >
> >> >
> >> >
> >> > On Fri, 4 May 2007, Eric Bodden wrote:
> >> >
> >> > > Ok, so what you mean by global variables are actually fields. it's as
> >> > > I said: local variables are represented by soot.Local's and
> >> > > fields/global variables by soot.jimple.FieldRef's.
> >> > >
> >> > > Eric
> >> > >
> >> > > On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
> >> > >> By global variables i meant, which are available to all the methods of
> >> the
> >> > >> class.
> >> > >> class Test
> >> > >> {       static public int a=5;
> >> > >>         static public void main(String args[])
> >> > >>         {
> >> > >>                 int b=10,c;
> >> > >>                 c = a*b;
> >> > >>                 add(a,b);
> >> > >>         }
> >> > >>         static void add(int i, int j)
> >> > >>         {
> >> > >>                 i=i+j;
> >> > >>                 a=15;
> >> > >>         }
> >> > >> }
> >> > >> a is global, b,c are local to main. I want to find out such variables.
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >>
> >> > >> On Fri, 4 May 2007, Eric Bodden wrote:
> >> > >>
> >> > >> > What's a global variable?
> >> > >> >
> >> > >> > Soot knows variables of type soot.Local. Those are obviously local.
> >> > >> > Then there also are field references, which are obviously field
> >> > >> > references. Are those what you mean by global? (Of course, a local
> >> can
> >> > >> > well be assigned a field reference, the same way as it can happen in
> >> > >> > Java code.)
> >> > >> >
> >> > >> > Eric
> >> > >> >
> >> > >> > On 04/05/07, John Chaitanya Kati <johnkati at cse.iitb.ac.in> wrote:
> >> > >> >> Hi,
> >> > >> >>    Is there a way to find out if a variable is global or not in
> >> soot ?
> >> > >> >>
> >> > >> >> --
> >> > >> >> Thanks for any help in advance
> >> > >> >> John Chaitanya
> >> > >> >>
> >> > >> >
> >> > >> >
> >> > >> >
> >> > >>
> >> > >> --
> >> > >>
> >> > >> Thanks
> >> > >> John Chaitanya
> >> > >> Like a rose trampled on the ground, you took the fall and thought of
> >> me...
> >> > >>
> >> > >
> >> > >
> >> > >
> >> >
> >> > --
> >> >
> >> > Thanks
> >> > John Chaitanya
> >> > Like a rose trampled on the ground, you took the fall and thought of
> >> me...
> >> >
> >>
> >>
> >> --
> >> Eric Bodden
> >> Sable Research Group
> >> McGill University, Montréal, Canada
> >>
> >
> >
> >
>
> --
>
> Thanks
> John Chaitanya
> Like a rose trampled on the ground, you took the fall and thought of me...


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


More information about the Soot-list mailing list