[Soot-list] A question on Jimple generation

Steven Arzt Steven.Arzt at cased.de
Wed May 6 09:52:34 EDT 2015


Hi,

 

Theoretically, both lines could indeed use the same local. However, omitting the field read is tough as it would require an analysis to detect that the field cannot be changed in the meantime. This would be possible, but it is not trivial if you have non-trivial code.

 

In general, feel free to contribute simplifying transformers to the Soot project.

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von flanker017
Gesendet: Mittwoch, 6. Mai 2015 15:27
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] A question on Jimple generation

 

Hi all: 

 

I have a question on local allocation in jimple body generation, hope someone could kindly shed some light on this.

 

For the following source code:

 

class TestActivity{

   Intent intent;

    public void test7()

    {

        intent = new Intent();

        intent.setClass(this, TestActivity.class);

        startActivity(intent);

    }

}

 

The following jimple is generated:

 

    public void test7()

    {

        TestActivity r0;

        android.content.Intent $r1, $r2, $r3;

 

        r0 := @this: TestActivity;

 

        $r1 = new android.content.Intent;

 

        specialinvoke $r1.<android.content.Intent: void <init>()>();

 

        r0.<TestActivity: android.content.Intent intent> = $r1;

 

        $r2 = r0.<TestActivity: android.content.Intent intent>; //line 7

 

        virtualinvoke $r2.<android.content.Intent: void setClass(android.content.Context,java.lang.Class)>(r0, class "TestActivity"); //line 8

 

        $r3 = r0.<TestActivity: android.content.Intent intent>; //line9

 

        virtualinvoke r0.<TestActivity: void startActivity(android.content.Intent)>($r3); //line 10

 

        return;

    }

 

Why can't line9 and line7 use the same local $r2, but use two locals $r3 and $r2? Aren't them identical?

 

If only on local is used, line9 can be omitted and line10 will be         virtualinvoke r0.<TestActivity: void startActivity(android.content.Intent)>($r2); 

 

Thanks for any help on this question!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150506/d26d0c66/attachment.html 


More information about the Soot-list mailing list