Last time Interprocedural analysis Dimensions of precision (flow- and context-sensitivity) Flow-Sensitive Pointer Analysis



Similar documents
Uses for Binary Trees -- Binary Search Trees

Fundamentals of Tensor Analysis

Reading. Minimum Spanning Trees. Outline. A File Sharing Problem. A Kevin Bacon Problem. Spanning Trees. Section 9.6

Important result on the first passage time and its integral functional for a certain diffusion process

December Homework- Week 1

Chapter 3 Chemical Equations and Stoichiometry

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

Quality and Pricing for Outsourcing Service: Optimal Contract Design

Oracle PL/SQL Programming Advanced

Distributed Systems Principles and Paradigms. Chapter 11: Distributed File Systems. Distributed File Systems. Example: NFS Architecture

Change Your History How Can Soccer Knowledge Improve Your Business Processes?

AC Circuits Three-Phase Circuits

Regular Sets and Expressions

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS Spring 2009

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

Basically, logarithmic transformations ask, a number, to what power equals another number?

Schedule C. Notice in terms of Rule 5(10) of the Capital Gains Rules, 1993

Algorithmic Aspects of Access Networks Design in B3G/4G Cellular Networks

Hospitals. Internal Revenue Service Information about Schedule H (Form 990) and its instructions is at

How To Set Up A Network For Your Business

Reasoning to Solve Equations and Inequalities

Protocol Analysis / Analysis of Software Artifacts Kevin Bierhoff

Link-Disjoint Paths for Reliable QoS Routing

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

One Minute To Learn Programming: Finite Automata

RTL Power Optimization with Gate-level Accuracy

A Note on Approximating. the Normal Distribution Function

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

Techniques for Requirements Gathering and Definition. Kristian Persson Principal Product Specialist

Revised Conditions (January 2009) LLOYDS BANKING GROUP SHARE ISA CONDITIONS

MANAGEMENT OF INFORMATION SECURITY AND FORENSICS

Source Code verification Using Logiscope and CodeReducer. Christophe Peron Principal Consultant Kalimetrix

Outside Cut 1 of fabric Cut 1 of interfacing

Homework 3 Solutions

Lecture 20: Emitter Follower and Differential Amplifiers

Integration by Substitution

Hillsborough Township Public Schools Mathematics Department Computer Programming 1

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Math 135 Circles and Completing the Square Examples

Cloud and Big Data Summer School, Stockholm, Aug., 2015 Jeffrey D. Ullman

Motivation Suppose we have a database of people We want to gure out who is related to whom Initially, we only have a list of people, and information a

Treatment Spring Late Summer Fall Mean = 1.33 Mean = 4.88 Mean = 3.

Small Business Networking

Review guide for the final exam in Math 233

Lectures 8 and 9 1 Rectangular waveguides

Binary Representation of Numbers Autar Kaw

CHAPTER 11 Numerical Differentiation and Integration

Small Business Networking

Higher. Exponentials and Logarithms 160

9 CONTINUOUS DISTRIBUTIONS

WORKERS' COMPENSATION ANALYST, 1774 SENIOR WORKERS' COMPENSATION ANALYST, 1769

Lecture 3 Gaussian Probability Distribution

Small Business Networking

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Corporate Compliance vs. Enterprise-Wide Risk Management

Factoring Polynomials

trademark and symbol guidelines FOR CORPORATE STATIONARY APPLICATIONS reviewed

Vectors Recap of vectors

Architecture of the proposed standard

How To Network A Smll Business

MATH 150 HOMEWORK 4 SOLUTIONS

Small Business Networking

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall Final Exam

Operational Procedure: ACNC Data Breach Response Plan

Section 7-4 Translation of Axes

Constrained Renewable Resource Allocation in Fuzzy Metagraphs via Min- Slack

A Project Management framework for Software Implementation Planning and Management

Algebra Review. How well do you remember your algebra?

WIRELESS mesh networks (WMNs) provide cheap, reliable,

Lecture 3: Diffusion: Fick s first law

Econ 371: Answer Key for Problem Set 1 (Chapter 12-13)

Geometry 7-1 Geometric Mean and the Pythagorean Theorem

Predicting Current User Intent with Contextual Markov Models

Probabilistic maintenance and asset management on moveable storm surge barriers

Free ACA SOLUTION (IRS 1094&1095 Reporting)

