Logo AND Algorithmique Numérique Distribuée

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