Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : replace all XBT_DEBUG by XBT_INFO
[simgrid.git] / src / mc / mc_liveness.c
1 /* Copyright (c) 2008-2012 Da SimGrid Team. All rights reserved.            */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "mc_private.h"
7 #include <unistd.h>
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
10                                 "Logging specific to algorithms for liveness properties verification");
11
12 xbt_dynar_t reached_pairs;
13 xbt_dynar_t reached_pairs_hash;
14 xbt_dynar_t visited_pairs;
15 xbt_dynar_t visited_pairs_hash;
16 xbt_dynar_t successors;
17
18 xbt_dynar_t hosts_table;
19
20
21 /* fast implementation of djb2 algorithm */
22 unsigned int hash_region(char *str, int str_len){
23
24   int c;
25   register unsigned int hash = 5381;
26
27   while (str_len--) {
28     c = *str++;
29     hash = ((hash << 5) + hash) + c;    /* hash * 33 + c */
30   }
31
32   return hash;
33
34 }
35
36 const char* get_memory_map_addr(void *addr){
37
38   FILE *fp;                     /* File pointer to process's proc maps file */
39   char *line = NULL;            /* Temporal storage for each line that is readed */
40   ssize_t read;                 /* Number of bytes readed */
41   size_t n = 0;                 /* Amount of bytes to read by getline */
42
43   fp = fopen("/proc/self/maps", "r");
44   
45   if(fp == NULL)
46     perror("fopen failed");
47
48   if(addr == NULL){
49     fclose(fp);
50     return "nil";
51   }
52
53   xbt_dynar_t lfields = NULL;
54   xbt_dynar_t start_end  = NULL;
55   void *start_addr;
56   void *end_addr;
57
58   while ((read = getline(&line, &n, fp)) != -1) {
59
60     xbt_str_trim(line, NULL);
61     xbt_str_strip_spaces(line);
62     lfields = xbt_str_split(line,NULL);
63
64     start_end = xbt_str_split(xbt_dynar_get_as(lfields, 0, char*), "-");
65     start_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 0, char*), NULL, 16);
66     end_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 1, char*), NULL, 16);
67
68     if((addr > start_addr) && ( addr < end_addr)){
69       free(line);
70       fclose(fp);
71       if(start_addr == std_heap)
72         return "std_heap";
73       if(start_addr == raw_heap)
74         return "raw_heap";
75       if(xbt_dynar_length(lfields) == 6)
76         return xbt_dynar_get_as(lfields, xbt_dynar_length(lfields) - 1, char*);
77       else
78         return "Anonymous";
79     }
80
81   }
82
83   free(line);
84   fclose(fp);
85   return "Unknown area";
86
87 }
88
89 int data_program_region_compare(void *d1, void *d2, size_t size){
90   int distance = 0;
91   int pointer_align;
92   int i;
93   
94   for(i=0; i<size; i++){
95     if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
96       fprintf(stderr,"Different byte (offset=%d) (%p - %p) in data program region\n", i, (char *)d1 + i, (char *)d2 + i);
97       distance++;
98       pointer_align = (i /sizeof(void *)) * sizeof(void *);
99       fprintf(stderr, "Pointed address : %p (in %s) - %p (in %s)\n", *((void **)((char *)d1 + pointer_align)),  get_memory_map_addr(*((void **)((char *)d1 + pointer_align))), *((void **)((char *)d2 + pointer_align)), get_memory_map_addr(*((void **)((char *)d2 + pointer_align))));
100     }
101   }
102   
103   fprintf(stderr, "Hamming distance between data program regions : %d\n", distance);
104
105   return distance;
106 }
107
108 int data_libsimgrid_region_compare(void *d1, void *d2, size_t size){
109   int distance = 0;
110   int pointer_align;
111   int i;
112   
113   for(i=0; i<size; i++){
114     if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
115       fprintf(stderr, "Different byte (offset=%d) (%p - %p) in data libsimgrid region\n", i, (char *)d1 + i, (char *)d2 + i);
116       distance++;
117       pointer_align = (i /sizeof(void *)) * sizeof(void *);
118       fprintf(stderr, "Pointed address : %p (in %s) - %p (in %s)\n", *((void **)((char *)d1 + pointer_align)), get_memory_map_addr(*((void **)((char *)d1 + pointer_align))), *((void **)((char *)d2 + pointer_align)), get_memory_map_addr(*((void **)((char *)d2 + pointer_align))));
119     }
120   }
121   
122   fprintf(stderr, "Hamming distance between data libsimgrid regions : %d\n", distance);
123   
124   return distance;
125 }
126
127 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap, void* r_heap){
128
129   
130   if(s1->num_reg != s2->num_reg){
131     XBT_INFO("Different num_reg (s1 = %u, s2 = %u)", s1->num_reg, s2->num_reg);
132     return 1;
133   }
134
135   int i;
136   int errors = 0;
137
138   for(i=0 ; i< s1->num_reg ; i++){
139
140     if(s1->regions[i]->type != s2->regions[i]->type){
141         XBT_INFO("Different type of region");
142         errors++;
143     }
144
145     switch(s1->regions[i]->type){
146       case 0:
147       if(s1->regions[i]->size != s2->regions[i]->size){
148         XBT_INFO("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
149         errors++;
150       }
151       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
152         XBT_INFO("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
153         errors++;
154       }
155       if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, s_heap, r_heap)){
156         XBT_INFO("Different heap (mmalloc_compare)");
157         errors++; 
158       }
159       break;
160     case 1 :
161       if(s1->regions[i]->size != s2->regions[i]->size){
162         XBT_INFO("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
163         errors++;
164       }
165       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
166         XBT_INFO("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
167         errors++;
168       }
169       if(data_libsimgrid_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
170         XBT_INFO("Different memcmp for data in libsimgrid");
171         errors++;
172       }
173       break;
174     case 2 :
175       if(s1->regions[i]->size != s2->regions[i]->size){
176         XBT_INFO("Different size of data program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
177         errors++;
178       }
179       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
180         XBT_INFO("Different start addr of data program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
181         errors++;
182       }
183       if(data_program_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
184         XBT_INFO("Different memcmp for data in program");
185         errors++;
186       }
187       break;
188     default:
189       break;
190     }
191   }
192
193   return (errors > 0);
194   
195 }
196
197 int reached(xbt_state_t st){
198
199
200   if(xbt_dynar_is_empty(reached_pairs)){
201
202     return 0;
203
204   }else{
205
206     MC_SET_RAW_MEM;
207
208     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
209     MC_take_snapshot_liveness(sn);    
210     
211     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
212     int res;
213     int_f_void_t f;
214
215     /* Get values of propositional symbols */
216     unsigned int cursor = 0;
217     xbt_propositional_symbol_t ps = NULL;
218     xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
219       f = (int_f_void_t)ps->function;
220       res = (*f)();
221       xbt_dynar_push_as(prop_ato, int, res);
222     }
223
224     cursor = 0;
225     mc_pair_reached_t pair_test = NULL;
226
227     //xbt_dict_t current_rdv_points = SIMIX_get_rdv_points();
228      
229     xbt_dynar_foreach(reached_pairs, cursor, pair_test){
230       XBT_INFO("Pair reached #%u", cursor+1);
231       if(automaton_state_compare(pair_test->automaton_state, st) == 0){
232         if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
233           //XBT_INFO("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points));
234           //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){
235           //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){
236           if(snapshot_compare(pair_test->system_state, sn, std_heap, raw_heap) == 0){
237             MC_free_snapshot(sn);
238             xbt_dynar_reset(prop_ato);
239             xbt_free(prop_ato);
240             MC_UNSET_RAW_MEM;
241             return 1;
242           }
243           /* }
244           }else{
245             XBT_INFO("Different size of rdv points (%d - %d)",xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points) );
246             }*/
247         }else{
248           XBT_INFO("Different values of propositional symbols");
249         }
250       }else{
251         XBT_INFO("Different automaton state");
252       }
253     }
254
255     MC_free_snapshot(sn);
256     xbt_dynar_reset(prop_ato);
257     xbt_free(prop_ato);
258     MC_UNSET_RAW_MEM;
259     return 0;
260     
261   }
262 }
263
264 int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2){ /* d1 = pair_test, d2 = current_pair */ 
265   
266    xbt_dict_cursor_t cursor_dict = NULL;
267    char *key;
268    char *data;
269    smx_rdv_t rdv1, rdv2;
270    xbt_fifo_item_t item1, item2;
271    smx_action_t action1, action2;
272    xbt_fifo_item_t item_req1, item_req2;
273    smx_simcall_t req1, req2;
274    int i=0;
275    int j=0;
276
277    xbt_dict_foreach(d1, cursor_dict, key, data){
278      rdv1 = (smx_rdv_t)data;
279      rdv2 = xbt_dict_get_or_null(d2, rdv1->name);
280      if(rdv2 == NULL){
281        XBT_INFO("Rdv point unknown");
282        return 1;
283      }else{
284        if(xbt_fifo_size(rdv1->comm_fifo) != xbt_fifo_size(rdv2->comm_fifo)){
285          XBT_INFO("Different total of actions in mailbox \"%s\" (%d - %d)", rdv1->name, xbt_fifo_size(rdv1->comm_fifo),xbt_fifo_size(rdv2->comm_fifo) );
286          return 1;
287        }else{
288          
289          XBT_INFO("Total of actions in mailbox \"%s\" : %d", rdv1->name, xbt_fifo_size(rdv1->comm_fifo)); 
290          
291          item1 = xbt_fifo_get_first_item(rdv1->comm_fifo);      
292          item2 = xbt_fifo_get_first_item(rdv2->comm_fifo);
293
294          while(i<xbt_fifo_size(rdv1->comm_fifo)){
295            action1 = (smx_action_t) xbt_fifo_get_item_content(item1);
296            action2 = (smx_action_t) xbt_fifo_get_item_content(item2);
297
298            if(action1->type != action2->type){
299              XBT_INFO("Different type of action");
300              return 1;
301            }
302
303            if(action1->state != action2->state){
304              XBT_INFO("Different state of action");
305              return 1;
306            }
307
308            if(xbt_fifo_size(action1->simcalls) != xbt_fifo_size(action2->simcalls)){
309              XBT_INFO("Different size of simcall list (%d - %d", xbt_fifo_size(action1->simcalls), xbt_fifo_size(action2->simcalls));
310              return 1;
311            }else{
312
313              item_req1 = xbt_fifo_get_first_item(action1->simcalls);    
314              item_req2 = xbt_fifo_get_first_item(action2->simcalls);
315
316              while(j<xbt_fifo_size(action1->simcalls)){
317
318                req1 = (smx_simcall_t) xbt_fifo_get_item_content(item_req1);
319                req2 = (smx_simcall_t) xbt_fifo_get_item_content(item_req2);
320                
321                if(req1->call != req2->call){
322                  XBT_INFO("Different simcall call in simcalls of action (%d - %d)", (int)req1->call, (int)req2->call);
323                  return 1;
324                }
325                if(req1->issuer->pid != req2->issuer->pid){
326                  XBT_INFO("Different simcall issuer in simcalls of action (%lu- %lu)", req1->issuer->pid, req2->issuer->pid);
327                  return 1;
328                }
329
330                item_req1 = xbt_fifo_get_next_item(item_req1);   
331                item_req2 = xbt_fifo_get_next_item(item_req2);
332                j++;
333                
334              }
335            }
336
337            switch(action1->type){
338            case 0: /* execution */
339            case 1: /* parallel execution */
340              if(strcmp(action1->execution.host->name, action2->execution.host->name) != 0)
341                return 1;
342              break;
343            case 2: /* comm */
344              if(action1->comm.type != action2->comm.type)
345                return 1;
346              //XBT_INFO("Type of comm : %d", action1->comm.type);
347              
348              switch(action1->comm.type){
349              case 0: /* SEND */
350                if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
351                  return 1;
352                if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
353                  return 1;
354                break;
355              case 1: /* RECEIVE */
356                if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
357                  return 1;
358                if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
359                  return 1;
360                break;
361              case 2: /* READY */
362                if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
363                  return 1;
364                if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
365                  return 1;
366                if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
367                  return 1;
368                if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
369                  return 1;
370                break;
371              case 3: /* DONE */
372                if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
373                  return 1;
374                if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
375                  return 1;
376                if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
377                  return 1;
378                if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
379                  return 1;
380                break;
381                
382              } /* end of switch on type of comm */
383              
384              if(action1->comm.refcount != action2->comm.refcount)
385                return 1;
386              if(action1->comm.detached != action2->comm.detached)
387                return 1;
388              if(action1->comm.rate != action2->comm.rate)
389                return 1;
390              if(action1->comm.task_size != action2->comm.task_size)
391                return 1;
392              if(action1->comm.src_buff != action2->comm.src_buff)
393                return 1;
394              if(action1->comm.dst_buff != action2->comm.dst_buff)
395                return 1;
396              if(action1->comm.src_data != action2->comm.src_data)
397                return 1;
398              if(action1->comm.dst_data != action2->comm.dst_data)
399                return 1;
400              
401              break;
402            case 3: /* sleep */
403              if(strcmp(action1->sleep.host->name, action2->sleep.host->name) != 0)
404                return 1;
405              break;
406            case 4: /* synchro */
407              
408              break;
409            default:
410              break;
411            }
412
413            item1 = xbt_fifo_get_next_item(item1);       
414            item2 = xbt_fifo_get_next_item(item2);
415            i++;
416          }
417        }
418      }
419    }
420
421    return 0;
422    
423 }
424
425 void set_pair_reached(xbt_state_t st){
426
427  
428   MC_SET_RAW_MEM;
429   
430   mc_pair_reached_t pair = NULL;
431   pair = xbt_new0(s_mc_pair_reached_t, 1);
432   pair->automaton_state = st;
433   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
434   pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
435   //pair->rdv_points = xbt_dict_new();  
436   MC_take_snapshot_liveness(pair->system_state);
437
438   /* Get values of propositional symbols */
439   unsigned int cursor = 0;
440   xbt_propositional_symbol_t ps = NULL;
441   int res;
442   int_f_void_t f;
443
444   xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
445     f = (int_f_void_t)ps->function;
446     res = (*f)();
447     xbt_dynar_push_as(pair->prop_ato, int, res);
448   }
449
450   /*xbt_dict_t rdv_points = SIMIX_get_rdv_points();
451
452   xbt_dict_cursor_t cursor_dict = NULL;
453   char *key;
454   char *data;
455   xbt_fifo_item_t item;
456   smx_action_t action;
457
458   xbt_dict_foreach(rdv_points, cursor_dict, key, data){
459     smx_rdv_t new_rdv = xbt_new0(s_smx_rvpoint_t, 1);
460     new_rdv->name = strdup(((smx_rdv_t)data)->name);
461     new_rdv->comm_fifo = xbt_fifo_new();
462     xbt_fifo_foreach(((smx_rdv_t)data)->comm_fifo, item, action, smx_action_t) {
463       smx_action_t a = xbt_new0(s_smx_action_t, 1);
464       memcpy(a, action, sizeof(s_smx_action_t));
465       xbt_fifo_push(new_rdv->comm_fifo, a);
466       XBT_INFO("New action (type = %d, state = %d) in mailbox \"%s\"", action->type, action->state, key);
467       if(action->type==2)
468         XBT_INFO("Type of communication : %d, Ref count = %d", action->comm.type, action->comm.refcount);
469     }
470     //new_rdv->comm_fifo = xbt_fifo_copy(((smx_rdv_t)data)->comm_fifo);
471     xbt_dict_set(pair->rdv_points, new_rdv->name, new_rdv, NULL);
472     }*/
473  
474   xbt_dynar_push(reached_pairs, &pair); 
475
476   MC_UNSET_RAW_MEM;
477   
478 }
479
480
481 int reached_hash(xbt_state_t st){
482
483
484   if(xbt_dynar_is_empty(reached_pairs_hash)){
485
486     return 0;
487
488   }else{
489
490     MC_SET_RAW_MEM;
491
492     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
493     MC_take_snapshot_liveness(sn);
494
495     int j;
496     unsigned int hash_regions[sn->num_reg];
497     for(j=0; j<sn->num_reg; j++){
498       hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
499     }
500
501
502     /* Get values of propositional symbols */
503     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
504     unsigned int cursor = 0;
505     xbt_propositional_symbol_t ps = NULL;
506     int res;
507     int_f_void_t f;
508
509     xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
510       f = (int_f_void_t)ps->function;
511       res = (*f)();
512       xbt_dynar_push_as(prop_ato, int, res);
513     }
514
515     mc_pair_reached_hash_t pair_test = NULL;
516
517     int region_diff = 0;
518
519     cursor = 0;
520
521     xbt_dynar_foreach(reached_pairs_hash, cursor, pair_test){
522
523       if(automaton_state_compare(pair_test->automaton_state, st) == 0){
524         if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
525           for(j=0 ; j< sn->num_reg ; j++){
526             if(hash_regions[j] != pair_test->hash_regions[j]){
527               region_diff++;
528             }
529           }
530           if(region_diff == 0){
531             MC_free_snapshot(sn);
532             xbt_dynar_reset(prop_ato);
533             xbt_free(prop_ato);
534             MC_UNSET_RAW_MEM;
535             return 1;
536           }else{
537             XBT_INFO("Different snapshot");
538           }
539         }else{
540           XBT_INFO("Different values of propositional symbols");
541         }
542       }else{
543         XBT_INFO("Different automaton state");
544       }
545
546       region_diff = 0;
547     }
548     
549     MC_free_snapshot(sn);
550     xbt_dynar_reset(prop_ato);
551     xbt_free(prop_ato);
552     MC_UNSET_RAW_MEM;
553     return 0;
554     
555   }
556 }
557
558 void set_pair_reached_hash(xbt_state_t st){
559  
560   MC_SET_RAW_MEM;
561
562   mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
563   MC_take_snapshot_liveness(sn);
564  
565   mc_pair_reached_hash_t pair = NULL;
566   pair = xbt_new0(s_mc_pair_reached_hash_t, 1);
567   pair->automaton_state = st;
568   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
569   pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
570   
571   int i;
572
573   for(i=0 ; i< sn->num_reg ; i++){
574     pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
575   }
576   
577   /* Get values of propositional symbols */
578   unsigned int cursor = 0;
579   xbt_propositional_symbol_t ps = NULL;
580   int res;
581   int_f_void_t f;
582
583   xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
584     f = (int_f_void_t)ps->function;
585     res = (*f)();
586     xbt_dynar_push_as(pair->prop_ato, int, res);
587   }
588   
589   xbt_dynar_push(reached_pairs_hash, &pair);
590
591   MC_free_snapshot(sn);
592   
593   MC_UNSET_RAW_MEM;
594     
595 }
596
597
598 int visited(xbt_state_t st, int sc){
599
600
601   if(xbt_dynar_is_empty(visited_pairs)){
602
603     return 0;
604
605   }else{
606
607     MC_SET_RAW_MEM;
608
609     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
610     MC_take_snapshot_liveness(sn);
611
612     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
613
614     /* Get values of propositional symbols */
615     unsigned int cursor = 0;
616     xbt_propositional_symbol_t ps = NULL;
617     int res;
618     int_f_void_t f;
619
620     xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
621       f = (int_f_void_t)ps->function;
622       res = (*f)();
623       xbt_dynar_push_as(prop_ato, int, res);
624     }
625
626     cursor = 0;
627     mc_pair_visited_t pair_test = NULL;
628
629     xbt_dynar_foreach(visited_pairs, cursor, pair_test){
630       if(pair_test->search_cycle == sc) {
631         if(automaton_state_compare(pair_test->automaton_state, st) == 0){
632           if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
633             if(snapshot_compare(pair_test->system_state, sn, std_heap, raw_heap) == 0){
634             
635               MC_free_snapshot(sn);
636               xbt_dynar_reset(prop_ato);
637               xbt_free(prop_ato);
638               MC_UNSET_RAW_MEM;
639                 
640               return 1;
641         
642             }else{
643               XBT_INFO("Different snapshot");
644             }
645           }else{
646             XBT_INFO("Different values of propositional symbols"); 
647           }
648         }else{
649           XBT_INFO("Different automaton state");
650         }
651       }else{
652         XBT_INFO("Different value of search_cycle");
653       }
654     }
655
656
657     MC_free_snapshot(sn);
658     xbt_dynar_reset(prop_ato);
659     xbt_free(prop_ato);
660     MC_UNSET_RAW_MEM;
661     return 0;
662     
663   }
664 }
665
666
667 int visited_hash(xbt_state_t st, int sc){
668
669
670   if(xbt_dynar_is_empty(visited_pairs_hash)){
671
672     return 0;
673
674   }else{
675
676     MC_SET_RAW_MEM;
677
678     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
679     MC_take_snapshot_liveness(sn);
680
681     int j;
682     unsigned int hash_regions[sn->num_reg];
683     for(j=0; j<sn->num_reg; j++){
684       hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
685     }
686
687     
688     /* Get values of propositional symbols */
689     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
690     unsigned int cursor = 0;
691     xbt_propositional_symbol_t ps = NULL;
692     int res;
693     int_f_void_t f;
694
695     xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
696       f = (int_f_void_t)ps->function;
697       res = (*f)();
698       xbt_dynar_push_as(prop_ato, int, res);
699     }
700
701     mc_pair_visited_hash_t pair_test = NULL;
702
703     int region_diff = 0;
704     cursor = 0;
705
706     xbt_dynar_foreach(visited_pairs_hash, cursor, pair_test){
707   
708       if(pair_test->search_cycle == sc) {
709         if(automaton_state_compare(pair_test->automaton_state, st) == 0){
710           if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
711             for(j=0 ; j< sn->num_reg ; j++){
712               if(hash_regions[j] != pair_test->hash_regions[j]){
713                 region_diff++;
714               }
715             }
716             if(region_diff == 0){
717               MC_free_snapshot(sn);
718               xbt_dynar_reset(prop_ato);
719               xbt_free(prop_ato);
720               MC_UNSET_RAW_MEM;
721               return 1;
722             }else{
723               //XBT_INFO("Different snapshot");
724             }
725           }else{
726             //XBT_INFO("Different values of propositional symbols"); 
727           }
728         }else{
729           //XBT_INFO("Different automaton state");
730         }
731       }else{
732         //XBT_INFO("Different value of search_cycle");
733       }
734       
735       region_diff = 0;
736     }
737     
738     MC_free_snapshot(sn);
739     xbt_dynar_reset(prop_ato);
740     xbt_free(prop_ato);
741     MC_UNSET_RAW_MEM;
742     return 0;
743     
744   }
745 }
746
747 void set_pair_visited_hash(xbt_state_t st, int sc){
748  
749   MC_SET_RAW_MEM;
750
751   mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
752   MC_take_snapshot_liveness(sn);
753  
754   mc_pair_visited_hash_t pair = NULL;
755   pair = xbt_new0(s_mc_pair_visited_hash_t, 1);
756   pair->automaton_state = st;
757   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
758   pair->search_cycle = sc;
759   pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
760   
761   int i;
762
763   for(i=0 ; i< sn->num_reg ; i++){
764     pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
765   }
766   
767   /* Get values of propositional symbols */
768   unsigned int cursor = 0;
769   xbt_propositional_symbol_t ps = NULL;
770   int res;
771   int_f_void_t f;
772
773   xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
774     f = (int_f_void_t)ps->function;
775     res = (*f)();
776     xbt_dynar_push_as(pair->prop_ato, int, res);
777   }
778   
779   xbt_dynar_push(visited_pairs_hash, &pair);
780
781   MC_free_snapshot(sn);
782   
783   MC_UNSET_RAW_MEM;
784     
785 }
786
787 void set_pair_visited(xbt_state_t st, int sc){
788
789  
790   MC_SET_RAW_MEM;
791  
792   mc_pair_visited_t pair = NULL;
793   pair = xbt_new0(s_mc_pair_visited_t, 1);
794   pair->automaton_state = st;
795   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
796   pair->search_cycle = sc;
797   pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
798   MC_take_snapshot_liveness(pair->system_state);
799
800
801   /* Get values of propositional symbols */
802   unsigned int cursor = 0;
803   xbt_propositional_symbol_t ps = NULL;
804   int res;
805   int_f_void_t f;
806
807   xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
808     f = (int_f_void_t)ps->function;
809     res = (*f)();
810     xbt_dynar_push_as(pair->prop_ato, int, res);
811   }
812   
813   xbt_dynar_push(visited_pairs, &pair);
814   
815   MC_UNSET_RAW_MEM;
816   
817   
818 }
819
820 void MC_pair_delete(mc_pair_t pair){
821   xbt_free(pair->graph_state->proc_status);
822   xbt_free(pair->graph_state);
823   xbt_free(pair);
824 }
825
826
827
828 int MC_automaton_evaluate_label(xbt_exp_label_t l){
829   
830   switch(l->type){
831   case 0 : {
832     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
833     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
834     return (left_res || right_res);
835   }
836   case 1 : {
837     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
838     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
839     return (left_res && right_res);
840   }
841   case 2 : {
842     int res = MC_automaton_evaluate_label(l->u.exp_not);
843     return (!res);
844   }
845   case 3 : { 
846     unsigned int cursor = 0;
847     xbt_propositional_symbol_t p = NULL;
848     int_f_void_t f;
849     xbt_dynar_foreach(automaton->propositional_symbols, cursor, p){
850       if(strcmp(p->pred, l->u.predicat) == 0){
851         f = (int_f_void_t)p->function;
852         return (*f)();
853       }
854     }
855     return -1;
856   }
857   case 4 : {
858     return 2;
859   }
860   default : 
861     return -1;
862   }
863 }
864
865
866 /********************* Double-DFS stateless *******************/
867
868 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
869   xbt_free(pair->graph_state->proc_status);
870   xbt_free(pair->graph_state);
871   xbt_free(pair);
872 }
873
874 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r){
875   mc_pair_stateless_t p = NULL;
876   p = xbt_new0(s_mc_pair_stateless_t, 1);
877   p->automaton_state = st;
878   p->graph_state = sg;
879   p->requests = r;
880   mc_stats_pair->expanded_pairs++;
881   return p;
882 }
883
884 void MC_ddfs_init(void){
885
886   XBT_INFO("**************************************************");
887   XBT_INFO("Double-DFS init");
888   XBT_INFO("**************************************************");
889
890   mc_pair_stateless_t mc_initial_pair = NULL;
891   mc_state_t initial_graph_state = NULL;
892   smx_process_t process; 
893
894  
895   MC_wait_for_requests();
896
897   MC_SET_RAW_MEM;
898
899   initial_graph_state = MC_state_pair_new();
900   xbt_swag_foreach(process, simix_global->process_list){
901     if(MC_process_is_enabled(process)){
902       MC_state_interleave_process(initial_graph_state, process);
903     }
904   }
905
906   reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
907   //reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
908   //visited_pairs = xbt_dynar_new(sizeof(mc_pair_visited_t), NULL);
909   visited_pairs_hash = xbt_dynar_new(sizeof(mc_pair_visited_hash_t), NULL);
910   successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
911
912   /* Save the initial state */
913   initial_snapshot_liveness = xbt_new0(s_mc_snapshot_t, 1);
914   MC_take_snapshot_liveness(initial_snapshot_liveness);
915
916   MC_UNSET_RAW_MEM; 
917
918   unsigned int cursor = 0;
919   xbt_state_t state;
920
921   xbt_dynar_foreach(automaton->states, cursor, state){
922     if(state->type == -1){
923       
924       MC_SET_RAW_MEM;
925       mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
926       xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
927       MC_UNSET_RAW_MEM;
928       
929       if(cursor != 0){
930         MC_restore_snapshot(initial_snapshot_liveness);
931         MC_UNSET_RAW_MEM;
932       }
933
934       MC_ddfs(0);
935
936     }else{
937       if(state->type == 2){
938       
939         MC_SET_RAW_MEM;
940         mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
941         xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
942         MC_UNSET_RAW_MEM;
943
944         set_pair_reached(state);
945         //set_pair_reached_hash(state);
946
947         if(cursor != 0){
948           MC_restore_snapshot(initial_snapshot_liveness);
949           MC_UNSET_RAW_MEM;
950         }
951         
952         MC_ddfs(1);
953         
954       }
955     }
956   } 
957
958 }
959
960
961 void MC_ddfs(int search_cycle){
962
963   smx_process_t process;
964   mc_pair_stateless_t current_pair = NULL;
965
966   if(xbt_fifo_size(mc_stack_liveness) == 0)
967     return;
968
969
970   /* Get current pair */
971   current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
972
973   /* Update current state in buchi automaton */
974   automaton->current_state = current_pair->automaton_state;
975
976  
977   XBT_INFO("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness), search_cycle);
978   XBT_INFO("Pair : graph=%p, automaton=%p(%s), %u interleave", current_pair->graph_state, current_pair->automaton_state, current_pair->automaton_state->id, MC_state_interleave_size(current_pair->graph_state));
979  
980   mc_stats_pair->visited_pairs++;
981
982   //sleep(1);
983
984   int value;
985   mc_state_t next_graph_state = NULL;
986   smx_simcall_t req = NULL;
987   char *req_str;
988
989   xbt_transition_t transition_succ;
990   unsigned int cursor = 0;
991   int res;
992
993   mc_pair_stateless_t next_pair = NULL;
994   mc_pair_stateless_t pair_succ;
995
996   if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){
997
998     //set_pair_visited(current_pair->automaton_state, search_cycle);
999     set_pair_visited_hash(current_pair->automaton_state, search_cycle);
1000
1001     //XBT_INFO("Visited pairs : %lu", xbt_dynar_length(visited_pairs));
1002     XBT_INFO("Visited pairs : %lu", xbt_dynar_length(visited_pairs_hash));
1003
1004     if(current_pair->requests > 0){
1005
1006       while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
1007    
1008         /* Debug information */
1009
1010         req_str = MC_request_to_string(req, value);
1011         XBT_INFO("Execute: %s", req_str);
1012         xbt_free(req_str);
1013
1014         MC_state_set_executed_request(current_pair->graph_state, req, value);   
1015     
1016         /* Answer the request */
1017         SIMIX_simcall_pre(req, value);
1018
1019         /* Wait for requests (schedules processes) */
1020         MC_wait_for_requests();
1021
1022
1023         MC_SET_RAW_MEM;
1024
1025         /* Create the new expanded graph_state */
1026         next_graph_state = MC_state_pair_new();
1027
1028         /* Get enabled process and insert it in the interleave set of the next graph_state */
1029         xbt_swag_foreach(process, simix_global->process_list){
1030           if(MC_process_is_enabled(process)){
1031             MC_state_interleave_process(next_graph_state, process);
1032           }
1033         }
1034
1035         xbt_dynar_reset(successors);
1036
1037         MC_UNSET_RAW_MEM;
1038
1039
1040         cursor= 0;
1041         xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1042
1043           res = MC_automaton_evaluate_label(transition_succ->label);
1044
1045           if(res == 1){ // enabled transition in automaton
1046             MC_SET_RAW_MEM;
1047             next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1048             xbt_dynar_push(successors, &next_pair);
1049             MC_UNSET_RAW_MEM;
1050           }
1051
1052         }
1053
1054         cursor = 0;
1055    
1056         xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1057       
1058           res = MC_automaton_evaluate_label(transition_succ->label);
1059         
1060           if(res == 2){ // true transition in automaton
1061             MC_SET_RAW_MEM;
1062             next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1063             xbt_dynar_push(successors, &next_pair);
1064             MC_UNSET_RAW_MEM;
1065           }
1066
1067         }
1068
1069         cursor = 0; 
1070         
1071         xbt_dynar_foreach(successors, cursor, pair_succ){
1072
1073           if(search_cycle == 1){
1074
1075             if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
1076                       
1077               if(reached(pair_succ->automaton_state)){
1078                 //if(reached_hash(pair_succ->automaton_state)){
1079               
1080                 XBT_INFO("Next pair (depth = %d, %u interleave) already reached !", xbt_fifo_size(mc_stack_liveness) + 1, MC_state_interleave_size(pair_succ->graph_state));
1081
1082                 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1083                 XBT_INFO("|             ACCEPTANCE CYCLE            |");
1084                 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1085                 XBT_INFO("Counter-example that violates formula :");
1086                 MC_show_stack_liveness(mc_stack_liveness);
1087                 MC_dump_stack_liveness(mc_stack_liveness);
1088                 MC_print_statistics_pairs(mc_stats_pair);
1089                 exit(0);
1090
1091               }else{
1092
1093                 XBT_INFO("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1094               
1095                 set_pair_reached(pair_succ->automaton_state);
1096                 //set_pair_reached_hash(pair_succ->automaton_state);
1097
1098                 XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1099                 //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1100
1101                 MC_SET_RAW_MEM;
1102                 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1103                 MC_UNSET_RAW_MEM;
1104                 
1105                 MC_ddfs(search_cycle);
1106
1107               }
1108
1109             }else{
1110
1111               if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1112                 //if(!visited(pair_succ->automaton_state, search_cycle)){
1113                 
1114                 MC_SET_RAW_MEM;
1115                 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1116                 MC_UNSET_RAW_MEM;
1117                 
1118                 MC_ddfs(search_cycle);
1119                 
1120               }else{
1121
1122                 XBT_INFO("Next pair already visited ! ");
1123
1124               }
1125               
1126             }
1127
1128           }else{
1129           
1130             if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1131
1132               XBT_INFO("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1133             
1134               set_pair_reached(pair_succ->automaton_state); 
1135               //set_pair_reached_hash(pair_succ->automaton_state);
1136
1137               search_cycle = 1;
1138
1139               XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1140               //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1141
1142             }
1143
1144             if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1145               //if(!visited(pair_succ->automaton_state, search_cycle)){
1146               
1147               MC_SET_RAW_MEM;
1148               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1149               MC_UNSET_RAW_MEM;
1150               
1151               MC_ddfs(search_cycle);
1152               
1153             }else{
1154
1155               XBT_INFO("Next pair already visited ! ");
1156
1157             }
1158
1159           }
1160
1161          
1162           /* Restore system before checking others successors */
1163           if(cursor != (xbt_dynar_length(successors) - 1))
1164             MC_replay_liveness(mc_stack_liveness, 1);
1165         
1166           
1167         }
1168
1169         if(MC_state_interleave_size(current_pair->graph_state) > 0){
1170           XBT_INFO("Backtracking to depth %d", xbt_fifo_size(mc_stack_liveness));
1171           MC_replay_liveness(mc_stack_liveness, 0);
1172         }
1173       }
1174
1175  
1176     }else{  /*No request to execute, search evolution in Büchi automaton */
1177
1178       MC_SET_RAW_MEM;
1179
1180       /* Create the new expanded graph_state */
1181       next_graph_state = MC_state_pair_new();
1182
1183       xbt_dynar_reset(successors);
1184
1185       MC_UNSET_RAW_MEM;
1186
1187
1188       cursor= 0;
1189       xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1190
1191         res = MC_automaton_evaluate_label(transition_succ->label);
1192
1193         if(res == 1){ // enabled transition in automaton
1194           MC_SET_RAW_MEM;
1195           next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1196           xbt_dynar_push(successors, &next_pair);
1197           MC_UNSET_RAW_MEM;
1198         }
1199
1200       }
1201
1202       cursor = 0;
1203    
1204       xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1205       
1206         res = MC_automaton_evaluate_label(transition_succ->label);
1207         
1208         if(res == 2){ // true transition in automaton
1209           MC_SET_RAW_MEM;
1210           next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1211           xbt_dynar_push(successors, &next_pair);
1212           MC_UNSET_RAW_MEM;
1213         }
1214
1215       }
1216
1217       cursor = 0; 
1218      
1219       xbt_dynar_foreach(successors, cursor, pair_succ){
1220
1221         if(search_cycle == 1){
1222
1223           if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
1224
1225             if(reached(pair_succ->automaton_state)){
1226               //if(reached_hash(pair_succ->automaton_state)){
1227
1228               XBT_INFO("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
1229
1230               XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1231               XBT_INFO("|             ACCEPTANCE CYCLE            |");
1232               XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1233               XBT_INFO("Counter-example that violates formula :");
1234               MC_show_stack_liveness(mc_stack_liveness);
1235               MC_dump_stack_liveness(mc_stack_liveness);
1236               MC_print_statistics_pairs(mc_stats_pair);
1237               exit(0);
1238
1239             }else{
1240
1241               XBT_INFO("Next pair (depth = %d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1242               
1243               set_pair_reached(pair_succ->automaton_state);
1244               //set_pair_reached_hash(pair_succ->automaton_state);
1245                 
1246               XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1247               //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1248
1249               MC_SET_RAW_MEM;
1250               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1251               MC_UNSET_RAW_MEM;
1252               
1253               MC_ddfs(search_cycle);
1254
1255             }
1256
1257           }else{
1258
1259             if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1260               //if(!visited(pair_succ->automaton_state, search_cycle)){
1261
1262               MC_SET_RAW_MEM;
1263               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1264               MC_UNSET_RAW_MEM;
1265               
1266               MC_ddfs(search_cycle);
1267               
1268             }else{
1269
1270               XBT_INFO("Next pair already visited ! ");
1271
1272             }
1273           }
1274             
1275
1276         }else{
1277             
1278           if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1279
1280             set_pair_reached(pair_succ->automaton_state);
1281             //set_pair_reached_hash(pair_succ->automaton_state);
1282                     
1283             search_cycle = 1;
1284
1285             XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1286             //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1287
1288           }
1289
1290           if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1291             //if(!visited(pair_succ->automaton_state, search_cycle)){
1292
1293             MC_SET_RAW_MEM;
1294             xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1295             MC_UNSET_RAW_MEM;
1296             
1297             MC_ddfs(search_cycle);
1298             
1299           }else{
1300
1301             XBT_INFO("Next pair already visited ! ");
1302
1303           }
1304
1305         }
1306
1307         /* Restore system before checking others successors */
1308         if(cursor != xbt_dynar_length(successors) - 1)
1309           MC_replay_liveness(mc_stack_liveness, 1);
1310
1311          
1312       }
1313            
1314     }
1315     
1316   }else{
1317     
1318     XBT_INFO("Max depth reached");
1319
1320   }
1321
1322   if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){
1323     XBT_INFO("Pair (graph=%p, automaton =%p, search_cycle = %d, depth = %d) shifted in stack, maximum depth reached", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1324   }else{
1325     XBT_INFO("Pair (graph=%p, automaton =%p, search_cycle = %d, depth = %d) shifted in stack", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1326   }
1327
1328   
1329   MC_SET_RAW_MEM;
1330   xbt_fifo_shift(mc_stack_liveness);
1331   if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
1332     xbt_dynar_pop(reached_pairs, NULL);
1333     //xbt_dynar_pop(reached_pairs_hash, NULL);
1334   }
1335   MC_UNSET_RAW_MEM;
1336   
1337   
1338
1339 }