Set Constraint-Based Program Analysis Manuel Fähndrich CS590 UW Spring 2001.

Slides:



Advertisements
Similar presentations
R O O T S Field-Sensitive Points-to-Analysis Eda GÜNGÖR
Advertisements

CS848: Topics in Databases: Foundations of Query Optimization Topics covered  Introduction to description logic: Single column QL  The ALC family of.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Carnegie Mellon Lecture 7 Instruction Scheduling I. Basic Block Scheduling II.Global Scheduling (for Non-Numeric Code) Reading: Chapter 10.3 – 10.4 M.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
Current Techniques in Language-based Security David Walker COS 597B With slides stolen from: Steve Zdancewic University of Pennsylvania.
Simplified Gated Assignment Surinder Jain Supervisor : Bernhard Scholz Assignment 3 – INFO5993.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Type-Based Flow Analysis: From Polymorphic Subtyping to CFL-Reachability Jakob Rehof and Manuel Fähndrich Microsoft Research.
Demand-driven Alias Analysis Implementation Based on Open64 Xiaomi An
Flow-Insensitive Points-to Analysis with Term and Set Constraints Presentation by Kaleem Travis Patrick.
Type checking © Marcelo d’Amorim 2010.
A Fixpoint Calculus for Local and Global Program Flows Swarat Chaudhuri, U.Penn (with Rajeev Alur and P. Madhusudan)
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India.
SYMBOLIC MODEL CHECKING: STATES AND BEYOND J.R. Burch E.M. Clarke K.L. McMillan D. L. Dill L. J. Hwang Presented by Rehana Begam.
Parallel Inclusion-based Points-to Analysis Mario Méndez-Lojo Augustine Mathew Keshav Pingali The University of Texas at Austin (USA) 1.
CATCH: Case and Termination Checker for Haskell Neil Mitchell (Supervised by Colin Runciman)
CS412/413 Introduction to Compilers Radu Rugina Lecture 16: Efficient Translation to Low IR 25 Feb 02.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Constraint Problems in Program Analysis from the sublime to the ridiculous Alex Aiken Stanford University.
School of Computing and Mathematics, University of Huddersfield CAS810: WEEK 3 LECTURE: LAMBDA CALCULUS PRACTICAL/TUTORIAL: (i) Do exercises given out.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Pointer and Shape Analysis Seminar Context-sensitive points-to analysis: is it worth it? Article by Ondřej Lhoták & Laurie Hendren from McGill University.
Context-Sensitive Flow Analysis Using Instantiation Constraints CS 343, Spring 01/02 John Whaley Based on a presentation by Chris Unkel.
Prof. Aiken CS 294 Lecture 41 Constraint-Based Analysis Lecture 4.
Ch 2.2: Separable Equations In this section we examine a subclass of linear and nonlinear first order equations. Consider the first order equation We can.
Run time vs. Compile time
Pointer Analysis for CASH Compiler Framework Deepak Garg Himanshu Jain Spring 2005.
Pointer Analysis for CASH Compiler Framework Deepak Garg Himanshu Jain Spring 2005.
Java Alias Analysis for Online Environments Manu Sridharan 2004 OSQ Retreat Joint work with Rastislav Bodik, Denis Gopan, Jong-Deok Choi.
Swerve: Semester in Review. Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution.
Projects. Dataflow analysis Dataflow analysis: what is it? A common framework for expressing algorithms that compute information about a program Why.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Machine-Independent Optimizations Ⅰ CS308 Compiler Theory1.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
CS B 553: A LGORITHMS FOR O PTIMIZATION AND L EARNING Structure Learning.
8/19/2015© Hal Perkins & UW CSEC-1 CSE P 501 – Compilers Parsing & Context-Free Grammars Hal Perkins Winter 2008.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
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.
Programming Languages by Ravi Sethi Chapter 6: Groupings of Data and Operations.
1 November 1, November 1, 2015November 1, 2015November 1, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University Azusa.
© Copyright 2010 Hewlett-Packard Development Company, L.P. 1 Rick Hank, Loreena Lee, Rajiv Ravindran, Hui Shi Java, Compilers & Tools Lab, Hewlett Packard,
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Detecting Equality of Variables in Programs Bowen Alpern, Mark N. Wegman, F. Kenneth Zadeck Presented by: Abdulrahman Mahmoud.
Featherweight X10: A Core Calculus for Async-Finish Parallelism Jonathan K. Lee, Jens Palsberg Presented By- Vasvi Kakkad.
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.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India & K. V. Raghavan.
Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
Types and Programming Languages Lecture 11 Simon Gay Department of Computing Science University of Glasgow 2006/07.
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.
1 Proving program termination Lecture 5 · February 4 th, 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A.
Sept 12ICSM'041 Precise Identification of Side-Effect-Free Methods in Java Atanas (Nasko) Rountev Ohio State University.
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
The Ins and Outs of Gradual Type Inference Avik Chaudhuri Basil Hosmer Adobe Systems Aseem Rastogi Stony Brook University.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Manuel Fahndrich Jakob Rehof Manuvir Das
Lecture 7: Constrained Conditional Models
Names and Attributes Names are a key programming language feature
Dataflow analysis.
Pointer Analysis Lecture 2
Review for the Midterm Exam
Pointer Analysis Lecture 2
자바 언어를 위한 정적 분석 (Static Analyses for Java) ‘99 한국정보과학회 가을학술발표회 튜토리얼
Presentation transcript:

