Faculty of Computer Science LCPC 2007 Using ZBDDs in Points-to Analysis Stephen Curial Jose Nelson Amaral Department of Computing Science University of.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
BDDs & Theorem Proving Binary Decision Diagrams Dr. Eng. Amr T. Abdel-Hamid NETW 703 Winter 2012 Network Protocols Lectures are based on slides by: K.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
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.
1 Don´t Care Minimization of *BMDs: Complexity and Algorithms Christoph Scholl Marc Herbstritt Bernd Becker Institute of Computer Science Albert-Ludwigs-University.
Introduction Combining two frameworks
Class Presentation on Binary Moment Diagrams by Krishna Chillara Base Paper: “Verification of Arithmetic Circuits using Binary Moment Diagrams” by.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
ECE 667 Synthesis & Verification - Boolean Functions 1 ECE 667 Spring 2013 ECE 667 Spring 2013 Synthesis and Verification of Digital Circuits Boolean Functions.
Binary Decision Diagrams. ROBDDs Slide 2 Example Directed acyclic graph non-terminal node terminal node What function is represented by the graph?
1 ROBDD’s represents a logic function by a graph (DAG). (many logic functions can be represented compactly - usually better than SOP’s)represents a logic.
Spring 07, Feb 13 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Binary Decision Diagrams Vishwani D. Agrawal James.
3/25  Monday 3/31 st 11:30AM BYENG 210 Talk by Dana Nau Planning for Interactions among Autonomous Agents.
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.
DATE-2002TED1 Taylor Expansion Diagrams: A Compact Canonical Representation for Symbolic Verification M. Ciesielski, P. Kalla, Z. Zeng B. Rouzeyre Electrical.
Administrative info Subscribe to the class mailing list –instructions are on the class web page, which is accessible from my home page, which is accessible.
ECE Synthesis & Verification - Lecture 18 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Word-level.
Another example p := &x; *p := 5 y := x + 1;. Another example p := &x; *p := 5 y := x + 1; x := 5; *p := 3 y := x + 1; ???
High-Performance Simulation of Quantum Computation using QuIDDs George F. Viamontes, Manoj Rajagopalan, Igor L. Markov, and John P. Hayes Advanced Computer.
Boolean Functions and their Representations
A New Approach to Structural Analysis and Transformation of Networks Alan Mishchenko November 29, 1999.
Rolf Drechlser’s slides used
Sanjit A. Seshia and Randal E. Bryant Computer Science Department
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 16, 2003.
EE290A 1 Retiming of AND- INVERTER graphs with latches Juliet Holwill 290A Project 10 May 2005.
A Compressed Breadth-First Search for Satisfiability DoRon B. Motter and Igor L. Markov University of Michigan, Ann Arbor.
Taylor Expansion Diagrams (TED): Verification EC667: Synthesis and Verification of Digital Systems Spring 2011 Presented by: Sudhan.
Swerve: Semester in Review. Topics  Symbolic pointer analysis  Model checking –C programs –Abstract counterexamples  Symbolic simulation and execution.
ECE Synthesis & Verification - Lecture 10 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Binary.
 2001 CiesielskiBDD Tutorial1 Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA
ECE 667 Synthesis & Verification - BDD 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Binary Decision Diagrams (BDD)
 2000 M. CiesielskiPTL Synthesis1 Synthesis for Pass Transistor Logic Maciej Ciesielski Dept. of Electrical & Computer Engineering University of Massachusetts,
