SLIDE 1
1
CS711 Advanced Programming Languages Topics in Program Analysis
Radu Rugina Fall 2005
CS711 Overview 2
711?
CS711 Overview 3
Program Analysis
- Static analysis: inspect programs at compile-time
- Extract information about program execution
– Characterize dynamic program executions
- Use analysis results for:
– Optimizations and transformations – Program verification – Error detection – Program understanding
CS711 Overview 4
Static vs. Dynamic
- Static analysis:
– Work done at compile-time – Characterizes all executions – Conservative: approximates concrete program states
- Dynamic analysis:
– Run-time overhead – Characterizes one or a few executions – Precise: knows the concrete program state – Can’t “look into the future”
CS711 Overview 5
Classifying Program Analyses
- Lots of approaches to static analysis
– How do they compare to each other? – What distinguishes them?
- Main aspects of program analyses:
– What information are we interested in? – What program constructs? – How does the analysis work? – How much user interaction? – Is the analysis sound?
CS711 Overview 6
Analysis Information
- Figure out “facts” about the program execution
- Facts typically talk about:
– The values in the memory
- Constant propagation: x = 5
- Points-to analysis: x points to y
- Types: value of x is an integer
- Verification: the result of fact(n) = n!
– Events during program execution
- Liveness: variable x never used in the future
- Temporal properties, e.g. lock-unlock property