[Soot-list] one question about a mismatch between Jimple- and Java-representation

jiangfan shi jiangfan.shi at gmail.com
Sat Aug 20 00:40:46 EDT 2011


Just for the completeness of this discussion, for the code below, in which
the "myobj" field is a reference field with a type myObj1, Soot successfully
translated it with the use of "r1", which is corresponding to the first
parameter, "a".

==============Java======================
 void Method1(TestcaseForSoot2_discussion2 a,TestcaseForSoot2_discussion2
b){
    myObj1 x=new myObj1();
    x.myobjint=5;
    a.myobj=x;
}

==============Jimple======================
 void Method1(TestcaseForSoot2_discussion2, TestcaseForSoot2_discussion2)
    {
        TestcaseForSoot2_discussion2 r0, r1, r2;
        myObj1 $r3, r4;

        r0 := @this: TestcaseForSoot2_discussion2;
        r1 := @parameter0: TestcaseForSoot2_discussion2;
        r2 := @parameter1: TestcaseForSoot2_discussion2;
        $r3 = new myObj1;
        specialinvoke $r3.<myObj1: void <init>()>();
        r4 = $r3;
        r4.<myObj1: int myobjint> = 5;
        r1.<TestcaseForSoot2_discussion2: myObj1 myobj> = r4;
        return;
    }

jiangfan

On Fri, Aug 19, 2011 at 11:23 PM, jiangfan shi <jiangfan.shi at gmail.com>wrote:

> I see, it uses the pass-by-value for the parameter passing of a method call
> in Java. Thanks.
>
> jiangfan
>
>
> On Fri, Aug 19, 2011 at 11:14 PM, jiangfan shi <jiangfan.shi at gmail.com>wrote:
>
>>
>>> I am not sure why you say "x" escapes from Method1. Do you think if
>>> you print a.myint in the caller after Method1 returns, it will print 5
>>> (i.e., the value that is assigned inside Method1)?
>>>
>>
>> Yes, I think so.
>>
>> But I just tried with one example, I found "x" did not escapes from
>> Method1. Could you please tell me why? Thanks a lot.
>>
>> jiangfan
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110819/4b9fe24f/attachment.html 


More information about the Soot-list mailing list