-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Feature Request: CFG with Larger Basic Blocks Ignoring Implicit Exceptions
Description
OPAL's cfg module constructs CFGs where basic blocks are split at instructions that may throw implicit exceptions (e.g., NullPointerException for invokevirtual, ArithmeticException for idiv). This results in smaller basic blocks due to additional edges to exception handlers. I propose an optional CFG construction mode that abstracts away implicit exceptions, creating larger basic blocks based solely on explicit control flow (e.g., jumps, returns, explicit throw statements). This mode would only consider exception edges for explicit try-catch blocks defined in the code.
Motivation
Smaller basic blocks increase CFG complexity, which complicates custom static analyses implementations. An optional mode that ignores implicit exceptions would:
- Reduce the number of basic blocks and edges, simplifying the CFG.
- Enable more efficient analyses for use cases where implicit exceptions are irrelevant.
- Provide flexibility for users to choose between sound (exception-aware) and simplified (exception-agnostic) CFG representations.
Example
Consider the following Java code:
public int compute(int x, int y) {
int result = x / y; // Potential ArithmeticException
return result;
}