Pointer-Analysis
- Program -> Points-to relations
- Pointer Analysis: which objects a pointer can point to
- Alias analysis: can two pointers point to the same object
- Pointer-Analysis Application
- Fundamental information
- Compiler optimization
- Bug detection
- Security analysis
| Factor | Problem | Choice |
|---|---|---|
| Heap abstraction | How to model heap memory | Allocation-site/storeless |
| Context sensitivity | How to model calling contexts | Context-sensitive/insensitive |
| Flow sensitivity | How to model control flow | Flow-sensitive/insensitive |
| Analysis scope | which parts of program should be analyzed | whole-program/demand-driven |
- allocation-site abstraction: one abstract object per allocation site
Concerned Statements
- pointer-affecting statements
- New: x = new T()
- Assign: x = y
- Store: x.f = y
- Load: y = x.f
- Call: r = x.k(a, ...)
- Static Call
- Special Call
- Virtual Call
- Pointers in Java
- Local variable: x
- static field: f
- Instance field: x.f
- Array element: array[i]
- ignore indexes
Rules
- Notations
- Variables:
- Fields:
- Objects:
- Instance fields:
- Pointers: Pointer =
- Points-to relations: = Pointer (幂集)
- Rules
- x = new T():
- x = y:
- x.f = y:
- y = x.f: