[Soot-list] one question about a mismatch between Jimple- and Java-representation
jiangfan shi
jiangfan.shi at gmail.com
Fri Aug 19 22:42:32 EDT 2011
Hello All,
I found one mismatch for a small program. More specifically it is for the
method, Method1(). I change the method color to blue for clarification for
both representations.
===========Start Java Representation==========
public class TestcaseForSoot2 {
int myint;
void Method1(TestcaseForSoot2 a,TestcaseForSoot2 b){
TestcaseForSoot2 x=new TestcaseForSoot2();
x.myint=5;
a=x;
}
public static void main(String[] args){
TestcaseForSoot2 tmp=new TestcaseForSoot2();
tmp.Method1(tmp,tmp);
}
}
===========End Java Representation==========
===========Start Jimple Representation==========
public class TestcaseForSoot2 extends java.lang.Object
{
int myint;
public void <init>()
{
TestcaseForSoot2 r0;
r0 := @this: TestcaseForSoot2;
specialinvoke r0.<java.lang.Object: void <init>()>();
return;
}
void Method1(TestcaseForSoot2, TestcaseForSoot2)
{
TestcaseForSoot2 r0, r1, r2, $r3, r4, r5;
r0 := @this: TestcaseForSoot2;
r1 := @parameter0: TestcaseForSoot2;
r2 := @parameter1: TestcaseForSoot2;
$r3 = new TestcaseForSoot2;
specialinvoke $r3.<TestcaseForSoot2: void <init>()>();
r4 = $r3;
r4.<TestcaseForSoot2: int myint> = 5;
r5 = r4; //
<================================ Problem line
return;
}
public static void main(java.lang.String[])
{
java.lang.String[] r0;
TestcaseForSoot2 $r1, r2;
r0 := @parameter0: java.lang.String[];
$r1 = new TestcaseForSoot2;
specialinvoke $r1.<TestcaseForSoot2: void <init>()>();
r2 = $r1;
virtualinvoke r2.<TestcaseForSoot2: void
Method1(TestcaseForSoot2,TestcaseForSoot2)>(r2, r2);
return;
}
}
======================End Jimple Representation==================
My question is about a line "r5 = r4;" with red color and with a label
"Problem line" shown above. I think it should be "r1=r4". Otherwise the
semantic meaning of Method1() between Java and Jimple is different. In Java,
it says the first parameter "a" is pointing to a newly created object "x",
and then it further implies that the "x" escapes from Method1(); in Jimple,
it says one local reference variable "r5" is pointing to a newly created
object "x", and it says nothing about the parameter "a" and then the implied
"escape" meaning.
Any hints are highly appreciated.
Jiangfan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110819/d5c50cc0/attachment.html
More information about the Soot-list
mailing list