Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use surf_parse_error() rather than xbt_die() during surf parsing
[simgrid.git] / src / mc / mc_liveness.c
1 /* Copyright (c) 2011-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "mc_private.h"
8 #include <unistd.h>
9 #include <sys/wait.h>
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
12                                 "Logging specific to algorithms for liveness properties verification");
13
14 /********* Global variables *********/
15
16 xbt_dynar_t acceptance_pairs;
17 xbt_dynar_t visited_pairs;
18 xbt_dynar_t successors;
19 xbt_parmap_t parmap;
20
21 /********* Static functions *********/
22
23 static xbt_dynar_t get_atomic_propositions_values(){
24   int res;
25   int_f_void_t f;
26   unsigned int cursor = 0;
27   xbt_automaton_propositional_symbol_t ps = NULL;
28   xbt_dynar_t values = xbt_dynar_new(sizeof(int), NULL);
29
30   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
31     f = (int_f_void_t)ps->function;
32     res = f();
33     xbt_dynar_push_as(values, int, res);
34   }
35
36   return values;
37 }
38
39 static int get_search_interval(xbt_dynar_t all_pairs, mc_visited_pair_t pair, int *min, int *max){
40
41   int raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
42
43   MC_SET_RAW_MEM;
44
45   int cursor = 0, previous_cursor, next_cursor;
46   mc_visited_pair_t pair_test;
47   int start = 0;
48   int end = xbt_dynar_length(all_pairs) - 1;
49   
50   while(start <= end){
51     cursor = (start + end) / 2;
52     pair_test = (mc_visited_pair_t)xbt_dynar_get_as(all_pairs, cursor, mc_visited_pair_t);
53     if(pair_test->nb_processes < pair->nb_processes){
54       start = cursor + 1;
55     }else if(pair_test->nb_processes > pair->nb_processes){
56       end = cursor - 1;
57     }else{
58       if(pair_test->heap_bytes_used < pair->heap_bytes_used){
59         start = cursor +1;
60       }else if(pair_test->heap_bytes_used > pair->heap_bytes_used){
61         end = cursor - 1;
62       }else{
63         *min = *max = cursor;
64         previous_cursor = cursor - 1;
65         while(previous_cursor >= 0){
66           pair_test = (mc_visited_pair_t)xbt_dynar_get_as(all_pairs, previous_cursor, mc_visited_pair_t);
67           if(pair_test->nb_processes != pair->nb_processes || pair_test->heap_bytes_used != pair->heap_bytes_used)
68             break;
69           *min = previous_cursor;
70           previous_cursor--;
71         }
72         next_cursor = cursor + 1;
73         while(next_cursor < xbt_dynar_length(all_pairs)){
74           pair_test = (mc_visited_pair_t)xbt_dynar_get_as(all_pairs, next_cursor, mc_visited_pair_t);
75           if(pair_test->nb_processes != pair->nb_processes || pair_test->heap_bytes_used != pair->heap_bytes_used)
76             break;
77           *max = next_cursor;
78           next_cursor++;
79         }
80         if(!raw_mem_set)
81           MC_UNSET_RAW_MEM;
82         return -1;
83       }
84      }
85   }
86
87   if(!raw_mem_set)
88     MC_UNSET_RAW_MEM;
89
90   return cursor;
91 }
92
93 static mc_visited_pair_t is_reached_acceptance_pair(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions){
94
95   int raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
96
97   MC_SET_RAW_MEM;
98   
99   mc_visited_pair_t pair = NULL;
100   pair = MC_visited_pair_new(pair_num, automaton_state, atomic_propositions);
101   pair->acceptance_pair = 1;
102   
103   if(xbt_dynar_is_empty(acceptance_pairs)){
104
105     xbt_dynar_push(acceptance_pairs, &pair); 
106
107   }else{
108
109     int min = -1, max = -1, index;
110     //int res;
111     mc_visited_pair_t pair_test;
112     int cursor;
113
114     index = get_search_interval(acceptance_pairs, pair, &min, &max);
115
116     if(min != -1 && max != -1){ // Acceptance pair with same number of processes and same heap bytes used exists
117       /*res = xbt_parmap_mc_apply(parmap, snapshot_compare, xbt_dynar_get_ptr(acceptance_pairs, min), (max-min)+1, pair);
118       if(res != -1){
119         if(!raw_mem_set)
120           MC_UNSET_RAW_MEM;
121         return ((mc_pair_t)xbt_dynar_get_as(acceptance_pairs, (min+res)-1, mc_pair_t))->num;
122         }*/
123       cursor = min;
124       while(cursor <= max){
125         pair_test = (mc_visited_pair_t)xbt_dynar_get_as(acceptance_pairs, cursor, mc_visited_pair_t);
126         if(xbt_automaton_state_compare(pair_test->automaton_state, pair->automaton_state) == 0){
127           if(xbt_automaton_propositional_symbols_compare_value(pair_test->atomic_propositions, pair->atomic_propositions) == 0){
128             if(snapshot_compare(pair_test, pair) == 0){
129               XBT_INFO("Pair %d already reached (equal to pair %d) !", pair->num, pair_test->num);
130               
131               xbt_fifo_shift(mc_stack_liveness);
132               if(dot_output != NULL)
133                 fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_state_liveness->prev_pair, pair_test->num, initial_state_liveness->prev_req);
134
135               if(!raw_mem_set)
136                 MC_UNSET_RAW_MEM;
137
138               return NULL;
139             }
140           }
141         }
142         cursor++;
143       }
144       xbt_dynar_insert_at(acceptance_pairs, min, &pair);
145     }else{
146       pair_test = (mc_visited_pair_t)xbt_dynar_get_as(acceptance_pairs, index, mc_visited_pair_t);
147       if(pair_test->nb_processes < pair->nb_processes){
148         xbt_dynar_insert_at(acceptance_pairs, index+1, &pair);
149       }else{
150         if(pair_test->heap_bytes_used < pair->heap_bytes_used)
151           xbt_dynar_insert_at(acceptance_pairs, index + 1, &pair);
152         else
153           xbt_dynar_insert_at(acceptance_pairs, index, &pair);
154       }
155     }
156     
157   }
158
159   if(!raw_mem_set)
160     MC_UNSET_RAW_MEM;
161
162   return pair;
163  
164 }
165
166 static void remove_acceptance_pair(int pair_num){
167
168   int raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
169
170   MC_SET_RAW_MEM;
171
172   unsigned int cursor = 0;
173   mc_visited_pair_t pair_test = NULL;
174
175   xbt_dynar_foreach(acceptance_pairs, cursor, pair_test){
176     if(pair_test->num == pair_num){
177       break;
178     }
179   }
180
181   xbt_dynar_remove_at(acceptance_pairs, cursor, &pair_test);
182   
183   pair_test->acceptance_removed = 1;
184
185   if(_sg_mc_visited == 0){
186     MC_visited_pair_delete(pair_test);
187   }else if(pair_test->visited_removed == 1){
188     MC_visited_pair_delete(pair_test);
189   }
190
191   if(!raw_mem_set)
192     MC_UNSET_RAW_MEM;
193 }
194
195 static int is_visited_pair(mc_visited_pair_t pair, int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions){
196
197   if(_sg_mc_visited == 0)
198     return -1;
199
200   int raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
201
202   MC_SET_RAW_MEM;
203
204   mc_visited_pair_t new_pair = NULL;
205
206   if(pair == NULL){
207     new_pair = MC_visited_pair_new(pair_num, automaton_state, atomic_propositions);
208   }else{
209     new_pair = pair;
210   }
211
212   if(xbt_dynar_is_empty(visited_pairs)){
213
214     xbt_dynar_push(visited_pairs, &new_pair); 
215
216   }else{
217
218     int min = -1, max = -1, index;
219     //int res;
220     mc_visited_pair_t pair_test;
221     int cursor;
222
223     index = get_search_interval(visited_pairs, new_pair, &min, &max);
224
225     if(min != -1 && max != -1){ // Visited pair with same number of processes and same heap bytes used exists
226       /*res = xbt_parmap_mc_apply(parmap, snapshot_compare, xbt_dynar_get_ptr(visited_pairs, min), (max-min)+1, pair);
227       if(res != -1){
228         pair_test = (mc_pair_t)xbt_dynar_get_as(visited_pairs, (min+res)-1, mc_pair_t);
229         if(pair_test->other_num == -1)
230           pair->other_num = pair_test->num;
231         else
232           pair->other_num = pair_test->other_num;
233         if(dot_output == NULL)
234           XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", pair->num, pair_test->num);
235         else
236           XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", pair->num, pair_test->num, pair->other_num);
237         xbt_dynar_remove_at(visited_pairs, (min + res) - 1, NULL);
238         xbt_dynar_insert_at(visited_pairs, (min+res) - 1, &pair);
239         pair_test->visited_removed = 1;
240         if(pair_test->stack_removed && pair_test->visited_removed){
241           if((pair_test->automaton_state->type == 1) || (pair_test->automaton_state->type == 2)){
242             if(pair_test->acceptance_removed){
243               MC_pair_delete(pair_test);
244             }
245           }else{
246             MC_pair_delete(pair_test);
247           }
248         }
249         if(!raw_mem_set)
250           MC_UNSET_RAW_MEM;
251         return pair->other_num;
252         }*/
253       cursor = min;
254       while(cursor <= max){
255         pair_test = (mc_visited_pair_t)xbt_dynar_get_as(visited_pairs, cursor, mc_visited_pair_t);
256         //if(pair_test->acceptance_pair == 0){ /* Acceptance pair have been already checked before */
257           if(xbt_automaton_state_compare(pair_test->automaton_state, new_pair->automaton_state) == 0){
258             if(xbt_automaton_propositional_symbols_compare_value(pair_test->atomic_propositions, new_pair->atomic_propositions) == 0){
259               if(snapshot_compare(pair_test, new_pair) == 0){
260                 if(pair_test->other_num == -1)
261                   new_pair->other_num = pair_test->num;
262                 else
263                   new_pair->other_num = pair_test->other_num;
264                 if(dot_output == NULL)
265                   XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", new_pair->num, pair_test->num);
266                 else
267                   XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", new_pair->num, pair_test->num, pair->other_num);
268                 xbt_dynar_remove_at(visited_pairs, cursor, NULL);
269                 xbt_dynar_insert_at(visited_pairs, cursor, &new_pair);
270                 pair_test->visited_removed = 1;
271                 if(pair_test->acceptance_pair){
272                   if(pair_test->acceptance_removed == 1)
273                     MC_visited_pair_delete(pair_test);
274                 }else{
275                   MC_visited_pair_delete(pair_test);
276                 }
277                 if(!raw_mem_set)
278                   MC_UNSET_RAW_MEM;
279                 return new_pair->other_num;
280               }
281             }
282             //}
283         }
284         cursor++;
285       }
286       xbt_dynar_insert_at(visited_pairs, min, &new_pair);
287     }else{
288       pair_test = (mc_visited_pair_t)xbt_dynar_get_as(visited_pairs, index, mc_visited_pair_t);
289       if(pair_test->nb_processes < new_pair->nb_processes){
290         xbt_dynar_insert_at(visited_pairs, index+1, &new_pair);
291       }else{
292         if(pair_test->heap_bytes_used < new_pair->heap_bytes_used)
293           xbt_dynar_insert_at(visited_pairs, index + 1, &new_pair);
294         else
295           xbt_dynar_insert_at(visited_pairs, index, &new_pair);
296       }
297     }
298
299     if(xbt_dynar_length(visited_pairs) > _sg_mc_visited){
300       int min2 = mc_stats->expanded_pairs;
301       unsigned int cursor2 = 0;
302       unsigned int index2 = 0;
303       xbt_dynar_foreach(visited_pairs, cursor2, pair_test){
304         if(pair_test->num < min2){
305           index2 = cursor2;
306           min2 = pair_test->num;
307         }
308       }
309       xbt_dynar_remove_at(visited_pairs, index2, &pair_test);
310       pair_test->visited_removed = 1;
311       if(pair_test->acceptance_pair){
312         if(pair_test->acceptance_removed)
313           MC_visited_pair_delete(pair_test);
314       }else{
315         MC_visited_pair_delete(pair_test);
316       }
317     }
318
319   }
320
321   if(!raw_mem_set)
322     MC_UNSET_RAW_MEM;
323   
324   return -1;
325 }
326
327 static int MC_automaton_evaluate_label(xbt_automaton_exp_label_t l, xbt_dynar_t atomic_propositions_values){
328   
329   switch(l->type){
330   case 0 : {
331     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values);
332     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values);
333     return (left_res || right_res);
334   }
335   case 1 : {
336     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values);
337     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values);
338     return (left_res && right_res);
339   }
340   case 2 : {
341     int res = MC_automaton_evaluate_label(l->u.exp_not, atomic_propositions_values);
342     return (!res);
343   }
344   case 3 : { 
345     unsigned int cursor = 0;
346     xbt_automaton_propositional_symbol_t p = NULL;
347     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, p){
348       if(strcmp(p->pred, l->u.predicat) == 0)
349         return (int)xbt_dynar_get_as(atomic_propositions_values, cursor, int);
350     }
351     return -1;
352   }
353   case 4 : {
354     return 2;
355   }
356   default : 
357     return -1;
358   }
359 }
360
361
362 /********* DDFS Algorithm *********/
363
364
365 void MC_ddfs_init(void){
366
367   initial_state_liveness->raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
368
369   XBT_DEBUG("**************************************************");
370   XBT_DEBUG("Double-DFS init");
371   XBT_DEBUG("**************************************************");
372
373   mc_pair_t initial_pair = NULL;
374   smx_process_t process; 
375
376   MC_wait_for_requests();
377
378   MC_ignore_heap(simix_global->process_to_run->data, 0);
379   MC_ignore_heap(simix_global->process_that_ran->data, 0);
380
381   MC_SET_RAW_MEM;
382
383   acceptance_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL); 
384   visited_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL); 
385   successors = xbt_dynar_new(sizeof(mc_pair_t), NULL);
386
387   initial_state_liveness->snapshot = MC_take_snapshot(0);
388   initial_state_liveness->prev_pair = 0;
389
390   MC_UNSET_RAW_MEM; 
391   
392   unsigned int cursor = 0;
393   xbt_automaton_state_t automaton_state;
394
395   xbt_dynar_foreach(_mc_property_automaton->states, cursor, automaton_state){
396     if(automaton_state->type == -1){ /* Initial automaton state */
397       
398       MC_SET_RAW_MEM;
399
400       initial_pair = MC_pair_new();
401       initial_pair->automaton_state = automaton_state;
402       initial_pair->graph_state = MC_state_new();
403       initial_pair->atomic_propositions = get_atomic_propositions_values();
404
405       /* Get enabled process and insert it in the interleave set of the graph_state */
406       xbt_swag_foreach(process, simix_global->process_list){
407         if(MC_process_is_enabled(process)){
408           MC_state_interleave_process(initial_pair->graph_state, process);
409         }
410       }
411
412       initial_pair->requests = MC_state_interleave_size(initial_pair->graph_state);
413       initial_pair->search_cycle = 0;
414
415       xbt_fifo_unshift(mc_stack_liveness, initial_pair);
416
417       MC_UNSET_RAW_MEM;
418       
419       MC_ddfs();
420       
421       if(cursor != 0){
422         MC_restore_snapshot(initial_state_liveness->snapshot);
423         MC_UNSET_RAW_MEM;
424       } 
425     }
426   }
427
428   if(initial_state_liveness->raw_mem_set)
429     MC_SET_RAW_MEM;
430   else
431     MC_UNSET_RAW_MEM;
432   
433
434 }
435
436
437 void MC_ddfs(){
438
439   smx_process_t process;
440   mc_pair_t current_pair = NULL;
441
442   if(xbt_fifo_size(mc_stack_liveness) == 0)
443     return;
444
445   /* Get current pair */
446   current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
447
448   /* Update current state in buchi automaton */
449   _mc_property_automaton->current_state = current_pair->automaton_state;
450
451   XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d, interleave size %d, pair_num %d)", xbt_fifo_size(mc_stack_liveness), current_pair->search_cycle, MC_state_interleave_size(current_pair->graph_state), current_pair->num);
452  
453   mc_stats->visited_pairs++;
454
455   int value;
456   smx_simcall_t req = NULL;
457   char *req_str;
458
459   xbt_automaton_transition_t transition_succ;
460   unsigned int cursor = 0;
461   int res;
462   int visited_num;
463
464   mc_pair_t next_pair = NULL;
465   xbt_dynar_t prop_values = NULL;
466   mc_visited_pair_t reached_pair = NULL;
467   int counter_example_depth = 0;
468   
469   if(xbt_fifo_size(mc_stack_liveness) < _sg_mc_max_depth){
470
471     if(current_pair->requests > 0){
472
473       if(current_pair->search_cycle){
474
475         if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){ 
476           if((reached_pair = is_reached_acceptance_pair(current_pair->num, current_pair->automaton_state, current_pair->atomic_propositions)) == NULL){
477
478             counter_example_depth = xbt_fifo_size(mc_stack_liveness);
479             XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
480             XBT_INFO("|             ACCEPTANCE CYCLE            |");
481             XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
482             XBT_INFO("Counter-example that violates formula :");
483             MC_show_stack_liveness(mc_stack_liveness);
484             MC_dump_stack_liveness(mc_stack_liveness);
485             MC_print_statistics(mc_stats);
486             XBT_INFO("Counter-example depth : %d", counter_example_depth);
487             xbt_abort();
488
489           }
490         }
491       }
492
493       if((visited_num = is_visited_pair(reached_pair, current_pair->num, current_pair->automaton_state, current_pair->atomic_propositions)) != -1){
494
495         MC_SET_RAW_MEM;
496         if(dot_output != NULL)
497           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_state_liveness->prev_pair, visited_num, initial_state_liveness->prev_req);
498         MC_UNSET_RAW_MEM;
499               
500       }else{  
501
502         while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
503
504           MC_SET_RAW_MEM;
505           if(dot_output != NULL){
506             if(initial_state_liveness->prev_pair != 0 && initial_state_liveness->prev_pair != current_pair->num){
507               fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_state_liveness->prev_pair, current_pair->num, initial_state_liveness->prev_req);
508               xbt_free(initial_state_liveness->prev_req);
509             }
510             initial_state_liveness->prev_pair = current_pair->num;
511           }
512           MC_UNSET_RAW_MEM;
513
514           /* Debug information */
515           if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
516             req_str = MC_request_to_string(req, value);
517             XBT_DEBUG("Execute: %s", req_str);
518             xbt_free(req_str);
519           }
520
521           MC_SET_RAW_MEM;
522           if(dot_output != NULL){
523             initial_state_liveness->prev_req = MC_request_get_dot_output(req, value);
524             if(current_pair->search_cycle)
525               fprintf(dot_output, "%d [shape=doublecircle];\n", current_pair->num);
526           }
527           MC_UNSET_RAW_MEM; 
528           
529           MC_state_set_executed_request(current_pair->graph_state, req, value);  
530           mc_stats->executed_transitions++;
531
532           /* Answer the request */
533           SIMIX_simcall_pre(req, value);
534           
535           /* Wait for requests (schedules processes) */
536           MC_wait_for_requests();
537
538           MC_SET_RAW_MEM;
539           prop_values = get_atomic_propositions_values();
540           MC_UNSET_RAW_MEM;
541
542           int new_pair = 0;
543          
544           /* Evaluate enabled transition according to atomic propositions values */
545           cursor= 0;
546           xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
547
548             res = MC_automaton_evaluate_label(transition_succ->label, prop_values);
549
550             if(res == 1){ // enabled transition in automaton
551
552               if(new_pair)
553                 MC_replay_liveness(mc_stack_liveness, 1); 
554
555               MC_SET_RAW_MEM;
556
557               next_pair = MC_pair_new();
558               next_pair->graph_state = MC_state_new();
559               next_pair->automaton_state = transition_succ->dst;
560               next_pair->atomic_propositions = get_atomic_propositions_values();
561
562               /* Get enabled process and insert it in the interleave set of the next graph_state */
563               xbt_swag_foreach(process, simix_global->process_list){
564                 if(MC_process_is_enabled(process)){
565                   MC_state_interleave_process(next_pair->graph_state, process);
566                 }
567               }
568
569               next_pair->requests = MC_state_interleave_size(next_pair->graph_state);
570               
571               if(next_pair->automaton_state->type == 1 || next_pair->automaton_state->type == 2 || current_pair->search_cycle)
572                 next_pair->search_cycle = 1;
573             
574               xbt_fifo_unshift(mc_stack_liveness, next_pair);
575
576               if(mc_stats->expanded_pairs%1000000 == 0)
577                 XBT_INFO("Expanded pairs : %lu", mc_stats->expanded_pairs);
578
579               MC_UNSET_RAW_MEM;
580
581               new_pair = 1;
582
583               MC_ddfs();
584
585             }
586
587           }
588
589           /* Then, evaluate true transitions (always true, whatever atomic propositions values) */
590           cursor = 0;   
591           xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
592       
593             res = MC_automaton_evaluate_label(transition_succ->label, prop_values);
594   
595             if(res == 2){ // true transition in automaton
596
597               if(new_pair)
598                 MC_replay_liveness(mc_stack_liveness, 1); 
599             
600               MC_SET_RAW_MEM;
601             
602               next_pair = MC_pair_new();
603               next_pair->graph_state = MC_state_new();
604               next_pair->automaton_state = transition_succ->dst;
605               next_pair->atomic_propositions = get_atomic_propositions_values();
606
607               /* Get enabled process and insert it in the interleave set of the next graph_state */
608               xbt_swag_foreach(process, simix_global->process_list){
609                 if(MC_process_is_enabled(process)){
610                   MC_state_interleave_process(next_pair->graph_state, process);
611                 }
612               }
613
614               next_pair->requests = MC_state_interleave_size(next_pair->graph_state);
615             
616               if(next_pair->automaton_state->type == 1 || next_pair->automaton_state->type == 2 || current_pair->search_cycle)
617                 next_pair->search_cycle = 1;
618
619               xbt_fifo_unshift(mc_stack_liveness, next_pair);
620
621               if(mc_stats->expanded_pairs%1000000 == 0)
622                 XBT_INFO("Expanded pairs : %lu", mc_stats->expanded_pairs);
623             
624               MC_UNSET_RAW_MEM;
625
626               new_pair = 1;
627
628               MC_ddfs();
629
630             }
631
632           }
633
634           if(MC_state_interleave_size(current_pair->graph_state) > 0){
635             XBT_DEBUG("Backtracking to depth %d", xbt_fifo_size(mc_stack_liveness));
636             MC_replay_liveness(mc_stack_liveness, 0);
637           }
638         
639         }
640
641       }
642  
643     }
644     
645   }else{
646     
647     XBT_WARN("/!\\ Max depth reached ! /!\\ ");
648     if(MC_state_interleave_size(current_pair->graph_state) > 0){
649       XBT_WARN("/!\\ But, there are still processes to interleave. Model-checker will not be able to ensure the soundness of the verification from now. /!\\ "); 
650       if(_sg_mc_max_depth == 1000)
651         XBT_WARN("Notice : the default value of max depth is 1000 but you can change it with cfg=model-check/max_depth:value.");
652     }
653     
654   }
655
656   if(xbt_fifo_size(mc_stack_liveness) == _sg_mc_max_depth ){
657     XBT_DEBUG("Pair %d (depth = %d) shifted in stack, maximum depth reached", current_pair->num, xbt_fifo_size(mc_stack_liveness) );
658   }else{
659     XBT_DEBUG("Pair %d (depth = %d) shifted in stack", current_pair->num, xbt_fifo_size(mc_stack_liveness) );
660   }
661
662   
663   MC_SET_RAW_MEM;
664   xbt_dynar_free(&prop_values);
665   current_pair = xbt_fifo_shift(mc_stack_liveness);
666   if(xbt_fifo_size(mc_stack_liveness) != _sg_mc_max_depth -1 && current_pair->requests > 0 && current_pair->search_cycle){
667     remove_acceptance_pair(current_pair->num);
668   }
669   MC_pair_delete(current_pair);
670
671   MC_UNSET_RAW_MEM;
672
673 }