Automatic Generation of Contracts for Concurrent Java Programs
Published in INForum, 2022
Abstract: It is not uncommon for larger concurrent programs to have hundreds of atomic blocks and/or locks. As these programs become more and more complex, they become increasingly more prone to contain concurrency errors, as a programmer cannot easily take into account every possible interleaving. One way to address this problem is to analyse a concurrent program and generate a Contract for Concurrency, which identify the sequences of statements that must be executed atomically in a concurrent program. This method can be used either as documentation, for aiding development, or by an automatic tool to verify atomicity violations. Gluon is a static analysis tool that verifies such contracts for Java programs. Manually generating contracts for a large-scale codebase is unfeasible, and Gluon lightens this burden by providing an automated but rudimentary contract generation functionality. In this paper we propose a set of heuristics for automatically generating Contracts for Concurrency, and evaluate their accuracy with Gluon. With this new contract generation heuristics, we were able to fine-tune the contract generation, considerably reducing the number of spurious (unnecessary) clauses, which consequently reduced the analysis run time.
