Pointer Analysis. Outline: What is pointer analysis Intraprocedural pointer analysis Interprocedural pointer analysis. Andersen and Steensgaard



Similar documents
Acceleration Lab Teacher s Guide

Appendix A: Area. 1 Find the radius of a circle that has circumference 12 inches.

Strategic Supply Chain Optimization for the Pharmaceutical Industries

ILP Formulation and K-Shortest Path Heuristic for the RWA Problem with Allocation of Wavelength Converters

Chapter 2 Kinematics in One Dimension

Signal Rectification

Permutations and Combinations

CHARGE AND DISCHARGE OF A CAPACITOR

Chapter 7. Response of First-Order RL and RC Circuits

The Greek financial crisis: growing imbalances and sovereign spreads. Heather D. Gibson, Stephan G. Hall and George S. Tavlas

4. International Parity Conditions

Stability. Coefficients may change over time. Evolution of the economy Policy changes

The Transport Equation


Analysis of tax effects on consolidated household/government debts of a nation in a monetary union under classical dichotomy

cooking trajectory boiling water B (t) microwave time t (mins)

C Fast-Dealing Property Trading Game C

Differential Equations. Solving for Impulse Response. Linear systems are often described using differential equations.

RC (Resistor-Capacitor) Circuits. AP Physics C

Finance 360 Problem Set #6 Solutions

A Note on Using the Svensson procedure to estimate the risk free rate in corporate valuation

Vector Autoregressions (VARs): Operational Perspectives

USE OF EDUCATION TECHNOLOGY IN ENGLISH CLASSES

Morningstar Investor Return

4 Convolution. Recommended Problems. x2[n] 1 2[n]

A Fast Distributed Algorithm for Decomposable Semidefinite Programs

Cointegration: The Engle and Granger approach

HFCC Math Lab Intermediate Algebra - 13 SOLVING RATE-TIME-DISTANCE PROBLEMS

TOPOLOGICAL DESIGN OF MULTIPLE VPNS OVER MPLS NETWORK Anotai Srikitja David Tipper

Imagine a Source (S) of sound waves that emits waves having frequency f and therefore

Lecture 2: Telegrapher Equations For Transmission Lines. Power Flow.

Usefulness of the Forward Curve in Forecasting Oil Prices

A Probability Density Function for Google s stocks

Chapter 8: Regression with Lagged Explanatory Variables

