source: CIVL/notes/notes.txt@ 0d850b0

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 0d850b0 was 475b2d9, checked in by Stephen Siegel <siegel@…>, 13 years ago

Fixed bug related to when the path condiiton is set in executing a transition.
Fixed bug related to not initializing $input variables.
Renamed extern->input in various methods.

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

  • Property mode set to 100644
File size: 2.6 KB
Line 
1
2For implementing malloc:
3
4Add sizeof expression in model.
5Semantics: get the dynamic type and evaluate the sizeof that
6using some well-known formulas. Add things to the path condition
7as a side effect, like sizes are greater than 0, or 1, or
8whatever.
9
10Add a MallocStatement to the model. Example
11(double*)malloc(&h, sizeof(double)*10).
12 - int getMallocId();
13 - Expression getHeapPointerExpression(); // &h
14 - Type getStaticElementType(); // double
15 - SymbolicType getDynamicObjectType(); // symbolic array of double
16 - Expression getSizeExpression(); // sizeof(double)*10
17 - SymbolicExpression getUndefinedObject(); // symbolic constant UNDEFINED
18 // of type array of double
19
20During model building, count the malloc statements as they are
21encountered and assign each a unique ID.
22
23Complete the $heap type:
24 For each i, you have the static CIVL type T_i and the
25 __malloc__ function. Compute the most general symbolic
26 type t_i by translating t_i and using incomplete types
27 for arrays. Store t_i in the malloc call object.
28 let $heap be the symbolic type which is the tuple type
29
30 [array of array of t1,
31 array of array of t2,
32 array of array of t3, ...]
33
34Initial value:
35
36 [array of length 0, array of length 0, ...]
37
38Semantics:
39 to execute a malloc statement with malloc index i:
40 let h be the result of evaluating the heap argument. *h is a tuple.
41 (*h).i is a concrete array. Let l be its concrete length.
42 create a new symbolic constant whose name is a function of
43 the pid, dynamic scope id, heap variable ID, index i, and
44 l. The type of this new symbolic constant is array of t_i
45 of length arg/sizeof(t+i), where arg is the result of evaluating
46 the size argument. Check that it evenly divides, and log
47 an error if it might not. Now append this symbolic constant
48 to the concrete array. [Really need a method in SARL to do this.]
49 Anyway, since it is concrete, get its sequence and append on to that.
50 Return the reference with tree:
51 - ref to heap (h)
52 - tuple component ref (i)
53 - array element reference (l)
54 - array element reference (0)
55 which is a reference to the first element of the newly allocated
56 array.
57
58free: sets the value in the heap array to some symbolic constant
59UNDEFINED of type array of t_i.
60
61Canonicalization: map
62 Ref[h,i,l,0] -> Ref[h,i,l',0]
63 H_p_s_v_i_l -> H_p_s_v_i_l' (symbolic constants)
64Perform substitution on the state
65
66
67---
68
69
70Think about moving more stuff into model factory, like pointer value
71manipulation
72
73better printing of model
74
75better printing of states during execution
Note: See TracBrowser for help on using the repository browser.