Changes between Version 10 and Version 11 of ContractReduction
- Timestamp:
- 07/21/14 09:22:36 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ContractReduction
v10 v11 1 1 == Contract Reduction Language == 2 2 3 == `$depend ` clause ==3 == `$depends` clause == 4 4 5 5 The following contractual clause may appear in a function contract in the same places that `$ensures` or `$requires` clauses can appear: … … 11 11 The following boolean expressions may be used as constituents in the boolean expression `e`: 12 12 13 * `$ access(void * obj)`13 * `$reaches(void * obj)` 14 14 * holds iff the memory unit pointed to by `obj` is reachable from `p`. This means there is a path from the variables on the call stack of `p` to the memory unit, following array elements, struct members, and pointer dereferences, pointer arithmetic. 15 * `$ accessRegion(void * obj)`15 * `$reachesRegion(void * obj)` 16 16 * holds iff any of the memory units reachable from `obj` (including the object pointed to by `obj` itself) is reachable from`p` 17 * `$write (void * obj)`17 * `$writes(void * obj)` 18 18 * holds iff the memory unit pointed to by `obj` is not only reachable from `p` but if it is possible that `p` (or a process spawned by `p`) could write to that memory unit at some point now or in the future. 19 * `$write Region(void * obj)`19 * `$writesRegion(void * obj)` 20 20 * like above but true if any of the memory units in the reachable region specified by `obj` may be written to 21 21 22 Default: if there is `$depends` clause present: 23 * if the body of the function is not provided, i.e., the function is a system function, the verifier will assume that execution of the function may read and/or modify any memory unit that it can reach, and decide on the partial order reduction appropriately 24 * if the body of the function is present, the statements comprising the body may be analyzed to further restrict the reduction. 22 25 23 * Things to be decided: 24 - what shall DEFAULT (when the `$depend` expression is absent) do? 25 - how to specify the case when we need the library enabler to decide the ample set? 26 - what keyword to use to specify functions to execute as one step, `$atomic`, `_Atomic`, etc. 26 == Function specifiers == 27 28 Both `$atomic` and `$atom` may be used as function specifiers. They designate that any call to the function is to be treated atomically or atom-ly, respectively. 29 30 == `$assigns` clause == 31 32 As in other contract specification language, this clause is used to specify a set of existing memory units. The claim is that if an existing memory unit is not in the set, it will not be modified in the course of the function call. 33 34 The argument following the `$assigns` token is a comma-separated list. The elements of the list may be left-hand-side expressions, or an expression of the form 35 {{{ 36 $region(ptr) 37 }}} 38 where `ptr` is expression which has a pointer type. It denotes the set of all memory units reachable from that pointer, beginning with and including the memory unit pointer to by `ptr`. 39 Example: 40 {{{ 41 $assigns x,a[i][j],$region(list->head); 42 }}} 43 44 27 45 28 46 === Examples ===
