U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.

Slides:



Advertisements
Similar presentations
Advanced Compiler Techniques LIU Xianhua School of EECS, Peking University Pointer Analysis.
Advertisements

Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Pointer Analysis.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Deadlock Emery Berger and Mark Corner University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science 2007 Exterminator: Automatically Correcting Memory Errors with High Probability Gene.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
1 Practical Object-sensitive Points-to Analysis for Java Ana Milanova Atanas Rountev Barbara Ryder Rutgers University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Leveraging Interleaved Signal Edges for Concurrent Backscatter by Pan Hu, Pengyu.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Operating Systems CMPSCI 377 Lecture 11: Memory Management
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Advanced Compilers CMPSCI 710 Spring 2003 More data flow analysis Emery Berger.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Advanced Compilers CMPSCI 710 Spring 2003 Lecture 2 Emery Berger University of.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
5/2/2008Prof. P. N. Hilfinger CS164 Lecture 401 Pointer Analysis Lecture 40 (adapted from notes by R. Bodik)
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Interprocedural pointer analysis for C We’ll look at Wilson & Lam PLDI 95, and focus on two problems solved by this paper: –how to represent pointer information.
Advanced Compilers CSE 231 Instructor: Sorin Lerner.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Advanced Compilers CMPSCI 710 Spring 2003 Computing SSA Emery Berger University.
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science pH: A Parallel Dialect of Haskell Jim Cipar & Jacob Sorber University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Intraprocedural Points-to Analysis Flow functions:
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Swerve: Semester in Review. Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution.
ESP [Das et al PLDI 2002] Interface usage rules in documentation –Order of operations, data access –Resource management –Incomplete, wordy, not checked.
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Advanced Compilers CMPSCI 710 Spring 2003 Data flow analysis Emery Berger University.
Pointer and Shape Analysis Seminar Mooly Sagiv Schriber 317 Office Hours Thursday
Reps Horwitz and Sagiv 95 (RHS) Another approach to context-sensitive interprocedural analysis Express the problem as a graph reachability query Works.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Fast Points-to Analysis for Languages with Structured Types Michael Jung and Sorin A. Huss Integrated Circuits and Systems Lab. Department of Computer.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Advanced Compilers CMPSCI 710 Spring 2004 Lecture 1 Emery Berger University of Massachusetts,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science S HERIFF : Precise Detection & Automatic Mitigation of False Sharing Tongping Liu,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 Automatic Heap Sizing: Taking Real Memory into Account Ting Yang, Emery Berger,
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta
ESEC/FSE-99 1 Data-Flow Analysis of Program Fragments Atanas Rountev 1 Barbara G. Ryder 1 William Landi 2 1 Department of Computer Science, Rutgers University.
Pointer Analysis Survey. Rupesh Nasre. Aug 24, 2007.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India & K. V. Raghavan.
Pointer Analysis for Multithreaded Programs Radu Rugina and Martin Rinard M I T Laboratory for Computer Science.
Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
Pointer Analysis. Rupesh Nasre. Advisor: Prof R Govindarajan. Apr 05, 2008.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University.
Points-to Analysis as a System of Linear Equations Rupesh Nasre. Computer Science and Automation Indian Institute of Science Advisor: Prof. R. Govindarajan.
Evaluating the Precision of Static Reference Analysis Using Profiling Maikel Pennings, Donglin Liang, Mary Jean Harrold Georgia Institute of Technology.
Course topics Representing programs Analyzing and transforming programs Applications of these techniques.
Pointer Analysis CS Alias Analysis  Aliases: two expressions that denote the same memory location.  Aliases are introduced by:  pointers  call-by-reference.
Pick Your Contexts Well: Understanding Object-Sensitivity The Making of a Precise and Scalable Pointer Analysis Yannis Smaragdakis University of Massachusetts,
Inter-procedural analysis
Pointer Analysis – A Survey Vishwanath Raman (call me vishwa please) Dec. 1, 2004.
CS 412/413 Spring 2005Introduction to Compilers1 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 30: Loop Optimizations and Pointer Analysis.
Advanced Compiler Design
Pointer analysis.
Advanced Compiler Design
Pointer Analysis Jeff Da Silva Sept 20, 2004 CARG.
Procedure Linkages Standard procedure linkage Procedure has
Presentation transcript:

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710 Spring 2003 Pointer Analysis

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 2 Pointer Analysis (= alias analysis, = points-to analysis) Goal: statically determine possible runtime values of a pointer Necessary for optimizations, error detection Vital for C, C++ but: Undecidable Luckily: good approximations Trade-off efficiency & precision Result: points-to sets

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 3 Points-to sets if () p = &a; else p = &b; *p = 3; { a, b }

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 4 Analysis Sensitivity Flow-insensitive What may happen (on at least one path) Linear-time Flow-sensitive Consider control flow (what must happen) Iterative data-flow: possibly exponential Context-insensitive Call treated the same regardless of caller “Monovariant” analysis Context-sensitive Reanalyze callee for each caller “Polyvariant” analysis More sensitivity ) more accuracy, but more expense

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 5 Flow-Sensitive Pointer Analysis Too bad it’s exponential…

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 6 Flow-Insensitivity: Dimensions Address-taken Any object whose address is taken = potential alias Brain-dead, widely used in practice Equality-based Treat assignments as bidirectional Steensgaard’s Almost linear Subset-based Assignment is unidirectional Andersen’s Polynomial complexity Up to 30 times slower, but more precise

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 7 Steensgaard’s Algorithm p = q; pqpqpq

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 8 Andersen’s Algorithm p = &q; p = q; q r1r1 p r2r2 p r1r1 r2r2 q r3r3 p = &q; p = q; p = *q; *p = q;

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 9 Andersen’s Algorithm p = *q; *p = q; r1r1 r2r2 q s1s1 s2s2 s3s3 p p s1s1 s2s2 q r1r1 r2r2

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 10 Analysis Examples Compare points-to sets at S5: Address-taken One set of objects for whole program {heap S1, heap S4, heap S6, heap S8, local, p, q} Steensgaard’s Union two objects pointed to by same pointer into one {heap S1, heap S4, heap S6, local} Andersen’s Don’t merge objects {heap S1, heap S4, local}

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 11 More Dimensions Heap modeling Objects can be named by allocation site Source line, n-levels in call stack More sophisticated shape analysis Aggregate modeling Elements (of arrays structs, unions) distinct Or collapsed into one object

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 12 Haven’t We Solved This Problem Yet? From [Hind, 2001]: Past 21 years: at least 75 papers and nine Ph.D. theses published on pointer analysis

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 13 Many Publications…

U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 14 So Which Pointer Analysis is Best? Comparisons between algorithms difficult Size of points-to sets inadequate Model heap as one blob = one object for all heap pointers! Trade-offs unclear Faster pointer analysis can mean more objects = more time for client analysis More precise analysis can reduce client analysis time! Idea: use client to drive pointer analyzer…