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

mbatch at cs.mcgill.ca mbatch at cs.mcgill.ca
Tue Jan 23 11:30:54 EST 2007


While the JVM specs do allow for an almost arbitrary distance between
instatiation sites and their corresponding constructor calls, there is a
bit more to it. The bytecode verifier will sometimes get cranky if there
is complicated control flow between the two sites.

That being said, there is a New2InitFlowAnalysis class in
soot.jbco.jimpleTransformations that attempts to collect a form of use-def
type ranges. This is used in the JBCO obfuscator for limiting complex
control flow between the new and init statements in this transformation:
soot.jbco.jimpleTransformations.AddSwitches. It probably does not yield as
much information as you may be looking for, but it might help you get
started if you don't want to change the actual program (and thus
JimpleConstructorFolder would not be appropriate for you).

Good luck!

Michael

On Tue, January 23, 2007 10:18 am, Eric Bodden wrote:
> 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



More information about the Soot-list mailing list