Efficient Runtime Assertion Checking of Assignable Clauses with Datagroups

Runtime assertion checking is useful for debugging programs and specifications. Existing tools check invariants as well as method pre- and postconditions, but mostly ignore assignable (or modifies) clauses, which specify the heap locations a method is allowed to assign to. A way to abstract from implementation details is to specify assignable clauses using datagroups, which represent sets of concrete memory locations. Efficient runtime checking of assignable clauses with datagroups is difficult because the members of a datagroup may change over time and because datagroups may get very large, especially for recursive data structures. We present the first algorithm to check assignable clauses in the presence of datagroups. The key idea is to compute the set of locations in a datagroup lazily, which requires data structures that reflect when the contents of a datagroup change during the execution of a method. We implemented our approach in a prototypical runtime assertion checker for the Java Modeling Language (Jml); our experiments show that the runtime overhead is moderately small.