67
Pointer Analysis: The Big Picture View Uday Khedker (www.cse.iitb.ac.in/˜uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay Dec 2017

Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

  • Upload
    others

  • View
    37

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

Pointer Analysis: The Big Picture View

Uday Khedker

(www.cse.iitb.ac.in/̃ uday)

Department of Computer Science and Engineering,

Indian Institute of Technology, Bombay

Dec 2017

Page 2: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 1/22

Outline

• The What and Why of pointer analysis

• Abstactions vs. approximations in pointer analysis

• An engineering landscape for pointer analysis

• Our Holy Grail in pointer analysis

Dec 2017 IIT Bombay

Page 3: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 2/22

Code Optimization In Presence of Pointers

Program Memory graph at statement 5

1. q = p;2. while (. . . ) {3. q = q→next;4. }5. p→data = r1;6. print (q→data);7. p→data = r2;

q

p . . .p next next

• Is p→data live at the exit of line 5? Can we delete line 5?

Dec 2017 IIT Bombay

Page 4: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 2/22

Code Optimization In Presence of Pointers

Program Memory graph at statement 5

1. q = p;2. do {3. q = q→next;4. } while (. . . )5. p→data = r1;6. print (q→data);7. p→data = r2;

q

p . . .p next next

• Is p→data live at the exit of line 5? Can we delete line 5?

Dec 2017 IIT Bombay

Page 5: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 2/22

Code Optimization In Presence of Pointers

Program Memory graph at statement 5

1. q = p;2. do {3. q = q→next;4. } while (. . . )5. p→data = r1;6. print (q→data);7. p→data = r2;

q

p . . .p next next

• Is p→data live at the exit of line 5? Can we delete line 5?

• We cannot delete line 5 if p and q can be possibly aliased

(while loop or do-while loop with a circular list)

Dec 2017 IIT Bombay

Page 6: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 2/22

Code Optimization In Presence of Pointers

Program Memory graph at statement 5

1. q = p;2. do {3. q = q→next;4. } while (. . . )5. p→data = r1;6. print (q→data);7. p→data = r2;

q

p . . .p next next

• Is p→data live at the exit of line 5? Can we delete line 5?

• We cannot delete line 5 if p and q can be possibly aliased

(while loop or do-while loop with a circular list)

• We can delete line 5 if p and q are definitely not aliased

(do-while loop without a circular list)

Dec 2017 IIT Bombay

Page 7: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 3/22

Code Optimization In Presence of Pointers

a = 5

x = &a

b = ∗x

Original program

Dec 2017 IIT Bombay

Page 8: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 3/22

Code Optimization In Presence of Pointers

a = 5

x = &a

b = ∗x

a = 5

x = &a

b = ∗x

Original program Constant propagationwithout pointer analysis

Dec 2017 IIT Bombay

Page 9: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 3/22

Code Optimization In Presence of Pointers

a = 5

x = &a

b = ∗x

a = 5

x = &a

b = ∗x

a = 5

x = &a

b = 5

Original program Constant propagation Constant propagationwithout pointer analysis with pointer analysis

Dec 2017 IIT Bombay

Page 10: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 4/22

Code Optimization In Presence of Pointers

f main g h

b

p = g ;

b

a = 5

f ();

p();

b = ∗x

b

x = &a;

b

b

x = &c ;

b

Dec 2017 IIT Bombay

Page 11: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 4/22

Code Optimization In Presence of Pointers

f main g h

b

p = g ;

b

a = 5

f ();

p();

b = ∗x

b

x = &a;

b

b

x = &c ;

b

Dec 2017 IIT Bombay

Page 12: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 4/22

Code Optimization In Presence of Pointers

f main g h

b

p = g ;

b

a = 5

f ();

p();

b = ∗x

b

x = &a;

b

b

x = &c ;

b

Dec 2017 IIT Bombay

Page 13: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 4/22

Code Optimization In Presence of Pointers

f main g h

b

p = g ;

b

a = 5

f ();

p();

b = 5

b

x = &a;

b

b

x = &c ;

b

Dec 2017 IIT Bombay

Page 14: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 5/22

Pointer Analysis

• Answers the following questions for indirect accesses:

◮ Which data is read? x = ∗y

◮ Which data is written? ∗x = y

◮ Which procedure is called? p() or x → f ()

• Enables precise data flow and interprocedural control flow analysis

• Computationally intensive analyses are ineffective when supplied withimprecise points-to analysis,

(e.g., model checking, interprocedural analyses)

• Needs to scale to large programs

Dec 2017 IIT Bombay

Page 15: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 6/22

The World of Pointer Analysis

Alias Analysis Pointer Analysis

Alias analysisof referenceparameters,

fields of unionsarray indices

Alias analysis ofdata pointers

Points-toanalysis ofdata andfunctionpointers

Dec 2017 IIT Bombay

Page 16: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 7/22

Pointer Analysis Musings

• A keynote address:

“The worst thing that has happened to Computer Science is C,because it brought pointers with it . . . ”

- Frances Allen, IITK Workshop (2007)

• A couple of influential papers

◦ Which Pointer Analysis should I Use?

Michael Hind and Anthony Pioli. ISTAA 2000

◦ Pointer Analysis: Haven’t we solved this problem ?

Michael Hind PASTE

yet

2001

Dec 2017 IIT Bombay

Page 17: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 7/22

Pointer Analysis Musings

• A keynote address:

“The worst thing that has happened to Computer Science is C,because it brought pointers with it . . . ”

- Frances Allen, IITK Workshop (2007)

• A couple of influential papers

◦ Which Pointer Analysis should I Use?

Michael Hind and Anthony Pioli. ISTAA 2000

◦ Pointer Analysis: Haven’t we solved this problem ?

Michael Hind PASTE

yet

2001

Dec 2017 IIT Bombay

Page 18: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 7/22

Pointer Analysis Musings

• A keynote address:

“The worst thing that has happened to Computer Science is C,because it brought pointers with it . . . ”

- Frances Allen, IITK Workshop (2007)

• A couple of influential papers

◦ Which Pointer Analysis should I Use?

Michael Hind and Anthony Pioli. ISTAA 2000

◦ Pointer Analysis: Haven’t we solved this problem ?

Michael Hind PASTE

yet

2001

◦ 2017 . . .

Dec 2017 IIT Bombay

Page 19: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 8/22

The Mathematics of Pointer Analysis

In the most general situation

• Alias analysis is undecidable.

Landi-Ryder [POPL 1991], Landi [LOPLAS 1992],Ramalingam [TOPLAS 1994]

• Flow insensitive alias analysis is NP-hard

Horwitz [TOPLAS 1997]

• Points-to analysis is undecidable

Chakravarty [POPL 2003]

Adjust your expectations suitably to avoid disappointments!

Dec 2017 IIT Bombay

Page 20: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 9/22

So what should we expect?

To quote Hind [PASTE 2001]

Dec 2017 IIT Bombay

Page 21: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 9/22

So what should we expect?

To quote Hind [PASTE 2001]

• “Fortunately many approximations exist”

Dec 2017 IIT Bombay

Page 22: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 9/22

So what should we expect?

To quote Hind [PASTE 2001]

• “Fortunately many approximations exist”

• “Unfortunately too many approximations exist!”

Dec 2017 IIT Bombay

Page 23: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 9/22

So what should we expect?

To quote Hind [PASTE 2001]

• “Fortunately many approximations exist”

• “Unfortunately too many approximations exist!”

Engineering of pointer analysis is much more dominant than its science

Dec 2017 IIT Bombay

Page 24: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 10/22

Pointer Analysis: Engineering or Science?

• Engineering view ◮ Build quick approximations◮ The tyranny of (exclusive) OR

Precision OR Efficiency?

• Science view ◮ Build clean abstractions◮ Can we harness the Genius of AND?

Precision AND Efficiency?

Dec 2017 IIT Bombay

Page 25: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 10/22

Pointer Analysis: Engineering or Science?

• Engineering view ◮ Build quick approximations◮ The tyranny of (exclusive) OR

Precision OR Efficiency?

• Science view ◮ Build clean abstractions◮ Can we harness the Genius of AND?

Precision AND Efficiency?

• Most common trend as evidenced by publications

◮ Build acceptable approximations guided by empirical observations

◮ The notion of acceptability is often constrained by beliefs rather thanpossibilities

Dec 2017 IIT Bombay

Page 26: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 11/22

Abstraction Vs. Approximation in Static Analysis

• Static analysis needs to create abstract values that represent manyconcrete values

• Mapping concrete values to abstract values

◮ Abstraction.

Deciding which properties of the concrete values are essential What

Ease of understanding, reasoning, modelling etc. Why

◮ Approximation.

Deciding which properties of the concrete values cannot What

be represented accurately and should be summarised

Decidability, tractability, or efficiency and scalability Why

Dec 2017 IIT Bombay

Page 27: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 12/22

Abstraction Vs. Approximation in Static Analysis

• Abstractions

◮ focus on precision and conciseness of modelling◮ tell us what we can ignore without being imprecise

• Approximations

◮ focus on efficiency and scalability◮ tell us the imprecision that we have to tolerate

Dec 2017 IIT Bombay

Page 28: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 12/22

Abstraction Vs. Approximation in Static Analysis

• Abstractions

◮ focus on precision and conciseness of modelling◮ tell us what we can ignore without being imprecise

• Approximations

◮ focus on efficiency and scalability◮ tell us the imprecision that we have to tolerate

• Build clean abstractions before surrendering to the approximations

Dec 2017 IIT Bombay

Page 29: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 13/22

The Hope of Clean Abstractions in Pointer Analysis

• Common belief

• However,

• Because

Dec 2017 IIT Bombay

Page 30: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 13/22

The Hope of Clean Abstractions in Pointer Analysis

• Common belief

Pointer information is very large

• However,

• Because

Dec 2017 IIT Bombay

Page 31: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 13/22

The Hope of Clean Abstractions in Pointer Analysis

• Common belief

Pointer information is very large

• However,

Precision can reduce the size of pointer information to make it far moremanageable

• Because

Dec 2017 IIT Bombay

Page 32: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 13/22

The Hope of Clean Abstractions in Pointer Analysis

• Common belief

Pointer information is very large

• However,

Precision can reduce the size of pointer information to make it far moremanageable

• Because

At any program point, the usable pointer information is much smaller thanthe total pointer information

Current methods perform many repeated and possibly avoidablecomputations

Dec 2017 IIT Bombay

Page 33: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 14/22

Why Avoid Approximations?

• Approximations may create a vicious cycle

ApproximationImprecision

causes

Inefficiency

maycause

may seemto warrant

Dec 2017 IIT Bombay

Page 34: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 14/22

Why Avoid Approximations?

• Approximations may create a vicious cycle

ApproximationImprecision

causes

Inefficiency

maycause

may seemto warrant

• Two examples of inefficiency cause by approximations

◮ k-limited call strings may create “butterfly cycles” causing spuriousfixed point computations [Hakjoo, 2010]

◮ Imprecision in function pointer analysis overapproximates calls

may create spurious recursion in call graphs

Dec 2017 IIT Bombay

Page 35: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 15/22

Which Approximations Should We Avoid?

Approximation Admits

Flow insensitivity

Context insensitivity (orpartial context sensitivity)

Imprecision in call graphs

Allocation site basedheap abstraction

Dec 2017 IIT Bombay

Page 36: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 15/22

Which Approximations Should We Avoid?

Approximation Admits

Flow insensitivity Spurious intraprocedural paths

Context insensitivity (orpartial context sensitivity) Spurious interprocedural paths

Imprecision in call graphs Spurious call sequences

Allocation site basedheap abstraction Spurious paths in memory graph

Dec 2017 IIT Bombay

Page 37: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 16/22

Flow Insensitivity in Data Flow Analysis

• Assumption: Statements can be executed in any order.

• Instead of computing point-specific data flow information, summary dataflow information is computed.

The summary information is required to be a safe approximation ofpoint-specific information for each point.

• No data flow information is killed

If a statement kills data flow information, there is an alternate path thatexcludes the statement.

The control flow graph viewed as a complete graph(except for the Start and End nodes)

Dec 2017 IIT Bombay

Page 38: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 17/22

Flow Insensitivity in Data Flow Analysis

0 f0 0

1 f1 1

2 f2 2 3 f3 3

i fi i

m fm m

Start

0 f0 0 1 f1 1 2 f2 2 3 f3 3 . . . i fi i . . . m fm m

End

Dec 2017 IIT Bombay

Page 39: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 17/22

Flow Insensitivity in Data Flow Analysis

0 f0 0

1 f1 1

2 f2 2 3 f3 3

i fi i

m fm m

Start

0 f0 0 1 f1 1 2 f2 2 3 f3 3 . . . i fi i . . . m fm m

End

Dec 2017 IIT Bombay

Page 40: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 17/22

Flow Insensitivity in Data Flow Analysis

0 f0 0

1 f1 1

2 f2 2 3 f3 3

i fi i

m fm m

Start

0 f0 0 1 f1 1 2 f2 2 3 f3 3 . . . i fi i . . . m fm m

End

Allows arbitrary compositions of flow functions in any order⇒ Flow insensitivity

Dec 2017 IIT Bombay

Page 41: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 17/22

Flow Insensitivity in Data Flow Analysis

0 f0 0

1 f1 1

2 f2 2 3 f3 3

i fi i

m fm m

Start

0 f0 0 1 f1 1 2 f2 2 3 f3 3 . . . i fi i . . . m fm m

End

In practice, dependent constraints are collected in a globalrepository in one pass and then are solved independently

Dec 2017 IIT Bombay

Page 42: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 18/22

Examples of Flow Insensitive Analyses

• Type checking/inferencing

(What about interpreted languages?)

• Address taken analysis

Which variables have their addresses taken?

• Side effects analysis

Does a procedure modify a global variable? Reference Parameter?

Dec 2017 IIT Bombay

Page 43: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 19/22

Context Sensitivity in Interprocedural Analysis

Sr

Er

Ss

Es

Ci

Ri

ci

St

Et

Cj

Rj

cj

x

x

x ′ = fr (x)

x ′

y

y

y ′ = fr (y)

y ′

fr

Dec 2017 IIT Bombay

Page 44: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 19/22

Context Sensitivity in Interprocedural Analysis

Sr

Er

Ss

Es

Ci

Ri

ci

St

Et

Cj

Rj

cj

x

x

x ′

y

y

y ′

fr

Dec 2017 IIT Bombay

Page 45: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 19/22

Context Sensitivity in Interprocedural Analysis

Sr

Er

Ss

Es

Ci

Ri

ci

St

Et

Cj

Rj

cj

x

x

x ′

y

y

y ′

fr

×

Dec 2017 IIT Bombay

Page 46: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 19/22

Context Sensitivity in Interprocedural Analysis

Sr

Er

Ss

Es

Ci

Ri

ci

St

Et

Cj

Rj

cj

x

x

x ′

y

y

y ′

fr

Dec 2017 IIT Bombay

Page 47: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 19/22

Context Sensitivity in Interprocedural Analysis

Sr

Er

Ss

Es

Ci

Ri

ci

St

Et

Cj

Rj

cj

x

x

x ′

y

y

y ′

fr

×

Dec 2017 IIT Bombay

Page 48: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 20/22

The Classical Precision-Efficiency Dilemma

AbstractionRole in precision Cause of inefficiency

Distinguishes between Needs to consider

Flow sensitivity

Context sensitivity

Precise heap abstraction

Precise call structure

Dec 2017 IIT Bombay

Page 49: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 20/22

The Classical Precision-Efficiency Dilemma

AbstractionRole in precision Cause of inefficiency

Distinguishes between Needs to consider

Flow sensitivity Information at differentprogram points

Context sensitivity Information indifferent contexts

Precise heap abstraction Different heaplocations

Precise call structureIndirect calls made todifferent callees fromthe same program point

Dec 2017 IIT Bombay

Page 50: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 20/22

The Classical Precision-Efficiency Dilemma

AbstractionRole in precision Cause of inefficiency

Distinguishes between Needs to consider

Flow sensitivity Information at differentprogram points

A large number ofprogram points

Context sensitivity Information indifferent contexts

Exponentially largenumber of contexts

Precise heap abstraction Different heaplocations

Unbounded numberof heap locations

Precise call structureIndirect calls made todifferent callees fromthe same program point

Precise points-toinformation

Dec 2017 IIT Bombay

Page 51: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Dec 2017 IIT Bombay

Page 52: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Data Structures: BDDs, probabilistic

Dec 2017 IIT Bombay

Page 53: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Data Structures: BDDs, probabilistic

Methods: parallel, on demand, randomized

Dec 2017 IIT Bombay

Page 54: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Data Structures: BDDs, probabilistic

Methods: parallel, on demand, randomizedRefinement: Level-wise, bootstrapping

Dec 2017 IIT Bombay

Page 55: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Crowded Area

Dec 2017 IIT Bombay

Page 56: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Crowded Area

Thinly

populated

Dec 2017 IIT Bombay

Page 57: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 21/22

Pointer Analysis: An Engineer’s Landscape

Flow

Sensitivity

Increases

Context SensitivityIncreases

FI=

FI⊆

FISSA

FSNoKill

FS

CI CSObjSens CSRecIns CS

Crowded Area

Thinly

populated

That’s thecorner we are trying to

occupy :-)