1 A B C D E F G H I J K L M N O P Q R S { U V W X Y Z 1 A B C D E F G H I J K L M N O P Q R S { U V W X Y Z

Appendix D Flexibility Factor/Margin of Choice Desktop Research

Angles formed by 2 Lines being cut by a Transversal

11/6/2013. Chapter 14: Dynamic AD-AS. Introduction. Introduction. Keeping track of time. The model s elements

SOLID MECHANICS TUTORIAL GEAR SYSTEMS. This work covers elements of the syllabus for the Edexcel module 21722P HNC/D Mechanical Principles OUTCOME 3.

Performance Center Overview. Performance Center Overview 1

C Fast-Dealing Property Trading Game C

AIRLINE SEAT MANAGEMENT WITH ROUND-TRIP REQUESTS

Topic 9: Ecology 9b. Biodiversity 9b1. Wanted Poster

2.4 Network flows. Many direct and indirect applications telecommunication transportation (public, freight, railway, air, ) logistics

PRESSURE BUILDUP. Figure 1: Schematic of an ideal buildup test

The Euro. Optimal Currency Areas. The Problem. The Euro. The Proposal. The Proposal

One dictionary: Native language - English/English - native language or English - English

Random Walk in 1-D. 3 possible paths x vs n. -5 For our random walk, we assume the probabilities p,q do not depend on time (n) - stationary

Principal components of stock market dynamics. Methodology and applications in brief (to be updated ) Andrei Bouzaev, bouzaev@ya.

Equities: Positions and Portfolio Returns

AP Calculus AB 2010 Scoring Guidelines

AP Calculus AB 2007 Scoring Guidelines

The Application of Multi Shifts and Break Windows in Employees Scheduling

Measuring macroeconomic volatility Applications to export revenue data,

[web:reg] ARMA Excel Add-In

INTRODUCTION TO MARKETING PERSONALIZATION. How to increase your sales with personalized triggered s

Automatic measurement and detection of GSM interferences

Quality Assurance in Software Development

Valuing Long-Lived Assets

How Much Can Taxes Help Selfish Routing?

Capital budgeting techniques

Energy Density / Energy Flux / Total Energy in 3D

Betting Strategies, Market Selection, and the Wisdom of Crowds

Managing money and making a profit

Making a Faster Cryptanalytic Time-Memory Trade-Off

Name: Algebra II Review for Quiz #13 Exponential and Logarithmic Functions including Modeling

Mortality Variance of the Present Value (PV) of Future Annuity Payments

Conceptually calculating what a 110 OTM call option should be worth if the present price of the stock is

Impact of scripless trading on business practices of Sub-brokers.

CONTRIBUTION OF INTERNAL AUDITING IN THE VALUE OF A NURSING UNIT WITHIN THREE YEARS

Statistical Analysis with Little s Law. Supplementary Material: More on the Call Center Data. by Song-Hee Kim and Ward Whitt

Optimal Real-Time Scheduling for Hybrid Energy Storage Systems and Wind Farms Based on Model Predictive Control

1 HALF-LIFE EQUATIONS

Detecting Partially Fallen-out Magnetic Slot Wedges in AC Machines Based on Electrical Quantities only

AP Calculus AB 2013 Scoring Guidelines

Introduction the pressure for efficiency the Estates opportunity

Duration and Convexity ( ) 20 = Bond B has a maturity of 5 years and also has a required rate of return of 10%. Its price is $613.

WINMAG Graphics Management System

CERTIFICATE COURSE ON CLIMATE CHANGE AND SUSTAINABILITY. Course Offered By: Indian Environmental Society

CAREER MAP HOME HEALTH AIDE

Analysis of Pricing and Efficiency Control Strategy between Internet Retailer and Conventional Retailer

PROFIT TEST MODELLING IN LIFE ASSURANCE USING SPREADSHEETS PART ONE

COMPARISON OF DIFFUSION MODELS IN ASTRONOMICAL OBJECT LOCALIZATION

Answer, Key Homework 2 David McIntyre Mar 25,

AP Calculus BC 2010 Scoring Guidelines

Why Did the Demand for Cash Decrease Recently in Korea?

Microstructure of Russian stock market and profitability of market making

Chapter 6 Interest Rates and Bond Valuation

Newton s Laws of Motion

A Supplier Evaluation System for Automotive Industry According To Iso/Ts Requirements

TERM INSURANCE CALCULATION ILLUSTRATED. This is the U.S. Social Security Life Table, based on year 2007.

THE LAW SOCIETY OF THE AUSTRALIAN CAPITAL TERRITORY

Full-wave rectification, bulk capacitor calculations Chris Basso January 2009

SIMPLE MODELS OF TRANSMISSION LINE IN MATHCAD ENVIROMENTS PROSTE MODELE LINII DŁUGIEJ W ŚRODOWISKU MATHCAD

Transcription:

Poiner anaysis

Poiner Anaysis Ouine: Wha is oiner anaysis Inrarocedura oiner anaysis Inerrocedura oiner anaysis Andersen and Seensgaard

Poiner and Aias Anaysis Aiases: wo exressions ha denoe he same memory ocaion. Aiases are inroduced by: oiners ca-by-reference array indexing C unions

Usefu for wha? Imrove he recision of anayses ha require knowing wha is modified or referenced (eg cons ro, CSE ) Eiminae redundan oads/sores and dead sores. x := *;... y := *; // reace wih y := x? *x :=...; // is *x dead? Paraeizaion of code can recursive cas o quick_sor be run in arae? Yes, rovided ha hey reference disinc regions of he array. Idenify objecs o be racked in error deecion oos x.ock();... y.unock(); // same objec as x?

Kinds of aias informaion Poins-o informaion (mus or may versions) a rogram oin, comue a se of airs of he form! x, where oins o x. can reresen his informaion in a oins-o grah Aias airs a each rogram oin, comue he se of of a airs (e 1,e 2 ) where e 1 and e 2 mus/may reference he same memory. x y z Sorage shae anaysis a each rogram oin, comue an absrac descriion of he oiner srucure.

Inrarocedura Poins-o Anaysis Wan o comue may-oins-o informaion Laice:

Fow funcions in x := k F x := k (in) = ou in x := a + b F x := a+b (in) = ou

Fow funcions in x := y F x := y (in) = ou in x := &y F x := &y (in) = ou

Fow funcions in x := *y F x := *y (in) = ou in *x := y F *x := y (in) = ou

Inrarocedura Poins-o Anaysis Fow funcions:

Poiners o dynamicay-aocaed memory Hande saemens of he form: x := new T One idea: generae a new variabe each ime he new saemen is anayzed o sand for he new ocaion:

Exame := new Cons := := new Cons * := :=

Exame soved := new Cons := V1 V1 V2 := new Cons V1 V2 V1 V2 V3 * := V1 V2 V1 V2 V3 := V1 V2 V1 V2 V3

Wha wen wrong? Laice infiniey a! We were esseniay running he rogram Insead, we need o summarize he infiniey many aocaed objecs in a finie way New Idea: inroduce summary nodes, which wi sand for a whoe cass of aocaed objecs.

Wha wen wrong? Exame: For each new saemen wih abe L, inroduce a summary node oc L, which sands for he memory aocaed by saemen L. Summary nodes can use oher crierion for merging.

Exame revisied : := new Cons := : := new Cons * := :=

Exame revisied & soved : := new Cons Ier 1 Ier 2 Ier 3 := : := new Cons * := :=

Array aiasing, and oiners o arrays Array indexing can cause aiasing: a[i] aiases b[j] if: a aiases b and i = j a and b overa, and i = j + k, where k is he amoun of overa. Can have oiners o eemens of an array := &a[i];...; ++; How can arrays be modeed? Coud rea he whoe array as one ocaion. Coud ry o reason abou he array index exressions: array deendence anaysis.

Fieds Can summarize fieds using er fied summary for each fied F, kee a oins-o node caed F ha summarizes a ossibe vaues ha can ever be sored in F Can aso use aocaion sies for each fied F, and each aocaion sie S, kee a oins-o node caed (F, S) ha summarizes a ossibe vaues ha can ever be sored in he fied F of objecs aocaed a sie S.

Summary We jus saw: inrarocedura oins-o anaysis handing dynamicay aocaed memory handing oiners o arrays Bu, inrarocedura oiner anaysis is no enough. Sharing daa srucures across muie rocedures is one he big benefis of oiners: insead of assing he whoe daa srucures around, jus ass oiners o hem (eg C ass by reference). So oiners end u oining o srucures shared across rocedures. If you don do an inerroc anaysis, you have o make conservaive assumions funcions enries and funcion cas.

Conservaive aroximaion on enry Say we don have inerrocedura oiner anaysis. Wha shoud he informaion be a he inu of he foowing rocedure: goba g; void (x,y) { x y g... }

Conservaive aroximaion on enry Here are a few souions: goba g; void (x,y) { }... x y g ocaions from aoc sies rior o his invocaion x,y,g & ocaions from aoc sies rior o his invocaion They are a very conservaive! We can ry o do beer.

Inerrocedura oiner anaysis Main difficuy in erforming inerrocedura oiner anaysis is scaing One can use a o-down summary based aroach (Wison & Lam 95), bu even hese are hard o scae

Exame revisied : := new Cons Cos: sace: sore one fac a each rog oin ime: ieraion Ier 1 Ier 2 Ier 3 := : := new Cons * := :=

New idea: sore one daafow fac Sore one daafow fac for he whoe rogram Each saemen udaes his one daafow fac use he revious fow funcions, bu now hey ake he whoe rogram daafow fac, and reurn an udaed version of i. Process each saemen once, ignoring he order of he saemens This is caed a fow-insensiive anaysis.

Fow insensiive oiner anaysis : := new Cons := : := new Cons * := :=

Fow insensiive oiner anaysis : := new Cons := : := new Cons * := :=

Fow sensiive vs. insensiive : := new Cons Fow-sensiive Son Fow-insensiive Son := : := new Cons * := :=

Wha wen wrong? Wha haened o he ink beween and? Can do srong udaes anymore! Need o remove a he ki ses from he fow funcions. Wha haened o he sef oo on? We si have o ierae!

Fow insensiive oiner anaysis: fixed : := new Cons := : := new Cons * := :=

Fow insensiive oiner anaysis: fixed : := new Cons This is Andersen s agorihm 94 Fina resu Ier 1 Ier 2 Ier 3 := : := new Cons * := := L2 L1 L2

Fow sensiive vs. insensiive, again : := new Cons Fow-sensiive Son Fow-insensiive Son := : := new Cons * := :=

Fow insensiive oss of recision Fow insensiive anaysis eads o oss of recision! main() { x := &y; }... x := &z; Fow insensiive anaysis es us ha x may oin o z here! However: uses ess memory (memory can be a big boeneck o running on arge rograms) runs faser

In Cass Exercise! : := new Cons : q := new Cons * = q r = &q *q = r *q = s = r s = *r = s

In Cass Exercise! soved : := new Cons : q := new Cons * = q r = &q *q = r *q = q r s s = r s = *r = s

Wors case comexiy of Andersen x y *x = y x y a b c d e f a b c d e f Wors case: N 2 er saemen, so a eas N 3 for he whoe rogram. Andersen is in fac O(N 3 )

New idea: one successor er node Make each node have ony one successor. This is an invarian ha we wan o mainain. x y *x = y x y a,b,c d,e,f a,b,c d,e,f

More genera case for *x = y x y *x = y

More genera case for *x = y x y x y x y *x = y

Handing: x = *y x y x = *y

Handing: x = *y x y x y x y x = *y

Handing: x = y (wha abou y = x?) x y x = y Handing: x = &y x y x = &y

Handing: x = y (wha abou y = x?) x y x y x y x = y ge he same for y = x Handing: x = &y x y x = &y x y x y,

Our favorie exame, once more! : := new Cons 1 := 2 : := new Cons 3 * := 4 := 5

Our favorie exame, once more! : := new Cons := 2 1 1 2 3 : := new Cons 3 4 5 * := 4 := 5,

Fow insensiive oss of recision : := new Cons Fow-sensiive Subse-based Fow-insensiive Subse-based Fow-insensiive Unificaionbased := : := new Cons * :=, :=

Anoher exame bar() { 1 i := &a; 2 j := &b; 3 foo(&i); 4 foo(&j); // i ns o wha? *i :=...; } void foo(in* ) { rinf( %d,*); }

Anoher exame bar() { 1 i := &a; 2 j := &b; 3 foo(&i); 4 foo(&j); // i ns o wha? *i :=...; i 1 2 a i a 4 j b 3 i a j b } void foo(in* ) { rinf( %d,*); } i a j b i,j a,b

Amos inear ime Time comexiy: O(Nα(N, N)) inverse Ackermann funcion So sow-growing, i is basicay inear in racice For he curious: node merging imemened using UNION-FIND srucure, which aows se union wih amorized cos of O(α(N, N)) er o. Take CSE 202 o earn more!

In Cass Exercise! : := new Cons : q := new Cons * = q r = &q *q = r *q = s = r s = *r = s

In Cass Exercise! soved : := new Cons : q := new Cons Seensgaard q,,s2 * = q r s r = &q *q = r s = r *q = s = Andersen q *r = s r s

Advanced Poiner Anaysis Combine fow-sensiive/fow-insensiive Cever daa-srucure design Conex-sensiiviy