Basic Analysis of Autarky and Free Trade Models

Magic Message Maker Amaze your customers with this Gift of Caring communication piece

Human Pedigrees. Independent Assortment. Mendel s Second Law. Independent Assortment Test Cross. 4 phenotypes. Pedigree analysis:

The example is taken from Sect. 1.2 of Vol. 1 of the CPN book.

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

Portfolio approach to information technology security resource allocation decisions

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

FAULT TREES AND RELIABILITY BLOCK DIAGRAMS. Harry G. Kwatny. Department of Mechanical Engineering & Mechanics Drexel University

FEE-HELP INFORMATION SHEET FOR DOMESTIC FULL FEE STUDENTS

Or more simply put, when adding or subtracting quantities, their uncertainties add.

JaERM Software-as-a-Solution Package

Network Decoupling for Secure Communications in Wireless Sensor Networks

Lecture 5. Inner Product

BUSINESS OWNERS PACKAGE INSURANCE APPLICATION

CPS 220 Theory of Computation REGULAR LANGUAGES. Regular expressions

baby on the way, quit today

Experiment 6: Friction

STATEMENT OF INSOLVENCY PRACTICE 3.2

Transcription:

Flow-Insnsitiv Pointr Anlysis Lst tim Intrprocurl nlysis Dimnsions of prcision (flow- n contxt-snsitivity) Flow-Snsitiv Pointr Anlysis Toy Flow-Insnsitiv Pointr Anlysis CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 2 Flow-Insnsitiv Pointr Anlysis Th fining chrctristics Ignor th control-flow grph, n ssum tht sttmnts cn xcut in ny orr Rthr thn proucing solution for ch progrm point, prouc singl solution tht is vli for th whol progrm Flow-insnsitiv pointr nlyss Anrsn-styl nlysis: th slowst n most prcis Stnsgr nlysis: th fstst n lst prcis All othr flow-insnsitiv pointr nlyss r hybris of ths two CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 3

Anrsn-Styl Pointr Anlysis [1994] Bsic i Viw pointr ssignmnts s constrints Us ths constrints to propgt points-to informtion CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 4 Anrsn-styl Pointr Anlysis Exmpl 1 Progrm := &b c := := & := Flow-Snsitiv Solution { b } c { b } { } { } CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 5

Anrsn-styl Pointr Anlysis Exmpl 1 Progrm Constrints Points-to Rltions := &b c := := & := { b, } c { b, } c { } b, } { } b, } W v rch fix point Trminology Bs constrints: Us to initiliz th points-to sts Ex: := &b Not n ftr initiliztion Simpl constrints: Involv vribl nms only Ex: c := Complx constrints: Involv pointr rfrncs Ex: * := c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 6 Anrsn-styl Pointr Anlysis Exmpl 2 Progrm := &b c := & := & f := * := c Constrints { b } c { } { } f * c c Points-to Rltions { b,} } c { } { } f { } b,} } Notic tht w crt th constrint grph ynmiclly CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 7

Anrsn-Styl Pointr Anlysis Bsic i Viw pointr ssignmnts using constrint grph Propgt points-to rltions long th gs of th constrint grph, ing nw gs s inirct constrints r rsolv Constrint grph On no for ch vribl On irct g for ch constrint Anrsn-styl nlysis Cn b ruc to computing th trnsitiv closur of ynmic grph A wll-stui problm for which th bst known complxity is O(n 3 ) CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 8 Anrsn-styl Pointr Anlysis Th Constrint Grph Exmpl 1 c {b,} {b,} {b,} CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 9

Anrsn-styl Pointr Anlysis Th Constrint Grph Exmpl 2 f c [* c] {b,} {b} {b,} {b} {} {} CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 10 Anrsn-styl Pointr Anlysis Cycl Elimintion Cycl Elimintion Th most importnt optimiztion for Anrsn-styl nlysis Dtct strongly-connct componnts in th constrint grph Collps thm into singl no Th rtionl All nos in th sm SCC r gurnt to hv th sm points-to rltions t th n of th nlysis Compliction Most SCCs r crt ynmiclly uring th nlysis Cycl limintion must b prform ynmiclly for grtst ffct CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 11

