[Soot-list] Points-to Analysis for a multi-threaded program.

Ondrej Lhotak olhotak at uwaterloo.ca
Wed Jun 8 13:06:41 EDT 2011


Spark should generate an additional call edge from
java.lang.Thread.run() to MyThread.run(). It does that for me when I run
it on this example.

Ondrej

On Wed, Jun 08, 2011 at 09:27:18AM -0700, Moulik wrote:
> Hi,
> 
> I have been trying to run a points-to analysis on a simple multi-threaded Java
> program. The problem I am seeing is that after the Spark analysis is performed,
> the run() method remains un-analyzed (i.e. the points-to set of the variables
> inside the run() method are empty).
> 
> I tried to look into the Spark code and it seems like, when a call to the start
> () is encountered, an edge is created to the Thread.run() and not the run()
> method of the class that the user has implemented.
> 
> Below is the sample program I am trying to analyze;
> 
> class AliasClass{
>     public int [][]twoDArray;
>     public AliasClass() {}
> }
> 
> 
> class MyThread implements Runnable{
>     public AliasClass sharedObj;
> 
>     public MyThread(AliasClass paramObj) {
>     sharedObj = paramObj;
>     }
> 
>      // This run() method remains un-analyzed.
>     public void run() {
>     int [][]auxArr = sharedObj.twoDArray;
>     int []arr;
>     int j=0;
> 
>     for(j=0; j<10; ++j) {
>         arr = new int[10];
>         auxArr[j] = arr;
>     }
>     }
> }
> 
> public class TestAlias {
> 
>     public static void main(String[] args) {
> 
>     AliasClass obj = new AliasClass();
>     obj.twoDArray = new int[10][10]; // Allocate shared memory
>     Runnable myThread_obj1 = new MyThread(obj);
>     Runnable myThread_obj2 = new MyThread(obj);
> 
>     // Both threads will access the same shared object of the AliasClass.
>     Thread t_1 = new Thread(myThread_obj1);
>     Thread t_2 = new Thread(myThread_obj2);
>     t_1.start();
>     t_2.start();
>     }
> }
> 
> I am new to Soot and am not sure if I am missing something ?
> 
> Thanks and Regards,
> Moulik S.

> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list



More information about the Soot-list mailing list