Online Cycle Detection and Difference Propagation for Pointer Analysis David J. Pearce, Paul H.J. Kelly and Chris Hankin Imperial College, London

Slides:



Advertisements
Similar presentations
P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Advertisements

Analysis of programs with pointers. Simple example What are the dependences in this program? Problem: just looking at variable names will not give you.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Efficient Field-Sensitive Pointer Analysis for C David J. Pearce, Paul H.J. Kelly and Chris Hankin Imperial College, London, UK
A Batch Algorithm for Maintaining a Topological Order David J. Pearce and Paul H.J. Kelly Victoria University of Wellington, New Zealand & Imperial College,
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.
Improving code generation. Better code generation requires greater context Over expressions: optimal ordering of subtrees Over basic blocks: Common subexpression.
Prof. Bodik CS 164 Lecture 171 Register Allocation Lecture 19.
Register Allocation (via graph coloring)
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Chapter 13 Reduced Instruction Set Computers (RISC) Pipelining.
1 CS 201 Compiler Construction Lecture 6 Code Optimizations: Constant Propagation & Folding.
Register Allocation (via graph coloring). Lecture Outline Memory Hierarchy Management Register Allocation –Register interference graph –Graph coloring.
Overview of program analysis Mooly Sagiv html://
Improving Code Generation Honors Compilers April 16 th 2002.
CUTE: A Concolic Unit Testing Engine for C Technical Report Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Register Allocation John Cavazos University.
Win32 Programming Lesson 14: Introducing Windows Memory (C Rox…)
1 Latency-Bounded Minimum Influential Node Selection in Social Networks Incheol Shin
A dynamic algorithm for topologically sorting directed acyclic graphs David J. Pearce and Paul H.J. Kelly Imperial College, London, UK
CUTE: A Concolic Unit Testing Engine for C Koushik SenDarko MarinovGul Agha University of Illinois Urbana-Champaign.
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
Instructor: Dr. GautamDas February 24, 2009 Class notes by Ranganath M R.
LINKED LISTS.
Single Static Assignment Intermediate Representation (or SSA IR) Many examples and pictures taken from Wikipedia.
3.5 Solving systems of equations in three variables Main Ideas Solve systems of linear equations in three variables. Solve real-world problems using systems.
Component 1.6.
Garbage Collection What is garbage and how can we deal with it?
Introduction to Optimization
Code Optimization.
User-Written Functions
Fundamentals of Programming II Bucket Sort: An O(N) Sort Algorithm
Top 50 Data Structures Interview Questions
Simone Campanoni Dependences Simone Campanoni
Chapter 13: Pointers, Classes, Virtual Functions, and Abstract Classes
Compiler Construction (CS-636)
Dataflow analysis.
The compilation process
Programming Languages and Compilers (CS 421)
Lecture No.43 Data Structures Dr. Sohail Aslam.
UNIT-3 LINKED LIST.
The minimum cost flow problem
CS 332: Algorithms Hash Tables David Luebke /19/2018.
Oracle SQL*Loader
Introduction to Algorithms
Algorithm Design and Analysis
Hash functions Open addressing
Compiler Construction
Topic 10: Dataflow Analysis
Introduction to Optimization
CMPE 152: Compiler Design October 4 Class Meeting
Chapter 6 Intermediate-Code Generation
SAT-Based Area Recovery in Technology Mapping
Dataflow analysis.
Pointers.
Introduction to Optimization
Solve Systems of Linear Inequalities
C021TV-I2-S2.
Module 12a: Dynamic Hashing
Chapter 12 Pipelining and RISC
C Programming Pointers
Course Overview PART I: overview material PART II: inside a compiler
Compiler Construction
CUTE: A Concolic Unit Testing Engine for C
Creating and Using Pointer Variables in C++ By: Ed Brunjes
Verifying Dijktra’s algorithm in Jahob
(via graph coloring and spilling)
Garbage Collection What is garbage and how can we deal with it?
Lecture-Hashing.
Presentation transcript:

Online Cycle Detection and Difference Propagation for Pointer Analysis David J. Pearce, Paul H.J. Kelly and Chris Hankin Imperial College, London

What is Pointer Analysis?  Determine targets of pointer variables without running program Analysis would conclude: p  {a}  In general this problem is undecidable >Any solution may be conservative >Must contain actual targets and may contain extra targets - e.g. p  {a,b}  Applications >Compiler – do statements interfere? If not, e.g. can reorder them. >Verification – e.g. can we show there are no NULL pointer errors? int a,b,*p; p = &a;

Constraint Graphs  One node per variable, edges represent assignments  But, what about “ *q = s ” ? >e.g. if q  {a,b} add edges s  b, s  a >Add new edges as solution for q becomes known p = &a; r = &b q = &c; q = p; q = r; pqr {a}{b} {c}

Constraint Graphs  One node per variable, edges represent assignments  But, what about “ *q = s ” ? >e.g. if q  {a,b} add edges s  a, s  b >Add new edges as solution for q becomes known p = &a; r = &b q = &c; q = p; q = r; pqr {a}{b} {a,b,c}

Speeding up Pointer Analysis  Online cycle detection >Variables in cycle must have same solution >Replacing cycles with single node reduces work >Hence, we have designed algorithm for online cycle detection  Difference Propagation >Original idea due to Fecht and Seidl [FS98] >Attempt to reduce cost of propagation -Set union operation typically linear in size of smallest set -Can reduce set size by preventing unnecessary repropagation pq {a}{b}

Empirical Data make LOC uucp LOC gawk LOC bash LOC Execution time (s), to solve constraint graph Notes OCD = Online Cycle Detection 900 MHz Athlon, with 1GB RAM Doesn’t include time to generate or parse constraints and to build initial constraint graph OCD OCD + Diff Prop Diff Prop Base bash 2.05gawk 3.1.0uucp make

Useful Insight  Working with large benchmarks (> 100 KLOC) >Memory requirements prohibitive >Many duplicate solution sets >Hash table scheme from [HT01] addresses this: -Sets stored in hash table with size as hash key -Can actually decrease execution time -Reduces memory requirements by factors of 10 or more  The Heintze-Tardieu Solver >Generally, faster than worklist algorithm – but why? - Doesn’t explore entire graph until complex statements resolved - Because always recomputes solution from scratch? >Doesn’t extend well to some more interesting ideas -For example, worklist algorithm better for modeling integer variables