4 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
5 "Logging specific to algorithms for liveness properties verification");
7 xbt_dynar_t initial_pairs = NULL;
9 xbt_dynar_t reached_pairs;
10 extern mc_snapshot_t initial_snapshot;
12 mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st){
14 p = xbt_new0(s_mc_pair_t, 1);
16 p->automaton_state = st;
20 mc_stats_pair->expanded_pairs++;
25 int reached(mc_pair_t pair){
27 if(xbt_dynar_is_empty(reached_pairs)){
32 xbt_sha((const char *)&pair, hash);
33 if(xbt_dynar_member(reached_pairs, hash)){
44 void set_pair_reached(mc_pair_t pair){
46 if(reached(pair) == 0){
49 xbt_sha((const char *)&pair, hash);
50 xbt_dynar_push(reached_pairs, &hash);
56 void MC_pair_delete(mc_pair_t pair){
57 xbt_free(pair->graph_state->proc_status);
58 xbt_free(pair->graph_state);
59 //xbt_free(pair->automaton_state); -> FIXME : à implémenter
64 int MC_automaton_evaluate_label(xbt_automaton_t a, xbt_exp_label_t l){
68 int left_res = MC_automaton_evaluate_label(a, l->u.or_and.left_exp);
69 int right_res = MC_automaton_evaluate_label(a, l->u.or_and.right_exp);
70 return (left_res || right_res);
74 int left_res = MC_automaton_evaluate_label(a, l->u.or_and.left_exp);
75 int right_res = MC_automaton_evaluate_label(a, l->u.or_and.right_exp);
76 return (left_res && right_res);
80 int res = MC_automaton_evaluate_label(a, l->u.exp_not);
85 unsigned int cursor = 0;
86 xbt_propositional_symbol_t p = NULL;
87 xbt_dynar_foreach(a->propositional_symbols, cursor, p){
88 if(strcmp(p->pred, l->u.predicat) == 0){
89 int (*f)() = p->function;
107 /******************************* DFS with visited state *******************************/
109 xbt_dynar_t visited_pairs;
111 void set_pair_visited(mc_pair_t pair, int sc){
114 mc_visited_pair_t p = NULL;
115 p = xbt_new0(s_mc_visited_pair_t, 1);
117 p->search_cycle = sc;
119 xbt_sha((const char *)&p, hash);
120 xbt_dynar_push(visited_pairs, &hash);
125 int visited(mc_pair_t pair, int sc){
129 mc_visited_pair_t p = NULL;
130 p = xbt_new0(s_mc_visited_pair_t, 1);
132 p->search_cycle = sc;
134 xbt_sha((const char *)&p, hash);
135 if(xbt_dynar_member(visited_pairs, hash)){
145 void MC_vddfs_stateful_init(xbt_automaton_t a){
147 XBT_DEBUG("**************************************************");
148 XBT_DEBUG("Double-DFS stateful with visited state init");
149 XBT_DEBUG("**************************************************");
151 mc_pair_t mc_initial_pair;
152 mc_state_t initial_graph_state;
153 smx_process_t process;
154 mc_snapshot_t init_snapshot;
156 MC_wait_for_requests();
160 init_snapshot = xbt_new0(s_mc_snapshot_t, 1);
162 initial_graph_state = MC_state_pair_new();
163 xbt_swag_foreach(process, simix_global->process_list){
164 if(MC_process_is_enabled(process)){
165 MC_state_interleave_process(initial_graph_state, process);
169 visited_pairs = xbt_dynar_new(sizeof(char *), NULL);
170 reached_pairs = xbt_dynar_new(sizeof(char *), NULL);
172 MC_take_snapshot(init_snapshot);
176 unsigned int cursor = 0;
177 xbt_state_t state = NULL;
179 xbt_dynar_foreach(a->states, cursor, state){
180 if(state->type == -1){
183 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
184 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
188 MC_vddfs_stateful(a, 0, 0);
190 MC_restore_snapshot(init_snapshot);
192 MC_vddfs_stateful(a, 0, 0);
195 if(state->type == 2){
198 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
199 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
203 MC_vddfs_stateful(a, 1, 0);
205 MC_restore_snapshot(init_snapshot);
207 MC_vddfs_stateful(a, 1, 0);
215 void MC_vddfs_stateful(xbt_automaton_t a, int search_cycle, int restore){
217 smx_process_t process = NULL;
220 if(xbt_fifo_size(mc_stack_liveness_stateful) == 0)
224 MC_restore_snapshot(((mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful)))->system_state);
229 /* Get current state */
230 mc_pair_t current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful));
233 xbt_swag_foreach(process, simix_global->process_list){
234 if(MC_process_is_enabled(process)){
235 MC_state_interleave_process(current_pair->graph_state, process);
240 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateful), search_cycle);
241 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));
244 mc_stats_pair->visited_pairs++;
247 mc_state_t next_graph_state = NULL;
248 smx_req_t req = NULL;
252 xbt_transition_t transition_succ;
256 xbt_dynar_t successors = NULL;
258 mc_pair_t next_pair = NULL;
259 mc_snapshot_t next_snapshot = NULL;
260 mc_snapshot_t current_snapshot = NULL;
261 mc_pair_t pair_succ = NULL;;
264 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
267 current_snapshot = xbt_new0(s_mc_snapshot_t, 1);
268 MC_take_snapshot(current_snapshot);
272 /* Debug information */
273 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
274 req_str = MC_request_to_string(req, value);
275 XBT_DEBUG("Execute: %s", req_str);
279 MC_state_set_executed_request(current_pair->graph_state, req, value);
281 /* Answer the request */
282 SIMIX_request_pre(req, value);
284 /* Wait for requests (schedules processes) */
285 MC_wait_for_requests();
288 /* Create the new expanded graph_state */
291 next_graph_state = MC_state_pair_new();
293 /* Get enabled process and insert it in the interleave set of the next graph_state */
294 xbt_swag_foreach(process, simix_global->process_list){
295 if(MC_process_is_enabled(process)){
296 MC_state_interleave_process(next_graph_state, process);
300 next_snapshot = xbt_new0(s_mc_snapshot_t, 1);
301 MC_take_snapshot(next_snapshot);
303 successors = xbt_dynar_new(sizeof(mc_pair_t), NULL);
308 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
310 res = MC_automaton_evaluate_label(a, transition_succ->label);
314 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
315 xbt_dynar_push(successors, &next_pair);
321 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
323 res = MC_automaton_evaluate_label(a, transition_succ->label);
327 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
328 xbt_dynar_push(successors, &next_pair);
335 if(xbt_dynar_length(successors) == 0){
338 next_pair = new_pair(next_snapshot, next_graph_state, current_pair->automaton_state);
339 xbt_dynar_push(successors, &next_pair);
345 //XBT_DEBUG("Successors length %lu", xbt_dynar_length(successors));
349 xbt_dynar_foreach(successors, cursor, pair_succ){
351 XBT_DEBUG("Search reached pair %p : graph=%p, automaton=%p", pair_succ, pair_succ->graph_state, pair_succ->automaton_state);
353 XBT_DEBUG("Const char pair %s", (const char *)&pair_succ);
354 xbt_sha((const char *)&pair_succ, hash);
355 XBT_DEBUG("Hash pair_succ %s", hash);
357 if((search_cycle == 1) && (reached(pair_succ) == 1)){
358 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
359 XBT_INFO("| ACCEPTANCE CYCLE |");
360 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
361 XBT_INFO("Counter-example that violates formula :");
362 MC_show_stack_liveness_stateful(mc_stack_liveness_stateful);
363 MC_dump_stack_liveness_stateful(mc_stack_liveness_stateful);
364 MC_print_statistics_pairs(mc_stats_pair);
368 XBT_DEBUG("Search visited pair %p : graph %p, automaton %p", pair_succ, pair_succ->graph_state, pair_succ->automaton_state);
370 if(visited(pair_succ, search_cycle) == 0){
372 //mc_stats_pair->executed_transitions++;
375 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
376 set_pair_visited(pair_succ, search_cycle);
379 MC_vddfs_stateful(a, search_cycle, 0);
381 //XBT_DEBUG("Pair (graph=%p, automaton=%p) expanded", pair_succ->graph_state, pair_succ->automaton_state);
383 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
385 set_pair_reached(pair_succ);
386 XBT_DEBUG("Acceptance pair : graph=%p, automaton=%p(%s)", pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
389 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
392 MC_vddfs_stateful(a, 1, 1);
395 xbt_dynar_pop(reached_pairs, NULL);
402 XBT_DEBUG("Pair already visited !");
408 if(MC_state_interleave_size(current_pair->graph_state) > 0){
409 MC_restore_snapshot(current_snapshot);
417 xbt_fifo_shift(mc_stack_liveness_stateful);
418 XBT_DEBUG("Pair (graph=%p, automaton =%p) shifted in stack", current_pair->graph_state, current_pair->automaton_state);
427 /********************* Double-DFS stateful without visited state *******************/
430 void MC_ddfs_stateful_init(xbt_automaton_t a){
432 XBT_DEBUG("**************************************************");
433 XBT_DEBUG("Double-DFS stateful without visited state init");
434 XBT_DEBUG("**************************************************");
436 mc_pair_t mc_initial_pair;
437 mc_state_t initial_graph_state;
438 smx_process_t process;
439 mc_snapshot_t init_snapshot;
441 MC_wait_for_requests();
445 init_snapshot = xbt_new0(s_mc_snapshot_t, 1);
447 initial_graph_state = MC_state_pair_new();
448 xbt_swag_foreach(process, simix_global->process_list){
449 if(MC_process_is_enabled(process)){
450 MC_state_interleave_process(initial_graph_state, process);
454 reached_pairs = xbt_dynar_new(sizeof(char *), NULL);
456 MC_take_snapshot(init_snapshot);
460 unsigned int cursor = 0;
461 xbt_state_t state = NULL;
463 xbt_dynar_foreach(a->states, cursor, state){
464 if(state->type == -1){
467 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
468 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
472 MC_ddfs_stateful(a, 0, 0);
474 MC_restore_snapshot(init_snapshot);
476 MC_ddfs_stateful(a, 0, 0);
479 if(state->type == 2){
482 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
483 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
487 MC_ddfs_stateful(a, 1, 0);
489 MC_restore_snapshot(init_snapshot);
491 MC_ddfs_stateful(a, 1, 0);
499 void MC_ddfs_stateful(xbt_automaton_t a, int search_cycle, int restore){
501 smx_process_t process = NULL;
504 if(xbt_fifo_size(mc_stack_liveness_stateful) == 0)
508 MC_restore_snapshot(((mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful)))->system_state);
512 /* Get current state */
513 mc_pair_t current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful));
516 xbt_swag_foreach(process, simix_global->process_list){
517 if(MC_process_is_enabled(process)){
518 MC_state_interleave_process(current_pair->graph_state, process);
523 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateful), search_cycle);
524 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));
526 mc_stats_pair->visited_pairs++;
529 mc_state_t next_graph_state = NULL;
530 smx_req_t req = NULL;
534 xbt_transition_t transition_succ;
538 xbt_dynar_t successors;
541 mc_snapshot_t next_snapshot;
542 mc_snapshot_t current_snapshot;
547 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
550 current_snapshot = xbt_new0(s_mc_snapshot_t, 1);
551 MC_take_snapshot(current_snapshot);
555 /* Debug information */
556 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
557 req_str = MC_request_to_string(req, value);
558 XBT_DEBUG("%u Execute: %s", search_cycle, req_str);
562 MC_state_set_executed_request(current_pair->graph_state, req, value);
564 /* Answer the request */
565 SIMIX_request_pre(req, value);
567 /* Wait for requests (schedules processes) */
568 MC_wait_for_requests();
571 /* Create the new expanded graph_state */
574 next_graph_state = MC_state_pair_new();
576 /* Get enabled process and insert it in the interleave set of the next graph_state */
577 xbt_swag_foreach(process, simix_global->process_list){
578 if(MC_process_is_enabled(process)){
579 MC_state_interleave_process(next_graph_state, process);
583 next_snapshot = xbt_new0(s_mc_snapshot_t, 1);
584 MC_take_snapshot(next_snapshot);
586 successors = xbt_dynar_new(sizeof(mc_pair_t), NULL);
590 //xbt_dynar_reset(successors);
593 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
595 res = MC_automaton_evaluate_label(a, transition_succ->label);
599 if(res == 1){ // enabled transition in automaton
600 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
601 xbt_dynar_push(successors, &next_pair);
608 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
610 res = MC_automaton_evaluate_label(a, transition_succ->label);
614 if(res == 2){ // transition always enabled in automaton
615 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
616 xbt_dynar_push(successors, &next_pair);
623 if(xbt_dynar_length(successors) == 0){
626 next_pair = new_pair(next_snapshot, next_graph_state, current_pair->automaton_state);
627 xbt_dynar_push(successors, &next_pair);
632 //XBT_DEBUG("Successors in automaton %lu", xbt_dynar_length(successors));
635 xbt_dynar_foreach(successors, cursor, pair_succ){
637 //XBT_DEBUG("Search visited pair : graph=%p, automaton=%p", pair_succ->graph_state, pair_succ->automaton_state);
639 if((search_cycle == 1) && (reached(pair_succ) == 1)){
640 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
641 XBT_INFO("| ACCEPTANCE CYCLE |");
642 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
643 XBT_INFO("Counter-example that violates formula :");
644 MC_show_stack_liveness_stateful(mc_stack_liveness_stateful);
645 MC_dump_stack_liveness_stateful(mc_stack_liveness_stateful);
646 MC_print_statistics_pairs(mc_stats_pair);
650 //mc_stats_pair->executed_transitions++;
653 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
656 MC_ddfs_stateful(a, search_cycle, 0);
659 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
661 set_pair_reached(pair_succ);
662 XBT_DEBUG("Acceptance pair : graph=%p, automaton=%p(%s)", pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
665 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
668 MC_ddfs_stateful(a, 1, 1);
671 xbt_dynar_pop(reached_pairs, NULL);
677 if(MC_state_interleave_size(current_pair->graph_state) > 0){
678 MC_restore_snapshot(current_snapshot);
686 xbt_fifo_shift(mc_stack_liveness_stateful);
687 XBT_DEBUG("Pair (graph=%p, automaton =%p) shifted in stack", current_pair->graph_state, current_pair->automaton_state);
694 /********************* Double-DFS stateless *******************/
696 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
697 xbt_free(pair->graph_state->proc_status);
698 xbt_free(pair->graph_state);
699 //xbt_free(pair->automaton_state); -> FIXME : à implémenter
703 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st){
704 mc_pair_stateless_t p = NULL;
705 p = xbt_new0(s_mc_pair_stateless_t, 1);
706 p->automaton_state = st;
708 mc_stats_pair->expanded_pairs++;
713 int reached_stateless(mc_pair_stateless_t pair){
715 if(xbt_dynar_is_empty(reached_pairs)){
721 xbt_sha((const char*)&pair, hash);
722 XBT_DEBUG("Hash : %s", hash);
723 if(xbt_dynar_member(reached_pairs, hash)){
724 XBT_DEBUG("Pair already reached");
734 void set_pair_stateless_reached(mc_pair_stateless_t pair){
738 xbt_sha((const char*)&pair, hash);
739 XBT_DEBUG("Hash to pushed %s", hash);
740 if(strcmp(hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709") == 0){
741 XBT_DEBUG("Error in hash, pair empty !");
745 xbt_dynar_push(reached_pairs, &hash);
751 void MC_ddfs_stateless_init(xbt_automaton_t a){
753 XBT_DEBUG("**************************************************");
754 XBT_DEBUG("Double-DFS stateless init");
755 XBT_DEBUG("**************************************************");
757 mc_pair_stateless_t mc_initial_pair = NULL;
758 mc_state_t initial_graph_state = NULL;
759 smx_process_t process;
761 MC_wait_for_requests();
764 initial_graph_state = MC_state_pair_new();
765 xbt_swag_foreach(process, simix_global->process_list){
766 if(MC_process_is_enabled(process)){
767 MC_state_interleave_process(initial_graph_state, process);
771 reached_pairs = xbt_dynar_new(sizeof(char *), NULL);
774 unsigned int cursor = 0;
777 xbt_dynar_foreach(a->states, cursor, state){
778 if(state->type == -1){
781 mc_initial_pair = new_pair_stateless(initial_graph_state, state);
782 xbt_fifo_unshift(mc_stack_liveness_stateless, mc_initial_pair);
784 initial_snapshot = xbt_new0(s_mc_snapshot_t, 1);
785 MC_take_snapshot(initial_snapshot);
790 MC_ddfs_stateless(a, 0, 0);
792 MC_restore_snapshot(initial_snapshot);
794 MC_ddfs_stateless(a, 0, 0);
797 if(state->type == 2){
800 mc_initial_pair = new_pair_stateless(initial_graph_state, state);
801 xbt_fifo_unshift(mc_stack_liveness_stateless, mc_initial_pair);
803 initial_snapshot = xbt_new0(s_mc_snapshot_t, 1);
804 MC_take_snapshot(initial_snapshot);
809 MC_ddfs_stateless(a, 1, 0);
811 MC_restore_snapshot(initial_snapshot);
813 MC_ddfs_stateless(a, 1, 0);
822 void MC_ddfs_stateless(xbt_automaton_t a, int search_cycle, int replay){
824 smx_process_t process;
825 mc_pair_stateless_t current_pair = NULL;
827 if(xbt_fifo_size(mc_stack_liveness_stateless) == 0)
831 MC_replay_liveness(mc_stack_liveness_stateless);
832 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateless));
833 xbt_swag_foreach(process, simix_global->process_list){
834 if(MC_process_is_enabled(process)){
835 MC_state_interleave_process(current_pair->graph_state, process);
840 /* Get current state */
841 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateless));
843 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateless), search_cycle);
844 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));
848 mc_stats_pair->visited_pairs++;
850 /*if(MC_state_interleave_size(current_pair->graph_state) == 0 && (current_pair->automaton_state->type == 1)){
851 xbt_fifo_shift(mc_stack_liveness_stateless);
852 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
853 XBT_INFO("| ACCEPTANCE CYCLE |");
854 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
855 XBT_INFO("Counter-example that violates formula :");
856 MC_show_stack_liveness_stateless(mc_stack_liveness_stateless);
857 MC_dump_stack_liveness_stateless(mc_stack_liveness_stateless);
858 MC_print_statistics_pairs(mc_stats_pair);
863 mc_state_t next_graph_state = NULL;
864 smx_req_t req = NULL;
867 xbt_transition_t transition_succ;
868 unsigned int cursor = 0;
871 mc_pair_stateless_t next_pair = NULL;
872 mc_pair_stateless_t pair_succ;
874 xbt_dynar_t successors = NULL;
877 successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
880 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
882 //XBT_DEBUG("Interleave size %u", MC_state_interleave_size(current_pair->graph_state));
884 /* Debug information */
885 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
886 req_str = MC_request_to_string(req, value);
887 XBT_DEBUG("Execute: %s", req_str);
893 MC_state_set_executed_request(current_pair->graph_state, req, value);
895 /* Answer the request */
896 SIMIX_request_pre(req, value);
898 /* Wait for requests (schedules processes) */
899 MC_wait_for_requests();
903 /* Create the new expanded graph_state */
905 next_graph_state = MC_state_pair_new();
907 /* Get enabled process and insert it in the interleave set of the next graph_state */
908 xbt_swag_foreach(process, simix_global->process_list){
909 if(MC_process_is_enabled(process)){
910 MC_state_interleave_process(next_graph_state, process);
914 xbt_dynar_reset(successors);
921 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
923 res = MC_automaton_evaluate_label(a, transition_succ->label);
925 if(res == 1){ // enabled transition in automaton
927 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst);
928 xbt_dynar_push(successors, &next_pair);
936 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
938 res = MC_automaton_evaluate_label(a, transition_succ->label);
940 if(res == 2){ // enabled transition in automaton
942 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst);
943 xbt_dynar_push(successors, &next_pair);
950 if(xbt_dynar_length(successors) == 0){
952 next_pair = new_pair_stateless(next_graph_state, current_pair->automaton_state);
953 xbt_dynar_push(successors, &next_pair);
959 //XBT_DEBUG("Successors length %lu", xbt_dynar_length(successors));
961 xbt_dynar_foreach(successors, cursor, pair_succ){
963 if((search_cycle == 1) && (reached_stateless(pair_succ) == 1)){
964 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
965 XBT_INFO("| ACCEPTANCE CYCLE |");
966 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
967 XBT_INFO("Counter-example that violates formula :");
968 MC_show_stack_liveness_stateless(mc_stack_liveness_stateless);
969 MC_dump_stack_liveness_stateless(mc_stack_liveness_stateless);
970 MC_print_statistics_pairs(mc_stats_pair);
975 xbt_fifo_unshift(mc_stack_liveness_stateless, pair_succ);
978 MC_ddfs_stateless(a, search_cycle, 0);
982 //XBT_DEBUG("Stack size %u", xbt_fifo_size(mc_stack_liveness_stateless));
984 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
986 XBT_DEBUG("Acceptance pair : graph=%p, automaton=%p(%s)", pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
987 set_pair_stateless_reached(pair_succ);
990 xbt_fifo_unshift(mc_stack_liveness_stateless, pair_succ);
993 MC_ddfs_stateless(a, 1, 1);
996 xbt_dynar_pop(reached_pairs, NULL);
1001 if(MC_state_interleave_size(current_pair->graph_state) > 0){
1002 XBT_DEBUG("Backtracking to depth %u", xbt_fifo_size(mc_stack_liveness_stateless));
1003 MC_replay_liveness(mc_stack_liveness_stateless);
1009 xbt_fifo_shift(mc_stack_liveness_stateless);
1010 XBT_DEBUG("Pair (graph=%p, automaton =%p, search_cycle = %u) shifted in stack", current_pair->graph_state, current_pair->automaton_state, search_cycle);