[Soot-list] invokespecial side effects

Marc-André Laverdière-Papineau marc-andre.laverdiere-papineau at polymtl.ca
Sun Nov 3 21:41:21 EST 2013


Hello Daniel,

The examples you show are running the constructor. While they do change
the state of the object, they do not affect the def, as the local is not
re-defined. This is exactly what I would expect. Am I missing something?

I would expect them to be in the uses though - are they?

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 31/10/13 12:38 PM, Daniel Luchaup wrote:
> Hello,
> 
> I was wondering what is the best practice to deal with the side-effects
> of invokespecial; they are not listed as results.
> 
> Ideally each jimple statement that modifies a local should specify that
> local as a result.
> However, that is not the case for invokespecial. For instance (see
> complete example at the end of the email):
> ..............
>  (s1:)  $r2 = new java.lang.StringBuilder;
>  (s2:)  $r3 = ...
>  (s3:)  specialinvoke $r2.<java.lang.StringBuilder: void
> <init>(java.lang.String)>($r3);
>  (s4:)  use($r2);
> .............
> If I use SmartLocalDefs.getDefsOfAt($r2, (s2)), I get s1, but in fact
> $r2 was last modified at s3.
> It seems that, at least in this case, specialinvoke should have a result:
>   (s3:) $rX = specialinvoke $r2.<java.lang.StringBuilder: void
> <init>(java.lang.String)>($r3);
> 
> So, to get the real definition of $r2 that reaches (s4:) one would have
> to explicitly reason about the above code pattern.
> 
> Can this be done better?
> 
> Thank you
> Daniel
> 
> P.S. FYI: A more complete example:
> The jimple code for 'String copy1(String s1) { return s1+"!!!";}' contains:
>>>>>>
>         r0 := @this: dummy;
>         r1 := @parameter0: java.lang.String;
>         $r2 = new java.lang.StringBuilder;
>         $r3 = staticinvoke <java.lang.String: java.lang.String
> valueOf(java.lang.Object)>(r1);
>         specialinvoke $r2.<java.lang.StringBuilder: void
> <init>(java.lang.String)>($r3);
>         $r4 = virtualinvoke $r2.<java.lang.StringBuilder:
> java.lang.StringBuilder append(java.lang.String)>("!!!");
>         $r5 = virtualinvoke $r4.<java.lang.StringBuilder:
> java.lang.String toString()>();
>         return $r5;
> <<<<<
> 
> 
> 
> _______________________________________________
> 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