File: bdd_volatility

package info (click to toggle)
mona 1.4-7-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,976 kB
  • ctags: 3,713
  • sloc: ansic: 14,363; cpp: 12,610; sh: 1,076; yacc: 493; lex: 358; makefile: 154; lisp: 53
file content (51 lines) | stat: -rw-r--r-- 1,677 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
bdd_ptr bddpaths[10];

/* function that updates BDD pointers floating around in user's code;
the remaining ones are kept in the sub_results list below */

void update_bddpaths(unsigned (*new_place) (unsigned node)) {
  int j;
  
  /* update the pointers in bddpaths */

  for (j = 0; j < exp_count; j++) 
    bddpaths[j] = new_place(bddpaths[j]);
}

/* we can only update pointers that are not stored as local
   variables, so values of local variables are thrown onto a stack */

DECLARE_SEQUENTIAL_LIST(sub_results, unsigned);

bdd_ptr makepath(bdd_manager *bddm, ..., 
                  void (*update_bddpaths) 
                     (unsigned (*new_place) (unsigned node))) {

...
  bdd_ptr res, sub_res, default_state_ptr;
 
  sub_res = makepath(bddm, n+1, leaf_value, update_bddpaths);

  /* push BDD pointer sub_res on list sub_results */

  PUSH_SEQUENTIAL_LIST(sub_results, unsigned, sub_res);
  
  /* insert a new hashed node; thus potentially changing the pointer
  to the node known as sub_res above, and also potentially changing
  the pointers in bddpaths[10].  But bdd_find_leaf_hashed automatically
  updates all pointers in the sub_results list, since it was provided
  as an argument.  Also, the function update_bddpaths is called when a
  doubling of the table takes place and an appropriate renaming function
  new_place is supplied by bdd_find_leaf_hashed */

  default_state_ptr = 
    bdd_find_leaf_hashed(bddm, 
                         default_state, 
                         SEQUENTIAL_LIST(sub_results), 
                         update_bddpaths);

  /* restore the value of sub_res */

  POP_SEQUENTIAL_LIST(sub_results, unsigned, sub_res);
  ...
}