source: CIVL/include/headers/civlc.cvh@ 6dd0322

main test-branch
Last change on this file since 6dd0322 was 6dd0322, checked in by Alex Wilton <awilton@…>, 3 years ago

Fixed domain type bug. Added first iteration of unreachable pointers for CUDA. Started refactoring newCudaMockup to use message-passing and unreachable pointers.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5734 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 7.2 KB
Line 
1/* This header file contains the core definitions of the CIVL-C language,
2 * including standard types and function prototypes.
3 */
4
5#ifndef _CIVLC_
6#define _CIVLC_
7
8#pragma CIVL ACSL
9/* ********************* Standard Constants and Types ********************* */
10#define $true 1
11
12#define $false 0
13
14#ifndef NULL
15#define NULL ((void*)0)
16#endif
17
18#ifndef __UNSIGNED_BOUND
19#define __UNSIGNED_BOUND 32
20#endif
21
22#define $elaborate(x) for(int _i = 0; _i < (x); _i++)
23
24typedef unsigned long int size_t;
25
26/* ************************** Basic CIVL-C Types ************************** */
27/* The CIVL-C process reference type */
28typedef struct $proc $proc;
29
30/* The CIVL-C scope type, used to represent a scope */
31typedef struct $scope $scope;
32
33/* The CIVL-C program state refrence type */
34typedef struct $state $state;
35
36/* The CIVL-C dynamic type, used to represent a symbolic type */
37typedef struct $dynamic $dynamic;
38
39/* **************************** Misc. Functions **************************** */
40
41/* Wait for another process p to terminate. */
42/*@ depends_on \nothing;
43 @*/
44$system void $wait($proc p);
45
46/* Blocks until all processes referred to by the given
47 array terminates. */
48/*@ depends_on \nothing;
49 @*/
50$system void $waitall($proc *procs, int numProcs);
51
52/* Terminate the calling process. */
53/*@ depends_on \nothing;
54 @ executes_when \true;
55 @*/
56$system void $exit(void);
57
58/* Checks if the given process has terminated.
59 *
60 * The result returned could change from false to true
61 * if any transition in p executes. Currently we don't
62 * have any way to say "depends on any transition in p".
63 */
64/*@
65 @ executes_when \true;
66 @*/
67$system _Bool $is_terminated($proc p);
68
69/* Nondeterministic choice of integer i, such that 0<=i<n. */
70/*@ depends_on \nothing;
71 @ executes_when \true;
72 @*/
73$system int $choose_int(int n);
74
75/*@ depends_on \nothing;
76 @ executes_when \true;
77 @*/
78$system void $assert(_Bool expr, ...);
79
80/*@ depends_on \nothing;
81 @ executes_when \true;
82 @*/
83$system void $assume(_Bool expr);
84
85/* get a unique non-negative integer number for time count */
86/*@ depends_on \nothing;
87 @ executes_when \true;
88 @*/
89$system int $next_time_count(void);
90
91/* print the path condition of the current state */
92/*@
93 @ depends_on \nothing;
94 @ executes_when \true;
95 @*/
96$system void $pathCondition(void);
97
98/* is the given value concrete? */
99/*@ pure;
100 @ depends_on \nothing;
101 @ executes_when \true;
102 @*/
103$system $pure _Bool $is_concrete_int(int value);
104
105/* **************************** Memory Functions *************************** */
106
107/* The CIVL-C malloc function, which takes a reference to a scope */
108/*@ depends_on \nothing;
109 @ executes_when \true;
110 @*/
111$system void* $malloc($scope s, int size);
112
113/* The CIVL-C de-allocation function, which takes a pointer, just like
114 * the standard "free" */
115/*@ depends_on \access(p);
116 @ executes_when \true;
117 @*/
118$system void $free(void *p);
119
120
121/* Assigns arbitrary value to the memory location specified by the given pointer.
122 */
123/*@ depends_on \access(ptr);
124 @ executes_when \true;
125 @*/
126$system void $havoc(void *ptr);
127
128$abstract void* $make_unreachable(void* ptr);
129$system void* $extract_unreachable(void* ptr);
130
131/* Assigns default value to the object referred by the given pointer
132 * "ptr" as if the object has static storage. The definition of
133 * default values of objects having static storage conforms C11
134 * standard.
135 *
136 * The object pointed by "ptr" must have some type.
137 */
138/*@ depends_on \access(ptr);
139 @ executes_when \true;
140 @*/
141$system void $default_value(void *ptr);
142
143/* Returns the value of real number power operation with the given base and exponent.
144 */
145/*@ pure;
146 @ depends_on \nothing;
147 @ executes_when \true;
148 @*/
149$system double $pow(double base, double exp);
150
151/** returns true iff the given pointer is a dereferable pointer */
152/*@ depends_on \nothing;
153 @ executes_when \true;
154 @*/
155$system $state_f _Bool $is_derefable(void * ptr);
156
157/* Returns the reference to a snapshot of the current process from the
158 current state */
159/*@ depends_on \nothing;
160 @ executes_when \true;
161 @*/
162$system $state_f $state $get_state();
163
164/* Returns the reference to the current state */
165/*@ depends_on \nothing; */
166/*@ executes_when \true; */
167$system $state $get_full_state();
168
169// the types will be updated to $integer later
170/*@ pure;
171 @ depends_on \nothing;
172 @ executes_when \true;
173 @*/
174$system int $remainder(int x, int y);
175
176/*@ pure;
177 @ depends_on \nothing;
178 @ executes_when \true;
179 @*/
180$system int $quotient(int x, int y);
181
182/* Push an assumption into the partial path condition stack belong to
183 the calling process. */
184/*@ depends_on \nothing; */
185/*@ executes_when \true; */
186$system void $assume_push(_Bool pred);
187
188/* Pop an entry out of a partial path condition stack belong to the
189 calling process. */
190/*@ depends_on \nothing; */
191/*@ executes_when \true; */
192$system void $assume_pop();
193
194/** The system function informs the verifier that the process is
195 entering an local block. To the verifier, everything in a local
196 block is purely local, i.e., nothing can affect any other process.
197 */
198/*@ depends_on \nothing; */
199/*@ executes_when \true; */
200$system void $local_start();
201
202/** The system function informs the verifier that the process is
203 leaving an local block.
204 */
205$system void $local_end();
206
207/*********************************************************************
208 * As long as a process has a non-empty write set stack, any
209 * modification on variables and memroy heap objects will be recorded
210 * in the write set.
211 *********************************************************************/
212
213/* This is a system function which has the same specification as $when
214 but more strict requirements: The given condition can ONLY change
215 from false to true (or stay true) in any execution of a program,
216 otherwise CIVL will not guarantee the soundness for deadlock-free
217 property.
218 */
219/*@ depends_on \nothing;
220 @*/
221$system void $unidirectional_when(_Bool condition);
222
223/*@ depends_on \access(value);
224 @ executes_when \true;
225 @*/
226$atomic_f void $output_assign(void * output,const void * value, int size);
227
228/* returns the size (in bytes) of the heap of the given scope */
229$system $atomic_f size_t $heap_size($scope scope);
230
231/** The base address q of a pointer p is:
232 *
233 * 1. q := p, if p points anything other than an array element.
234 *
235 * 2. q := a pointer to the first element of the array referred by p,
236 * if p points an array element.
237 *
238 * Note that an "array" here means the physical array which is always
239 * one-dimensional. And a sequence of memory spaces allocated by
240 * malloc will be seen as an array.
241 */
242/*@ depends_on \nothing;
243 @ executes_when \true;
244 @*/
245$system $state_f void * $array_base_address_of(const void *ptr);
246
247
248/** This system function itself is a no-op. However, when a process
249 is at a call to this function, other processes are allowed to
250 interrupt this process. This behavior is in the contrary to an
251 atomic execution that a process cannot be interrupted by other
252 processes. NOTE that allowing other processes to interrupt the
253 current process does not necessarily mean that the interruption
254 will happen. Whether an interruption actually happens (i.e.,
255 transitions of more processes than the current one are enabled at
256 the current state) depends on the POR algorithm.
257 */
258/*@ depends_on \nothing;
259 @*/
260$system void $yield();
261
262#endif
263
264
265
266
Note: See TracBrowser for help on using the repository browser.