source: CIVL/notes/notes.txt@ 6a4e2e0

1.23 2.0 main test-branch
Last change on this file since 6a4e2e0 was c5ddcd7, checked in by Stephen Siegel <siegel@…>, 13 years ago

Improving handling of error logging. Removed SARL jar from classpath and added to shared projects because debugging is just too tedious when you have to keep rebuilding the SARL jar.

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

  • Property mode set to 100644
File size: 6.1 KB
Line 
1
2exceptions:
3
4need to log exceptions and keep going, but backtrack as soon as
5pc is unsat.
6
7need to see if pc is sat before deciding there is an error to report.
8
9Enabler: evalutes guard, forms new path condition.
10check at this point that new path condition is sat.
11
12Evaluator: in the course of evaluation, pc may change, things
13may be checked. log errors
14
15 evaluate:
16 step 1, step 2, step 3 (check something, pc becomes unsat),
17 step 4, step 5 (check something), ..., return
18
19When check something, first check if pc is false. Skip the check
20if it is.
21
22Let us assume pc is not certainly unsat when evaluate is called.
23
24Check protocol: check condition condsat. if consat OK, proceed.
25Otherwise: check pc satisfiability, pcsat
26 - pcsat=YES && condsat=NO : certainty=PROVEABLE
27 - pcsat=YES && condsat=MAYBE : certainty=MAYBE
28 - pcsat=MAYBE && condsat=NO : MAYBE
29 - pcsat=MAYBE && condsat=MAYBE : MAYBE
30 - pcsat=NO: should not happen (assertion)
31Add claim to pc and check satisfiability of pc again.
32Add to the log report a note about recovery attempt:
33updating PC changed PC to MAYBE unsat, or definitely
34unsat, ...
35If pcsat=NO, throw UnsatisfiablePathConditionException.
36This gets thrown all the way up to Enabler or Executor.
37
38In Executor, the exception is caught, and the intermediate state
39(whatever the state was when the exception was thrown) with
40path condition set to false is returned.
41
42In Enabler, this happens when determining if a transition is enabled.
43I.e., in evaluating a guard, a side-effect occurred.
44Example: guard: a[i]=0. i might be out of range, what happens?
45The error has been logged, now pc is false, so don't include
46this transition in the list of enabled ones. No need to do
47anything with the exception.
48
49Enabler:
50
51when examining potential transition:
52form new path condition.
53check for satisfiability.
54if not certain unsat, add it.
55
56next state: after producing state, simplify and canonicalize.
57
58
59Fundamentals:
60
61expression: $length(array)
62expression: $append(array, element)
63$concatenate, $remove,
64
65/* A system type for any segment of memory used as a buffer,
66 * formed using union types */
67typedef struct __bundle__ $bundle;
68
69/* Creates a buffer from the memory region specified by
70 * ptr and size, copying the data into the new buffer */
71$bundle $bundle_pack(void *ptr, int size);
72
73/* Copies the data out of the buffer into the region
74 * specified */
75void $bundle_unpack($bundle bundle, void *ptr, int size);
76
77/* creates a new comm from the given sequence of processes,
78 * by allocating memory and copying the process sequence;
79 * the new comm has no messages */
80$comm $comm_create(int nprocs, $proc * procs);
81
82/* adds the message to the comm */
83void $comm_enqueue($comm * comm, $message * message);
84
85/* finds the first matching message, removes it from
86 * comm, and returns pointer to message */
87$message * $comm_dequeue($comm * comm, int source, int dest, int tag);
88
89
90Action Plan:
91 - add a CIVLBundleType, similar to CIVLHeapType
92 - collect all types during model building
93 - complete the CIVLBundleType by giving it the list of all types,
94 and the symbolic type which is the union of array of t_i
95 - defined $bundle_pack in executor by:
96 1. let v = dereference ptr* (just first element)
97 2. let t = v.type();
98 3. array-of-t is the type of the bundle you will make by cases:
99a. is ptr to a variable, or an array element pointer, etc.
100create the new value of type array-of-t.
101 4. cast that to type bundleSymbolicType.
102 5. assign it to lhs.
103
104
105
106
107Consider CIVL-C dropping C's awful pointer-array pun.
108No automatic conversions. (Just drop them if language is CIVL-C).
109
110f(double[] a) : really takes an array of double, not pointer.
111double[] f(...) : returns an array of double
112
113To get the C behavior:
114
115f(double *p) {...}
116
117to call f: f(&a[0]);
118
119
120
121
122
123
124How hard would it be to add a new type: $sequence<T>
125to the language? Like vector or variable length array.
126Then define functions like $append, $add, $remove,
127$subseq, blah blah: but these are all generic.
128Need concept of generic functions. Could make them
129operations.
130
131$buffer $buffer_create(void *ptr, $type element_type, int count);
132
133$buffer $buffer_pack(void *ptr, int size);
134
135Problem: what if type of ptr is just void*. Won't know statically
136all the types to form the union type. Without some sort of flow
137analysis, will have to assume every type is possible.
138
139flow analysis: look at occurrences of $buffer_pack
140if type of expression ptr is void*, look at what goes into that
141expression. pointer arithmetic: ptr argument, trace back
142through assignments, function calls. forget it.
143
144need union of all types.
145
146**** collect all types used in model **** easy
147
148
149
150do essentially the same thing, but take different args.
151If the element type is complete (and hence can use sizeof)
152the first can be defined as
153 $buffer_pack(ptr, count*sizeof(t))
154
155
156
157Messages:
158
159$message_pack has to produce a message, but how?
160Use union type.
161Union over all types which can occur in message_pack.
162Inject.
163Need to extract value from slice of array.
164Wish I had symbolic operators for that.
165Could be single variable, entire array, slice of array
166slice of array: copy elements if concrete bounds, else
167need array - lambda (not yet implemented)
168
169stick in union type.
170
171tyedef struct __buffer__ __buffer__;
172typedef struct __message__ {
173 int source;
174 int dest;
175 int tag;
176 __buffer__ data;
177 int size;
178}
179
180Translate __buffer__ to CIVLBufferType.
181Symbolic type: symbolicBufferType:
182Union-of-array-of-t_i, where t_i ranges over all types
183occuring in message pack calls.
184
185Implement $message_pack : just to create buffer
186
187
188How about relaxing restriction from C that element types of
189arrays must be complete? Instead just generate error
190if you try to take sizeof such a thing.
191Instead of
192(double*)$malloc(&h, size)
193 how about
194$alloc(&h, typeof(double), count);
195
196void* $alloc($heap *h, $type type, int count);
197
198Add to grammar: "$typeof(sizeable)" just like sizeof, but
199don't care about completeness.
200no sizeof required. Type of typeof is $dynamic. Why not "type".
201---
202
203
204Think about moving more stuff into model factory, like pointer value
205manipulation
206
207better printing of model
208
209better printing of states during execution
Note: See TracBrowser for help on using the repository browser.