Title: Points-to and Side-effect Analyses for Programs Built with Precompiled Libraries
1Points-to and Side-effect Analyses for Programs
Built with Precompiled Libraries
- Atanas (Nasko) Rountev
- Barbara G. Ryder
- Rutgers University
2Whole-program Analysis
- Static analysis
- Optimizing compilers and SE tools
- Whole-program analysis
- Complex global properties
- Aggressive optimizations
- Helps humans
- Large body of work
3Weaknesses
- Need the whole program
- Incomplete programs
- Parts not implemented yet
- Separate compilation
- Precompiled components, no source
- Limited applicability
4Our Target Problem
- Goal handle incompleteness and separation
- Specific instance
- C programs with precompiled libraries
- Points-to analysis and side-effect analysis
- Importance
- Points-to and side-effect info is necessary
- Techniques useful for similar problems
5Overview
- Introduction
- Analysis for Programs with Libraries
- Analysis of Libraries
- Library Summary Information
- Analysis of Library Clients
- Empirical Results
- Summary
6Programs Built with Libraries
- Library module
- Write the library
- Create library binary
- Client module
- Write the client
- Compile and link with library binary
- No library source
- Need separate analyses
7Separate Analysis of a Library Module
- Unknown client modules
- Simulated by an abstract client
Abstract Client
Whole-program Analyzer
Library Solution
Library Module
8Separate Analysis of a Client Module
- Use precomputed summary information
- Enables precise analysis
Client Module
Whole-program Analyzer
Client Solution
Library Summary
9Library Summary Information
- Used later to analyze client modules
- Enclosed with library binary, reusable
10Points-to and Side-effect Analyses
- What variables may p refer to?
- Andersens analysis
- What variables may be modified?
- MOD set for each statement
- Pointer resolution p0
- Procedure calls backward propagation
- Wide range of applications
11Overview
- Introduction
- Analysis for Programs with Libraries
- Analysis of Libraries
- Library Summary Information
- Analysis of Library Clients
- Empirical Results
- Summary
12Separate Analysis of Libraries
- Unknown clients
- Access through library interface
- Abstract client
- Placeholder variable v0
- Placeholder procedure p0
- Apply whole-program analyses
- Reuse of implementation
13Abstract Client
proc p0(v1,...,vn) returns ret0 v0 vi
v0 v (v ? interface) v0 v0
v0 p0 v0 v0 v0 v0 v0
(v0)(v0,...,v0) ret0 v0
14Library Example
global g proc p1(p,fp) proc p2(r)
local s, t, q r -(r) t
p q s p2(q) t s
(fp)(t,g)
s1
MOD(s1) v0,g
15Overview
- Introduction
- Analysis for Programs with Libraries
- Analysis of Libraries
- Library Summary Information
- Analysis of Library Clients
- Empirical Results
- Summary
16Library Summary Information
- Used for separate analysis of clients
- Enclosed with library binary, reusable
- Input to whole-program analyzers
- Best possible precision
- Basic summary
- Precision-preserving optimizations
- Reduce summary size
- Reduce cost of separate analysis of clients
17Basic Summary
global g proc p1(p,fp) local s1, t, q
t p q s p2(q) t s
(fp)(t,g) proc p2(r) r -(r)
18Summary Optimizations
- Replace sets of equivalent variables
- Have the same points-to sets
- Replace with a set representative
- Remove irrelevant summary elements
- Smaller points-to and MOD sets in clients
- Inactive variables
- Inaccessible variables
- Use solution from separate library analysis
19Optimized Summary
proc p1(p,fp) ts tp (fp)(t,g) qs
proc p2(r) p2(q)
proc p1(rep1,fp) (fp)(rep1,g)
Mod(p1) (t,I) Call(p1) (p2,D) (fp,I)
Mod(p2) (r,I)
Mod(p1) (rep1,I) Call(p1) (fp,I)
20Overview
- Introduction
- Analysis for Programs with Libraries
- Analysis of Libraries
- Library Summary Information
- Analysis of Library Clients
- Empirical Results
- Summary
21Experiments
- Library and client points-to analyses
- BANE toolkit (UC Berkeley)
- Summary generation and optimization
- Publicly available C programs
- Include general-purpose libraries
- Sun Ultra-60, 360MHz, 512K memory
22Data Programs
23Cost of Library Analysis
24Cost of Client Analysis
25Cost Reduction for Client Analysis
26Summary
- Challenges for whole-program analysis
- Programs with precompiled libraries
- Points-to and side-effect analyses
- Separate analysis of libraries and clients
- Summary construction
- Future work
- Other points-to analyses
- Client analyses