Fast Points-to Analysis for Languages with Structured Types Michael Jung and Sorin A. Huss Integrated Circuits and Systems Lab. Department of Computer.

Slides:



Advertisements
Similar presentations
Dataflow Analysis for Datarace-Free Programs (ESOP 11) Arnab De Joint work with Deepak DSouza and Rupesh Nasre Indian Institute of Science, Bangalore.
Advertisements

R O O T S Field-Sensitive Points-to-Analysis Eda GÜNGÖR
Scalable Points-to Analysis. Rupesh Nasre. Advisor: Prof. R. Govindarajan. Comprehensive Examination. Jun 22, 2009.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part R4. Disjoint Sets.
Carnegie Mellon Lecture 7 Instruction Scheduling I. Basic Block Scheduling II.Global Scheduling (for Non-Numeric Code) Reading: Chapter 10.3 – 10.4 M.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Analysis of programs with pointers. Simple example What are the dependences in this program? Problem: just looking at variable names will not give you.
Demand-driven Alias Analysis Implementation Based on Open64 Xiaomi An
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Parallel Inclusion-based Points-to Analysis Mario Méndez-Lojo Augustine Mathew Keshav Pingali The University of Texas at Austin (USA) 1.
Static Data Race detection for Concurrent Programs with Asynchronous Calls Presenter: M. Amin Alipour Software Design Laboratory
School of Computer Science A Global Progressive Register Allocator David Ryan Koes Seth Copen Goldstein Carnegie Mellon University
The Ant and The Grasshopper Fast and Accurate Pointer Analysis for Millions of Lines of Code Ben Hardekopf and Calvin Lin PLDI 2007 (Best Paper & Best.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
Aliases in a bug finding tool Benjamin Chelf Seth Hallem June 5 th, 2002.
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
Program analysis Mooly Sagiv html://
Speeding Up Dataflow Analysis Using Flow- Insensitive Pointer Analysis Stephen Adams, Tom Ball, Manuvir Das Sorin Lerner, Mark Seigle Westley Weimer Microsoft.
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.
Program analysis Mooly Sagiv html://
1 Control Flow Analysis Mooly Sagiv Tel Aviv University Textbook Chapter 3
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
A Type-Checked Restrict Qualifier Jeff Foster OSQ Retreat May 9-10, 2001.
Pointer Analysis for CASH Compiler Framework Deepak Garg Himanshu Jain Spring 2005.
Intraprocedural Points-to Analysis Flow functions:
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Swerve: Semester in Review. Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution.
Overview of program analysis Mooly Sagiv html://
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
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.
An Efficient Inclusion-Based Points-To Analysis for Strictly-Typed Languages John Whaley Monica S. Lam Computer Systems Laboratory Stanford University.
Overview of program analysis Mooly Sagiv html://
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Points-to Analysis in Almost Linear Time paper by Bjarne Steensgaard 23rd ACM Symposium on Principles of Programming Languages (POPL'96) Microsoft Research.
Procedure Optimizations and Interprocedural Analysis Chapter 15, 19 Mooly Sagiv.
Control Flow Resolution in Dynamic Language Author: Štěpán Šindelář Supervisor: Filip Zavoral, Ph.D.
Recursion. Basic problem solving technique is to divide a problem into smaller subproblems These subproblems may also be divided into smaller subproblems.
Lecture 10 : Introduction to Java Virtual Machine
Integrated Circuits and Systems Laboratory Darmstadt University of Technology Design Space Exploration of incompletely specified Embedded Systems.
A GPU Implementation of Inclusion-based Points-to Analysis Mario Méndez-Lojo (AMD) Martin Burtscher (Texas State University, USA) Keshav Pingali (U.T.
CMPE 511 Computer Architecture A Faster Optimal Register Allocator Betül Demiröz.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Code Optimization 1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture of a.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
A Certifying Compiler and Pointer Logic Zhaopeng Li Software Security Lab. Department of Computer Science and Technology, University of Science and Technology.
Pointer Analysis as a System of Linear Equations. Rupesh Nasre (CSA). Advisor: Prof. R. Govindarajan. Jan 22, 2010.
Mark Marron IMDEA-Software (Madrid, Spain) 1.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta
Convergence of Model Checking & Program Analysis Philippe Giabbanelli CMPT 894 – Spring 2008.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Pointer Analysis Survey. Rupesh Nasre. Aug 24, 2007.
Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
CS 343 presentation Concrete Type Inference Department of Computer Science Stanford University.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
D A C U C P Speculative Alias Analysis for Executable Code Manel Fernández and Roger Espasa Computer Architecture Department Universitat Politècnica de.
Points-to Analysis as a System of Linear Equations Rupesh Nasre. Computer Science and Automation Indian Institute of Science Advisor: Prof. R. Govindarajan.
Cyclomatic Complexity Philippe CHARMAN Last update:
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
Introduction to C Programming Language
Applied Algorithms (Lecture 17) Recursion Fall-23
Hongtao Yu Wei Huo ZhaoQing Zhang XiaoBing Feng
Pointer analysis.
Course Overview PART I: overview material PART II: inside a compiler
Pointer Analysis Jeff Da Silva Sept 20, 2004 CARG.
Presentation transcript:

Fast Points-to Analysis for Languages with Structured Types Michael Jung and Sorin A. Huss Integrated Circuits and Systems Lab. Department of Computer Science Technische Universität Darmstadt, Germany

Outline A points-to analysis is applied to answer questions like: „Which variables might be accessed by expression *a->b?“ Motivation – Why is this of benefit to know? Code Motion Partial Evaluation Design decisions for a points-to analysis Concepts of Steensgaard‘s points-to analyses Differences between proposed and original PTA Results

MULT r1, b, c STORE r1, (a) LOAD r2, (e) ADD d, r2, f Motivation – Code Motion... *a = b * c; d = *e + f; LOAD r2, (e) MULT r1, b, c STORE r1, (a) LOAD r2, (e) ADD d, r2, f Optimize CPU utilization by code motion RAW hazard on r2 LOAD is multi cycle Pipeline stalled a = &g; e = &g; *a = b * c; d = *e + f; RAW violation If the sets of locations a and e may point to are disjoint → optimization is correct Points-to analysis computes conservative approximation of these sets ANSI C restrict type qualifier: void f(int n, int * restrict p, int * restrict q) { while (n--) *p++ = *q++; }

Motivation – Partial Evaluation int power(int x, unsigned n) { int r=1; while (n) { if (n&1) r=r*x; x=x*x; n=n>>1; } return r; } x : dynamic n : static void power_gen(unsigned n) { printf(„void power(int x, unsigned n) {\n“); printf(„ int r=1;\n“); printf(„ assert(n==%d);\n“, n); while (n) { if (n&1) printf(„ r=r*x;\n“); printf(„ x=x*x;\n“); n=n>>1; } printf(„ return r;\n}“); } n = 3 void power(int x, unsigned n) { int r=1; assert(n==3); r=r*x; x=x*x; r=r*x; x=x*x; return r; } Relation to Points-to Analysis: Can expression *y statically be evaluated?

int *p, a, b; if (a) { p = &a; } else { p = &b; } b = *p; int *p, a, b; if (a) { p = &a; f(p); } else { p = &b; f(p); } b = *p; Storage Shape Graphs p a b PT( *p )={ a,b } PTA computes a storage shape graph undecidable -> conservative approx. Tradeoff between efficiency and accuracy flow sensitivity p b PT( *p )={ b } p a PT( *p )={ a } context sensitivity complexity of storage shape graph pa,b PT( *p )={ a,b } Steensgaard‘s first algorithm [1]: flow insensitive context insensitive graph complexity O(n) almost linear time complexity 80/20 rule: 80% benefit, 20% cost [2] [1] B. Steensgaard. Points-to analysis in almost linear time. In Symposium on Principles of Programming Languages, 1996 [2] M.Hind and A.Pioli. Which pointer analysis should I use? In International Symposium on Software Testing and Analysis, 2000

Concepts of Steensgaard‘s PTA abc de abc de ab,dc e a c,e a = &d; Keeping the storage shape graph O(N) Disjoint-set forests ([2]) => Join is O(α(N,N)) => Analysis O(Nα(N,N)) [2] R.Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM, 1975 Data flow direction (Pending Joins) a=&b; a=c; c ab c=&d; b,d NIL Join( )

Points-to Analysis Comparison I object simplestruct blank [4] 4 types of nodes: s->a = &a; s->b = &b; *(*int)s = c; s a b s a,b struct object Single kind of representation: Node with fields  simple  blank  struct Contra: Memory layout dependent Pro: Conceptually simpler (algorithm less complex) More precise in case of inconsistent access [4] B.Steensgaard. Points-to Analysis by type inference of programs with structures and unions. In Computational Complexity, 1996 simple

Points-to Analysis Comparison II struct { int *a, *b, *c } s; int **d, f, g, h; s.a = &f; s.b = &g; s.c = &h; d = &s->a; d = &s->b; d f g h s s d f g h s d f g h d f g h s d f g h s d f g h s d f g h s d f g h s d f g h s d f g h s d f g h s dsf,g,hdf,g h d h f g Points-to( **d ) = { f, g, h }Points-to( **d ) = { f, g } Steensgaard‘s Analysis [4]Proposed Analysis 1.Graph Initialization: One node per variable - Join nodes as necessary - Establish links 2.Iterate over statements

Data Structures Abstract locations Fields Field extents Pointer offset range Storage shape graphs are composed of

Relations Intervals-overlap rel.: Sub-interval relation: Field inclusion: Assignment data flow: field extents pointer offset ranges 1 o field extentspointer offset ranges 1 o *a = s *b;

Constraints Deduction Example x = *y;

Results number of variables aliased benchmarkLOC bc6, espresso11, li7, Twelve benchmarks from Todd Austin‘s as well as from the SPEC92 benchmarks. Excerpt: Benchmarks common for Points-To Analyses Hard to compare Steensgaard‘s second paper does not report on this kind of results...

Conclusions We propose an improvement to Steensgard‘s PTA, of which we feel confident that it is more precise than, as fast as, conceptually simpler and thus easier to implement than the original. Thanks for your attention!