Dec 2017 IIT Bombay

Page 58: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Context sensitivity(Caller sensitivity)

Precise heapabstraction

Precise call structure

Dec 2017 IIT Bombay

Page 59: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

Context sensitivity(Caller sensitivity)

Precise heapabstraction

Precise call structure

Restrict the computationonly to the usable data.Weave liveness discoveryinto the analysis

Dec 2017 IIT Bombay

Page 60: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Precise heapabstraction

Precise call structure

Postpone low levelconnections explicatedby the classicalpoints-to facts

Dec 2017 IIT Bombay

Page 61: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

Precise heapabstraction

Precise call structure

Distinguish betweencontexts by theirdata flow values andnot their call chains

Dec 2017 IIT Bombay

Page 62: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Precise call structure

Avoid recomputationsfor each context.Use a higher levelabstraction of memory.

Dec 2017 IIT Bombay

Page 63: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Liveness accessgraphs

Partial accomplishment(TOPLAS07)

Precise call structure

Identify the part of heapactually accessed in termsof patterns of accesses

Dec 2017 IIT Bombay

Page 64: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Liveness accessgraphs

Partial accomplishment(TOPLAS07)

Access basedabstraction

Mature accomplishment(ISMM17)

Precise call structure

Distinguish between heaplocations based on howthey are accessed and nothow they are allocated