Set Constraint-Based Program Analysis Manuel Fähndrich CS590 UW Spring 2001

This Lecture Constraint-based program analysis –Set constraint basics –Application: closure analysis –Relation to typing Constraint resolution Extensions –Context-sensitivity –Control-flow sensitivity

Constraint-Based Analysis Static Info Source Constraint Generator Solu- tions Solver Mapping  Constraints

Specification—Implementation Static Info Source Constraint Generator Solu- tions Solver Mapping Implementation ProblemSpecification  Constraints

Example: Andersen’s Points-To int **x,*y; int *z,w; if (..) x=&y; else x=&z; *x=&w; Constraint Generator Solver Mapping x z y w

Set Constraints Set expressions E ::= X | 0 | E  E | E  E |  E | c(E,...,E) | c -i (E) Constructors c  C, fixed arity Constraints ^ i L i  R i Solution  : X ! H ^ i  (L i )   (R i )

Complexity Full language: NEXPTIME complete Useful polynomial subset O(n 3 ) –no variable negation –restricted intersection and union –equivalent to CFL reachability, 2NPDA In practice? –Proportional to explicit solutions

Brief History 1969: Reynolds 1979: Jones and Muchnick 90’s –Heintze: Set-Based Analysis –Complexity results –Applications 00’s –Efficient resolution techniques

Example: Closure Analysis calculus Question: which lambda’s x are applied where? One solution in paper, but we’ll do another one. –Local specification instead of global –First: type inference e ::= x | x.e | e 1 e 2 E ::= X | E 1 ! E 2 | E 1  E 2 | E 1  E 2 | x

Quick reminder: Function types R 1 ! L 1  L 2 ! R 2  L 1  R 2 ^ L 2  R 1

Constraint Generation Rules x.e [x] ! [e]  [ x.e] e 1 e 2 [e 1 ]  [e 2 ] ! [e 1 e 2 ] Example twice = f. x.f(f(x)) ((A ! B)  (B ! C)) ! (A ! C)

Twice Example Set Variables [f] = F [x] = A [f x] = B [f(f x)] = C [ x.f(f(x))] = R [ f. x.f(f(x))] = T Constraints F ! R  T A ! C  R F  B ! C F  A ! B Simplify R = A ! C F = A ! B  B ! C T = F ! R

Observation Types + constraints establish value flow Think of it as pipes Can flow information in these pipes –E.g. closure analysis –Tokens = lambda names x, f

twice ( z.z) [z] = Z [ z.z] = I [twice s ( z.z)] = S Z ! Z  I T  I ! S

Closure Analysis using Typing Inject at lambda abstraction x.e [x] ! [e]  x  [ x.e] Observe at application e 1 p e 2 [e 1 ]  [e 2 ] ! [e 1 e 2 ]  X p

Closure Analysis: twice ( z.z) [f] = F [x] = A [f x] = B [f c (f b x)] = C [ x.f(f(x))] = R [ f. x.f(f(x))] = T [z] = Z [ z.z] = I [twice s ( z.z)] = S Constraints F ! R  f  T A ! C  x  R F  B ! C  X c F  A ! B  X b Z ! Z  z  I T  I ! S  X s Results f  X s z  X c z  X b x  S

Closure on Closure Analysis Purely local formulation –In paper: at application (f x) q.e  [f] => [x]  [q] ^ [e]  [f x]for all q.e Size of constraints? Non-standard resolution –In lecture [f]  [x] ! [f x] Standard resolution

Constraint Resolution Can be black box –But not when figuring out a good encoding Resolution = Constraint rewriting –In practice graph completion

Graph Completion Sources and sinks are non-variable expressions, eg. a function ! node New edges when sources meet sinks ! ! ( ) [ ] CFL reachability: [... ] (.. )

Extensions: Context Sensitivity CFL reachability again –Interleaved CFL is undecidable –Reduce to single CFL perfectly nested CFL non-recursive case: –expand call problem away by inlining –expand data problem away by flattening Other approximations?

Extensions: Control-flow Sensitivity Local state –SSA form Heap state –??? –Need symbolic methods

Conclusions Specification vs. implementation –Separation –Reuse –Non-obvious algorithms Set constraints are one hammer –if it fits, great –otherwise, don’t bother, but be sure It’s all graphs and reachability