[Soot-list] A question on Jimple generation

flanker017 flankerhqd017 at gmail.com
Wed May 6 09:26:59 EDT 2015


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/0a464013/attachment.html 


More information about the Soot-list mailing list