Dec 2017 IIT Bombay

Page 65: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Liveness accessgraphs

Partial accomplishment(TOPLAS07)

Access basedabstraction

Mature accomplishment(ISMM17)

Precise call structureCallee sensitivity Work in progress

Call strings record callhistory. We need torecord call future also.

Dec 2017 IIT Bombay

Page 66: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Liveness accessgraphs

Partial accomplishment(TOPLAS07)

Access basedabstraction

Mature accomplishment(ISMM17)

Precise call structureCallee sensitivity Work in progress

Virtual call resolution Work in progress

Make the call graph moreprecise by computing amore precise set of callees

Dec 2017 IIT Bombay

Page 67: Pointer Analysis: The Big Picture View · WSSE Pune PTA Big Picture: The Big Picture 1/22 Outline • The What and Why of pointer analysis • Abstactions vs. approximations in pointer

WSSE Pune PTA Big Picture: The Big Picture 22/22

In Search of Abstractions for Precision Without Inefficiency

DesiredAbstraction Enabling Abstraction Status of our work

Flowsensitivity

Joint liveness andpoints-to analysis

Partial accomplishment(SAS12)

High level abstractionof memory

Partial accomplishment(SAS16)

Context sensitivity(Caller sensitivity)

Value contextsMature accomplishment(CC08, SAS12, SOAP13)

GPG based bottom-upsummary flow functions

Mature accomplishment(SAS16)

Precise heapabstraction

Liveness accessgraphs

Partial accomplishment(TOPLAS07)

Access basedabstraction

Mature accomplishment(ISMM17)

Precise call structureCallee sensitivity Work in progress

Virtual call resolution Work in progress

We are destined

to a long haul with no

guarantees :-)

Dec 2017 IIT Bombay