Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Hierarchical Pointer AnalysisAmir Kamil Hierarchical Pointer Analysis for Distributed Programs Amir Kamil U.C. Berkeley December 7, 2005.

Similar presentations


Presentation on theme: "1 Hierarchical Pointer AnalysisAmir Kamil Hierarchical Pointer Analysis for Distributed Programs Amir Kamil U.C. Berkeley December 7, 2005."— Presentation transcript:

1 1 Hierarchical Pointer AnalysisAmir Kamil Hierarchical Pointer Analysis for Distributed Programs Amir Kamil U.C. Berkeley December 7, 2005

2 2 Amir KamilHierarchical Pointer Analysis Background Titanium is a single program, multiple data (SPMD) dialect of Java All threads execute the same program text Designed for distributed machines Global address space – all threads can access all memory At runtime, threads are grouped into processes A thread shares a physical address space with some other, but not all threads

3 3 Amir KamilHierarchical Pointer Analysis Memory Hierarchy Global memory is composed of a hierarchy Locations can be thread-local (tlocal), process- local (plocal), or in another process (global) 0123 tlocalplocal global Threads Program Processes

4 4 Amir KamilHierarchical Pointer Analysis Goal Our goal is to produce a (flow-insensitive) pointer analysis that takes the memory hierarchy into account We define a small SPMD language based on Titanium We produce a type system that accounts for the memory hierarchy We give an overview of the abstract pointer analysis

5 5 Amir KamilHierarchical Pointer Analysis Language Syntax Types  ::= int | ref q  Qualifiers q ::= tlocal | plocal | global (tlocal @ plocal @ global) Expressions e ::= new l  (allocation) | transmit e 1 from e 2 (communication) | e 1 Ã e 2 (dereferencing assignment)

6 6 Amir KamilHierarchical Pointer Analysis Type Rules – Allocation  ` new l  : ref tlocal  Thread 0 new l int tlocal The expression new l  allocates space of type  in local memory and returns a reference to the location The label l is unique for each allocation site and will be used by the pointer analysis The resulting reference is qualified with tlocal, since it references thread-local memory

7 7 Amir KamilHierarchical Pointer Analysis Type Rules – Communication  ` e 1 :  ` e 2 : int  ` transmit e 1 from e 2 : expand( , global) Thread 0Thread 1 y global tlocal transmit y from 1 The expression transmit e 1 from e 2 evaluates e 1 on the thread given by e 2 and retrieves the result If e 1 has reference type, the result type must be widened to global Statically do not know source thread, so must assume it can be any thread expand(ref q , q’) ´ ref t (q, q’)  expand( , q’) ´  otherwise

8 8 Amir KamilHierarchical Pointer Analysis Type Rules – Dereferencing Assignment The expression e 1 Ã e 2 puts the value of e 2 into the location referenced by e 1 (like *e 1 = e 2 in C) If e 1 has type ref plocal ref tlocal , and e 2 has type ref tlocal , the assignment could be unsound Thread 0Thread 1 y z plocal tlocal plocal  ` e 1 : ref q  ` e 2 :  robust( , q)  ` e 1 Ã e 2 : ref q  robust(ref q , q’) ´ false if q @ q’ robust( , q’) ´ true otherwise

9 9 Amir KamilHierarchical Pointer Analysis Pointer Analysis Since language is SPMD, analysis is only done for a single thread (assume thread 0) Each expression has a points-to set of abstract locations that it can reference Abstract locations also have points-to sets Abstract locations consist of label and qualifier A-loc (l, q) can refer to any concrete location allocated at label l and with type qualifier v q from thread 0 Thread 0 new l int tlocal Thread 1 new l int tlocal (l, tlocal) (l, plocal)

10 10 Amir KamilHierarchical Pointer Analysis Pointer Analysis – Allocation and Communication The abstract semantics for allocation and communication are similar to the type rules An allocation new l  produces a new abstract location (l, tlocal) The result of the expression transmit e 1 from e 2 is the global versions of the a-locs resulting from e 1 e 1 ! {(l 1, tlocal), (l 2, plocal), (l 3, global)} transmit e 1 from e 2 ! {(l 1, global), (l 2, global), (l 3, global)}

11 11 Amir KamilHierarchical Pointer Analysis Pointer Analysis – Dereferencing Assignment For assignment, must take into account actions of other threads Thread 0 x (l 1, tlocal) y (l 2, tlocal) Thread 1 x (l 1, plocal) y (l 2, plocal) Thread 2 x (l 1, plocal) y (l 2, plocal) x ! {(l 1, tlocal)}, y ! {(l 2, plocal)} x à y : (l 1, tlocal) ! (l 2, plocal), (l 1, plocal) ! (l 2, plocal), (l 1, global) ! (l 2, global)

12 12 Amir KamilHierarchical Pointer Analysis Race Detection Results Static race detection in Titanium using pointer analysis + concurrency analysis Most are false positives, so lower is better BenchmarkNo Pointer Analysis One-Level Analysis Two-Level Analysis gas2482779223 gsrb51218718 lu-fact4901771 pps7026182726 spmv4431770


Download ppt "1 Hierarchical Pointer AnalysisAmir Kamil Hierarchical Pointer Analysis for Distributed Programs Amir Kamil U.C. Berkeley December 7, 2005."

Similar presentations


Ads by Google