Class ImmutableBlockControlFlowGraph

All Implemented Interfaces:
Iterable<Stmt>

public class ImmutableBlockControlFlowGraph extends ControlFlowGraph<ImmutableBlockControlFlowGraph.ImmutableBasicBlock>
A truly immutable snapshot of a ControlFlowGraph. Constructed from any existing graph; subsequent mutations to the source do not affect this instance.

Provides O(1) bidirectional stmt-to-integer-index mapping via indexOf(Stmt) and getStmt(int), enabling bitset-based analysis passes (liveness, reaching definitions, etc.) without per-lookup HashMap overhead.

Construction uses a two-phase algorithm:

  1. Linearise the source graph in RPO order into a flat Stmt[] array and create ImmutableBlockControlFlowGraph.ImmutableBasicBlock shells.
  2. Wire predecessor/successor/exceptional-successor links between the shells.
Author:
Markus Schmidt