Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
-
Upload
derick-richardson -
Category
Documents
-
view
213 -
download
0
Transcript of Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
![Page 1: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/1.jpg)
Points-To Analysis in Almost Linear Time
Josh Bauman
Jason Bartkowiak
CSCI 3294
OCTOBER 9, 2001
![Page 2: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/2.jpg)
OUTLINE INTRODUCTION
THE ALGORITHM
• The Source Language
• Types
• Typing Rules
• Stages of the Algortihm
• Processing Constraints
• Complexity
IMPLEMENTATION
RELATED WORK
CONCLUSION
![Page 3: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/3.jpg)
Points To Analysis In Linear Time
Paper Written by Bjarne Steensgaard(Microsoft Researcher)
Written in 1995 / Presented Jan. 1996
Flow Insensitive / Linear Time
Fastest Interprocedural Algorithm @ time of publication
Based on a NON-Standard Type System
![Page 4: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/4.jpg)
IMPORTANT ASPECTS OF THE RESEARCH
1) A Type System for describing a universally valid storage shape graph (SSG) for a program in Linear Space…
2) A Constraint System which gives the algorithm better results…
3) A Linear Time Algorithm for POINTS-TO Analysis by solving a constraint system…
![Page 5: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/5.jpg)
THE SOURCE LANGUAGE
![Page 6: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/6.jpg)
THE SOURCE LANGUAGE
THE SYNTAX OF THE LANGUAGE IS AS FOLLOWS:
![Page 7: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/7.jpg)
EXAMPLE OF FUNCTIONS IN THE LANGUAGE…..
Add1 = fun(x) ( r )
xaddone = add(x 1)
fi
result = Add1(99)
![Page 8: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/8.jpg)
TYPES
![Page 9: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/9.jpg)
TYPES OF THE LANGUAGE
NON-STANDARD SET OF TYPES
•Types describe:
• Location of variables and locations created by dynamic allocations
• A Set of Locations as well as possible runtime contents of those locations
•A TYPE can be viewed as a NODE in a SSG (Storage Shape Graph)
The following productions describe our NONSTANDARD set of types used by our Points-To Analysis:
![Page 10: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/10.jpg)
TYPING RULES
![Page 11: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/11.jpg)
TYPING RULES
•Based on Non-Standard Set of Types
•Specify when a program is WELL-TYPED
![Page 12: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/12.jpg)
TYPING RULES (CONT’D.)
Before introducing the typing rules we must present the notion of partial ordering and why it is important to the language’s typing rules…..
“obvious” typing rule
TYPING RULE (W/PARTIAL ORDERING)
![Page 13: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/13.jpg)
TYPING RULES
![Page 14: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/14.jpg)
EXPLANATION OF A STORAGE SHAPE GRAPH (SSG)
NOTE: TYPING SYSTEM ALLOWS ONLY ONE OUTGOING EDGE (TYPE VARIABLE CAN NOT BE ASSOCIATED WITH MORE THAN ONE TYPE)
![Page 15: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/15.jpg)
ALGORITHM STAGES
![Page 16: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/16.jpg)
ALGORITHM STAGES
•Start w/ assumption that all variables are described by diff. types
Initially type of all variables is :
Type Variable consists of an equivalence class representative (ECR) with associated type info.
•Merge Types as necessary to ensure WELL-TYPEDNESS
Joining two types will NEVER make a statement that was well-typed no longer be well-typed…
AND…when all program statements are WELL-TYPED, the program is WELL-TYPED
![Page 17: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/17.jpg)
PROCESSING CONSTRAINTS
Type of Constraint : Inequality Constraint
If the “Left Hand Side” type variable is associated with type other than bottom, then two type variables MUST be joined to meet the constraint.
If “Left Hand Side” type variable is associated with “bottom” , then there is no need to join the two variables at this time…
![Page 18: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/18.jpg)
INFERENCE RULES
![Page 19: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/19.jpg)
![Page 20: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/20.jpg)
COMPLEXITY
Space Cost = # of ECR’s + # of JOIN operations
Initial # of ECR’s – proportional to # of variables in the program
Time Cost - depends on “cost” of traversing statements of the program, “cost” of creating ECR’s and types, the “cost” of performing JOIN operations, and the “cost” of find operations on ECR’s
![Page 21: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/21.jpg)
Implementation
•Written in Scheme
•Run time is linear
![Page 22: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/22.jpg)
Implementation
• Table 1- All variables are included
•Table 2 - Some variables taken away
•Table 3 - Optimized form of Table 2
![Page 23: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/23.jpg)
Table 1
![Page 24: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/24.jpg)
Table 2
![Page 25: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/25.jpg)
Table 3
![Page 26: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/26.jpg)
Related Work
•Henglein - used type inference
•Weihl - points-to analysis is closest represented
![Page 27: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/27.jpg)
Related Work
Flow-sensitive analyses
•Chase and Ruf’s algorithm -interprocedural data give polynomial time
•Emami - Exponential time
•Wilson and Lam - Exponential Time
![Page 28: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/28.jpg)
Related Work
•Alias Analysis - Builds and maintains a list of access path expression that may evaluate to the same location.
•Context sensitive - Assumes runtime model that makes allocation regions explicit Related Work
![Page 29: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/29.jpg)
Related Work
• Andersen –
•Non-sensitive = O(A2), A is the # of abstract locations.
•Sensitive = O(A4)
•Compared to our solution, which is O(A)
![Page 30: Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.](https://reader035.fdocuments.in/reader035/viewer/2022062806/5697bfe81a28abf838cb6305/html5/thumbnails/30.jpg)
Conclusion & Future
•Almost linear time
•Problems
•Future - Greater Precision
•Flow-sensitive
•Context-sensitive