Anrsn-styl Pointr Anlysis Cycl Elimintion {w,x,y,z} {} {w,x,y,z} {w,x} {w} b {w,x,y,z} {x} c {w,x,y,z} {w,x,z} {z} {w,x,y,z} {y} CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 12 Anrsn-styl Pointr Anlysis Cycl Elimintion,b,c, {w,x,y,z} {} {w,x,y,z} CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 13

Anrsn-styl Pointr Anlysis Procur Clls Progrm foo(int* x){... rturn x; } Constrints x { b } x := foo(&b) How o w hnl procur clls? Insrt constrints for copying ctul prmtrs to forml prmtrs Insrt constrints for copying rturn vlus CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 14 Stnsgr Pointr Anlysis Bsic i Furthr ruc prcision by using qulity constrints Tht is, informtion flows both wys, rthr thn from th right-hn si to th lft-hn si of th constrint. Troffs Imprcis A systm of qulity constrints cn b solv in nr-linr tim Running tim is O(n α(n)), whr α(n) is th invrs Ackrmnn s function. α(2 132 ) < 4 Ky i Th ky to this lgorithm is th UNION-FIND t structur. CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 15

Stnsgr Pointr Anlysis UNION-FIND Th UNION-FIND t structur Mintins st of isjoint sts n supports two oprtions: FIND(x) : rturn th st contining x. UNION(x,y) : union th two sts contining x n y. St Rprsnttion Sts r rprsnt by istinguish lmnt cll th st rprsnttiv Ech st is n invrt tr, with nos pointing to thir prnts n th st rprsnttiv s th root CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 16 Stnsgr Pointr Anlysis UNION-FIND UNION (, b) - FIND(b) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 17

Stnsgr Pointr Anlysis UNION-FIND UNION (, c) - FIND(c) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 18 Stnsgr Pointr Anlysis UNION-FIND UNION (, ) - FIND() b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 19

UNION-FIND Optimiztions Two ky optimiztions Pth comprssion Union-by-rnk Togthr ths optimiztions yil nr-linr tim oprtions Pth comprssion Avoi runnt srchs for th st rprsnttiv Union-by-rnk Whn prforming th UNION oprtion, choos th st rprsnttiv bs on th sizs of th two sts CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 20 Stnsgr Pointr Anlysis Pth Comprssion UNION (, b) - FIND(b) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 21

Stnsgr Pointr Anlysis Pth Comprssion UNION (, c) - FIND(c) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 22 Stnsgr Pointr Anlysis Pth Comprssion UNION (, ) - FIND() b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 23

Stnsgr Pointr Anlysis Union-by-Rnk UNION (, b) - FIND(b) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 24 Stnsgr Pointr Anlysis Union-by-Rnk UNION (, c) - FIND(c) b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 25

Stnsgr Pointr Anlysis Union-by-Rnk UNION (, ) - FIND() b c Wht is th bnfit of union-by-rnk? It nsurs tht w follow s fw prnt pointrs s possibl Consir th cost of slcting s th nw st rprsnttiv in this lst union oprtion CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 26 Stnsgr Pointr Anlysis th Algorithm mrg(x, y) { x = FIND(x); y = FIND(y); if (x == y) thn rturn; UNION(x,y); mrg(points-to(x),points-to(y)); } for ch constrint LHS = RHS mrg(lhs,rhs) CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 27

Stnsgr Pointr Anlysis Exmpl 1 Progrm := &b c := := & := Constrints = { b, } c = = Points-to Rltions,c, b, CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 28 Stnsgr Pointr Anlysis Exmpl 2 Progrm Constrints Points-to Rltions := &b c := & := & f := * := c = { b } c = { } = { } f = * = c,f,c c b, b CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 29

Anrsn vs. Stnsgr Anrsn-styl nlysis int **, *b, c, *, ; 1: = &b; 2: b = &c; 3: = &; 4: = &; b c u to sttmnt 4 b c Stnsgr nlysis b c u to sttmnt 4 b c CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 30 Concpts Flow-insnsitiv pointr nlysis Anrsn-styl nlysis Inclusion-bs, subst-bs Comput trnsitiv closur of ynmic grph Constrint grph Cycl limintion optimiztion Stnsgr-styl nlysis Unifiction-bs, qulity-bs Union-fin t structur CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 31

Nxt Tim Lctur Contxt-Snsitiv Pointr Anlysis CIS 570 Lctur 12 Flow-Insnsitiv Pointr Anlysis 32