Faster Algorithms for Weighted Recursive State Machines

Krishnendu Chatterjee, Bernhard Kragl, Samarth Mishra, Andreas Pavlogiannis

Interprocedural analysis is a cornerstone of modern software verification, enabling tools to track data flow across complex function call hierarchies. Traditionally, these programs are modeled using Pushdown Systems (PDSs) or Recursive State Machines (RSMs). While mathematically equivalent, the choice of model significantly impacts algorithmic efficiency. This paper demonstrates that by explicitly leveraging the internal structure of RSMs—specifically the number of entry and exit points—it is possible to achieve substantial speedups in reachability and dataflow analysis.

The Structural Advantage of RSMs

The primary challenge in interprocedural analysis is handling the potentially infinite stack of function calls. PDSs address this generically, often ignoring the modular boundaries of the original code. In contrast, RSMs explicitly model modules with defined entry and exit nodes.

Figure 1: Examples of Recursive State Machine modules illustrating multiple entry and exit points.

By targeting "weighted" problems—where transitions are labeled with elements from a semiring (e.g., costs, dataflow facts)—the authors argue that existing PDS-based algorithms are unnecessarily slow. They introduce natural parameters like the number of entries/exits per module to refine complexity bounds, showing that ignoring this structure leads to a performance penalty proportional to the number of modules.

The ConfDist Algorithm

The authors propose ConfDist (Configuration Distance), an algorithm designed to optimize weighted queries. Its efficiency stems from three core techniques:

  1. Summarization: To avoid redundant computation, the algorithm calculates "entry-to-exit" summaries for each function. When a function is called under previously analyzed conditions, the stored summary "short-circuits" the search.
  2. Weighted Configuration Automata: The set of reachable program states is represented symbolically as a finite weighted automaton. This structure allows for efficient post-processing and querying.
  3. Query Optimization: The researchers decouple the construction of the automaton (preprocessing) from the actual distance queries. By applying advanced matrix-vector multiplication techniques like Mailman’s algorithm and Four-Russians speedups, they significantly reduce the time required for queries, especially in small domains like Boolean reachability.

The approach is further extended to Concurrent RSMs, improving the complexity of context-bounded reachability, a vital technique for detecting bugs in multi-threaded environments.

Evaluation and Results

The algorithm was evaluated using synthetic dense RSMs and 73 Boolean programs from the SLAM/SDV Project, representing real-world Windows device driver verification tasks.

Theoretical and Empirical Gains

The theoretical results show a marked improvement over existing methods. For finite-height semirings, the complexity is improved by a factor of $\Omega((|R| \cdot f) / (\theta_x + |Call|))$, where $f$ is the number of modules and $\theta_x$ is the number of exits.

Figure 5: Comparison of complexity bounds between existing methods and the proposed results for both sequential and concurrent RSMs.

Empirically, the ConfDist implementation outperformed jMoped, a state-of-the-art weighted PDS analysis tool, by 3.9x to 28.5x on industrial benchmarks. Furthermore, the new approach demonstrated superior memory efficiency, solving all benchmarks within 32GB of RAM, while the baseline tool required up to 72GB.

Conclusion and Future Directions

This work highlights that structural awareness in program modeling is not just a formal preference but a source of significant algorithmic optimization. While the current implementation focuses on explicit data valuations and finite-height semirings, future work aims to integrate symbolic representations (like BDDs) and apply the concurrent algorithms to real-world multi-threaded software.

Summary updated

BibTeX
@inproceedings{chatterjee2017faster,
  author = {Krishnendu Chatterjee and Bernhard Kragl and Samarth Mishra and Andreas Pavlogiannis},
  title = {{Faster Algorithms for Weighted Recursive State Machines}},
  booktitle = {ESOP},
  year = {2017},
  doi = {10.1007/978-3-662-54434-1\_11},
}
Figure