Program Analysis
2023-11-06

In this project, I build three major program analysis tools for a mini-java (qparjava) language whose grammar can be found here
-
Alias Analysis: Alias analysis is a technique used in programming languages and compilers to determine if two or more pointers or references in a program can refer to the same memory location. It helps identify aliasing relationships between variables, enabling optimizations, improving program understanding, detecting bugs, and enhancing security. By analyzing aliasing, compilers can make optimizations like dead code elimination and memory optimization. Programmers can avoid unintended side effects, while security analysts can identify potential vulnerabilities. Various techniques exist, ranging from conservative to more precise approaches, with the latter aiming to reduce false positives and provide accurate information about aliasing relationships. Overall, alias analysis is essential for efficient and secure programming involving pointers or references.
-
Escape Analysis: Escape analysis is a compiler optimization technique that determines whether an object’s lifetime extends beyond its current scope. It identifies objects that do not escape their scope and can be allocated on the stack instead of the heap. This optimization improves performance by reducing memory allocation and deallocation overhead. Stack allocation is faster and eliminates the need for explicit memory management. Additionally, it can eliminate unnecessary synchronization and improve cache locality. Escape analysis is commonly used in languages with automatic memory management and helps optimize short-lived objects. It results in faster code execution and reduced memory overhead.
-
MHP (May-Happen-Parallel) Analysis: MHP (May-Happen-in-Parallel) analysis is a technique used in concurrent programming to determine which statements or operations in a program can potentially execute concurrently without violating the intended semantics. It helps identify the set of statements that can be executed in parallel, enabling developers and compilers to optimize program performance.
This also includes some parallel programming constructs used in java and a breif report on the same.