IT University of Copenhagen Lecture 8: Binary Decision Diagrams 1. Classical Boolean expression representations 2. If-then-else Normal Form (INF) 3. Binary.
Cloning-Based Context-Sensitive Pointer Alias Analysis using BDDs John Whaley Monica Lam Stanford University June 10, 2004.
By Tariq Bashir Ahmad Taylor Expansion Diagrams (TED) Adapted from the paper M. Ciesielski, P. Kalla, Z. Zeng, B. Rouzeyre,”Taylor Expansion Diagrams:
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: BDD BDDs applied in equivalence checking.
B. Alizadeh Advanced Logic Design (2008) 1 / 55 Decision Diagrams.
Identifying Reversible Functions From an ROBDD Adam MacDonald.
Binary Decision Diagrams (BDDs)
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
Algorithmic Software Verification V &VI. Binary decision diagrams.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Pointer Analysis – Part II CS Unification vs. Inclusion Earlier scalable pointer analysis was context- insensitive unification-based [Steensgaard.
Binary decision diagrams (BDD’s) Compact representation of a logic function ROBDD’s (reduced ordered BDD’s) are a canonical representation: equivalence.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
1 Class Presentation on Binary Moment Diagrams by Krishna Chillara Base Paper: “Verification of Arithmetic Circuits with Binary Moment Diagrams” by Randal.
BDDs1 Binary Tree Representation The recursive Shannon expansion corresponds to a binary tree Example: Each path from the root to a leaf corresponds to.
Evaluating the Precision of Static Reference Analysis Using Profiling Maikel Pennings, Donglin Liang, Mary Jean Harrold Georgia Institute of Technology.
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
2009/6/30 CAV Quantifier Elimination via Functional Composition Jie-Hong Roland Jiang Dept. of Electrical Eng. / Grad. Inst. of Electronics Eng.
1 Computing Abstractions by integrating BDDs and SMT Solvers Alessandro Cimatti Fondazione Bruno Kessler, Trento, Italy Joint work with R. Cavada, A. Franzen,
Binary Decision Diagrams Prof. Shobha Vasudevan ECE, UIUC ECE 462.
IT 60101: Lecture #121 Foundation of Computing Systems Lecture 13 Trees: Part VIII.
Planning as model checking, (OBDDs)
Online Subpath Profiling
Chain Reduction for Binary and Zero-Suppressed Decision Diagrams
ECE 667 Synthesis and Verification of Digital Systems
Binary Decision Diagrams
Discrete Controller Synthesis
Binary Decision Diagrams
Objectives Add, subtract, multiply, and divide functions.
Presentation transcript:

Faculty of Computer Science LCPC 2007 Using ZBDDs in Points-to Analysis Stephen Curial Jose Nelson Amaral Department of Computing Science University of Alberta Ondrej Lhotak D. R. Cheriton School of Computer Science, University of Waterloo

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Introduction  Points-to analysis is important –Many compiler transformations require this information –Precise analysis of large programs often infeasible due to space requirements  Binary Decision Diagrams (BDDs) –Compact representation of relations  Zerro-suppressed BDDs (ZBDDs) –Successfully used in other domains Circuit design, model checking, verification –Haven’t been used to represent relations Need to develop relational product operation

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Background - What Are Binary Decision Diagrams (BDDs) F(x 1 x 2 x 3 )= x1x1 x2x2 x2x2 x3x3 x3x3 x3x3 x3x3 10 OBDD x1x1 1 Non-terminal Node BDD Variable 0 / false / lo -edge 1 / true / hi -edge Terminal Node Legend

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 BDDs are Canonical  2 reduction rules: 1.When two BDD nodes p and q are identical, edges leading to q are changed to lead to p, and q is eliminated from the BDD. 2.A BDD node p whose one-edge and zero-edge both lead to the same node q is eliminated from the BDD and the edges leading to p are redirected to q.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Background - What Are Binary Decision Diagrams (BDDs) F(x 1 x 2 x 3 )= x1x1 x2x2 x2x2 x3x3 x3x3 x3x3 x3x3 10 OBDD ROBDD x1x1 x2x2 x2x2 x3x3 x3x3 1 0

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Using ROBDDs to represent points-to relations We compute the may point-to relation: PT = {(a,L 1 ); (a,L 2 ); (b,L 1 ); (b,L 2 ); (c,L 1 ); (c,L 2 ); (c,L 3 )} We compute the may point-to relation: PT = {(a,L 1 ); (a,L 2 ); (b,L 1 ); (b,L 2 ); (c,L 1 ); (c,L 2 ); (c,L 3 )} Code v 1 v 2 v 3 v 4 fTfT x x PointerCode a00 b01 c10 Code v 1 v 2 v 3 v 4 fTfT x 1100x 1101x 1110x 1111x L 1 : a = new O(); L 2 : b = new O(); L 3 : c = new O(); a = b; b = a; c = b; ObjectCode L1L1 00 L2L2 01 L3L3 10 After Berndl-Lhotak et al., PLDI03

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Using ROBDDs to represent points-to relations Code v 1 v 2 v 3 v 4 fTfT x x PointerCode a00 b01 c10 Code v 1 v 2 v 3 v 4 fTfT x 1100x 1101x 1110x 1111x ObjectCode L1L1 00 L2L2 01 L3L3 10 v1v1 v2v2 v2v2 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v3v3 v3v3 v3v3 v3v3 10 After Berndl-Lhotak et al., PLDI03

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Using ROBDDs to represent points-to relations Code v 1 v 2 v 3 v 4 fTfT x x PointerCode a00 b01 c10 Code v 1 v 2 v 3 v 4 fTfT x 1100x 1101x 1110x 1111x ObjectCode L1L1 00 L2L2 01 L3L3 10 v1v1 v2v2 v2v2 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v4v4 v3v3 v3v3 v3v3 v3v3 10 After Berndl-Lhotak et al., PLDI03 Notice that many elements in the domain are un-assigned. - Potentially wasting space

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Why do we have don’t care values?  To represent relations efficiently with BDDs a binary encoding is used. –2 n encodings but domain may be smaller then 2 n E.g. A domain with 3 elements needs to be encoded using 2 bits.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 One-of-N encoding  One-of-N encoding can eliminate unused bit patterns. –n elements uses n bits a b c d e f Example of a One-of-N encoding:

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDDs are Efficient with a One-of-N Encoding A ZBDD is efficient if: There are few vectors in the on-set. The elements in the on-set have very few 1’s. For every 1 in an encoding that is part of the onset, there will be a path to the 1 terminal.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 What is a ZBDD  2 nd reduction rule changed: 1.When two BDD nodes p and q are identical, edges leading to q are changed to lead to p, and q is eliminated from the BDD. 2.A BDD node, p, whose one-edge leads to the zero terminal node and whose zero-edge leads to a node, q, is removed from the BDD and the edges leading to p are redirected to q. [Minato94]

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 OBDD vs. ROBDD vs. ZBDD F(x 1 x 2 x 3 )= x1x1 x2x2 x2x2 x3x3 x3x3 x3x3 x3x3 10 OBDD ROBDD x1x1 x2x2 x2x2 x3x3 x3x3 1 0

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 OBDD vs. ROBDD vs. ZBDD ROBDD x1x1 x2x2 x2x2 x3x3 x3x3 1 0 ZBDD (Binary Encoding) x1x1 x2x2 x3x3 1 0 F(x 1 x 2 x 3 )= If a variable in the ZBDD is true and it not tested, it is mapped to 0. E.g. input 110

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Using ZBDDs for Points-to Analysis  Points-to analysis algorithm needs relational product to calculate the points-to set due to propagation. –Initial Points-to relation (V x W) & Edge Set (i.e. assignments) (V x H) –RELPROD(Init, Edge, V) –REPLACE(W to V) –UNION(POINTS-TO, PT from PROPAGATION)

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 BDD Relational Product Example  Pt = {, }  Edge = { } X: p = new O(); Y: q = new O(); q = p; We want to propagate the points-to set along the edges. Relational Product will join with to give Relational Product will join with to give then existential quantification will remove p to yield then existential quantification will remove p to yield

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Relational Product Example  Pt = { Xp, Yq}  Edge = { pq’ }  ZBDD Mul gives: { Xpq', Yqpq' } To adapt the ZBDD multiplication algorithm we need to: Remove tuples that have multiple elements of the same attribute Remove tuples that have multiple elements of the same attribute Add existential quantification Add existential quantification  Need to throw out Yqpq' because it has both p and q in the same attribute.  Keep Xpq', but we want to quantify the p out of it, to get Xq' X: p = new O(); Y: q = new O(); q = p;

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Experimental Setup  Used 3 points-to analysis frameworks –bddbddb [Whaley and Lam PLDI 2004] –soot / spark [Brendl et al. PLDI 2003] –Paddle [Lhotak and Hendren CC 2006]  Used 10 Java benchmarks: –3 from Decapo antlr, bloat, chart –4 from SPEC JVM 98 jack, javac, jess, raytrace –3 other Object Oriented polyglot, sablecc, soot

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Experiments bddbddb - Context Insensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Experiments Brendel et al. - Context Insensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Experiments Paddle - Context Sensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Experiments  Impact of ZBDDs depends on the relation: –Increase size greater than 2 times. Only relations in the context-insensitive analysis grew. –Reduce size more than 8 times. –Depends on the density of the relation.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 When to use ZBDDs  Density metric –Number of tuples in the relation divided by the number of possible tuples in the full domain. –Simple test if current analysis doesn’t use BDDs.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 When to use ZBDDs bddbddb - Context Insensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 When to use ZBDDs Brendel et al. - Context Insensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 When to use ZBDDs Paddle - Context Sensitive

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Density Metric –Density Less than 3 x –|ZBDD| < |BDD| Close to 3 x –|ZBDD| ~= |BDD| Greater than 3 x –|ZBDD| > |BDD|

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 Conclusion  ZBDD based points-to analysis –Represent relations –Relational product algorithm  Implementation of ZBDD based points-to analysis –Reduced size for some context insensitive relations –Reduced the size for all context sensitive relations  Relational density metric –Predict ZBDD vs. BDD

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Relational Product  The relational product algorithm for BDDs is an existential quantification of a conjunction. –  x.(fg) = (fg)[0/x] + (fg)[1/x])  Multiplication for ZBDDs is analogous to conjunction in BDDs –Multiplication algorithm existed –Develop algorithm that combines existential quantification with multiplication. Performs early quantification like the BDD version.

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Relational Product  To use ZBDDs in points-to analysis needed to create a Relational Product Operator. –In relational calculus, essentially a natural join followed by project.  Given two functions f(x, …) and g(x,...), does a value of x exist that makes the conjunction of f and g true?  x.(fg) = (fg)[0/x] + (fg)[1/x])

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Relational Product ZBDD ZRelProd(ZBDD p, ZBDD q, Set pd) 1 if p.top < q.top 2 then return ZRelProd(q, p, pd) 3 if q = 0 4 then return 0 5 if q = 1 6 then return Subset0(p, pd) 7 x ← p.top 8 (p0, p1) ← factors of p by x 9 if x ∈ pd 10 then 11 (q0, q1) ← factors of q by x 12 return union(ZRelProd(p1, q1, pd), ZRelProd(p0, q0, pd)) 13 else 14 return node(x, ZRelProd(p1, q, pd), ZRelProd(p0, q, pd))

Using ZBDDs in Points-to Analysis LCPC October 12, 2007 ZBDD Relational Product  The relational product algorithm for BDDs is an existential quantification of a conjunction. –  x.(fg) = (fg)[0/x] + (fg)[1/x])  Multiplication for ZBDDs is analogous to conjunction in BDDs –Multiplication algorithm existed –Develop algorithm that combines existential quantification with multiplication. Performs early quantification like the BDD version.