[Soot-list] coupling between an allocation site and the constructorinvocation site

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Jan 23 17:49:34 EST 2007


Hi.

In generall, this is not so easy due to polymorphism. Monomorphic calls
(i.e. to static or private methods) can however be inlined using the
StaticInliner class, respectively the pack "wjop.si".


Eric


> -----Original Message-----
> From: Peng Li [mailto:lipeng360 at gmail.com]
> Sent: Tuesday, January 23, 2007 5:36 PM
> To: Eric Bodden
> Cc: soot-list at sable.mcgill.ca
> Subject: Re: [Soot-list] coupling between an allocation site and the
> constructorinvocation site
> 
> HI Eric,
> It works very good, thanks.
> 
> Right now, I have another question related my project, suppose I have
> the following pesucode,
> Class{
> method1( )
> {
> A a = new A();
> B b = new B();
> method2 (a, b);
> }
> 
> method2(A a, B b)
> {
> C c = null;
> c=a;
> b=c;
> }
> }
> 
> I am just wondering if soot has any methods can inline method2() into
> method1() correctly and then yield the following code,
> 
> Class{
> method1( )
> {
> A a = new A();
> B b = new B();
> C c = null;
> c=a;
> b=c;
> }
> 
> I have tried to do that by myself but it seems that it is not easy. I
> remembered that I have read something about inline function in this
> list, but could not find it. Could anyone give me a link or some idea
> about how to do that using soot?
> 
> 
> Cheers
> Peng
> 
> 2007/1/23, Eric Bodden <eric.bodden at mail.mcgill.ca>:
> > It depends. Generally, the invocation of the constructor can be
> (almost)
> > arbitrarily far away from the object instantiation. This is just
> > according to the JVM specs. The only limitation is that it has to
> occur
> > before any other use of the variable.
> >
> > Having said that, Soot has a class JimpleConstructorFolder, which is
> a
> > BodyTransformer. If you apply this transformation to your method
body
> in
> > question, it will soundly move each such constructor invocation
> directly
> > behind the "new" statement.
> >
> >
> > Eric
> >
> >
> > > -----Original Message-----
> > > From: soot-list-bounces at sable.mcgill.ca [mailto:soot-list-
> > > bounces at sable.mcgill.ca] On Behalf Of Peng Li
> > > Sent: Monday, January 22, 2007 10:10 PM
> > > To: soot-list at sable.mcgill.ca
> > > Subject: [Soot-list] coupling between an allocation site and the
> > > constructorinvocation site
> > >
> > > HI
> > > For each instantiation of an object in java is represented as two
> > > jimple stmts, one newstmt and one specialinvoke stmt(constructor
> > > invocation site). I am just wondering if there is a easy and
simple
> > > method to find the constructor invocation site based on the
> allocation
> > > site which i specified?
> > >
> > > Cheers
> > > Peng
> > > _______________________________________________
> > > 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