[Soot-list] one question about the local variables

Laurie Hendren hendren at cs.mcgill.ca
Wed Aug 31 06:01:58 EDT 2011


Hi Jiangfan,

The point is that the variables themselves do not alias,  but the 
contents of the variables may alias when the variable stores the address 
of an object.

Unlike in languages like C,  the address of a local variable in Java 
cannot be taken,  so there is no way to create an alias to the variable 
itself in Java.

Cheers, Laurie


+-----------------------------------------------------------------
| Laurie Hendren, Professor, School of Computer Science, McGill
| On sabbatical until August 31, 2011.
| hendren at cs.mcgill.ca,  http://www.sable.mcgill.ca/~hendren
| New McLab Project:  http://www.sable.mcgill.ca/mclab
| Other Research: http://www.sable.mcgill.ca  http://aspectbench.org
+----------------------------------------------------------------


On 31/08/2011 1:43 AM, jiangfan shi wrote:
> Dear All,
>
> I may ask a simple question here, but I really do not understand that. 
>  Some papers related to points-to analysis say the following:
>
> "Local variables (including formals) for both primitive and reference 
> types in Java cannot  have aliases."
>
> Maybe I do not capture the point, but I could not understand why local 
> variables can not have aliases? For example,
>
> void m1(){
>
> MyClass o1=new MyClass();
> MyClass o2=new MyClass();
>
> o1=o2;
>
> }
>
> For the above code snippet, m1 is a method, and MyClass is a class. 
> Doesn't the last assignment statement make these two local variables, 
> o1 and o2, alias?
>
> For another example related to formal parameters,
>
> void m2(MyClass o1, MyClass o2){
>
> o1=o2;
> }
>
> With the same explanation of these symbols, I am thinking o1 and o2 
> are now alias.
>
> Any hints are highly appreciated, Thanks.
>
> Jiangfan
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110831/4c038a9f/attachment.html 


More information about the Soot-list mailing list