Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use std::list instead of xbt_fifo for the stack in LivenessChecker
[simgrid.git] / src / mc / LivenessChecker.cpp
1 /* Copyright (c) 2011-2015. 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 <cstring>
8
9 #include <algorithm>
10 #include <memory>
11 #include <list>
12
13 #include <unistd.h>
14 #include <sys/wait.h>
15
16 #include <xbt/automaton.h>
17 #include <xbt/dynar.h>
18 #include <xbt/dynar.hpp>
19 #include <xbt/log.h>
20 #include <xbt/sysdep.h>
21
22 #include "src/mc/mc_request.h"
23 #include "src/mc/LivenessChecker.hpp"
24 #include "src/mc/mc_private.h"
25 #include "src/mc/mc_record.h"
26 #include "src/mc/mc_smx.h"
27 #include "src/mc/Client.hpp"
28 #include "src/mc/mc_private.h"
29 #include "src/mc/mc_replay.h"
30 #include "src/mc/mc_safety.h"
31 #include "src/mc/mc_exit.h"
32
33 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
34                                 "Logging specific to algorithms for liveness properties verification");
35
36 /********* Global variables *********/
37
38 /********* Static functions *********/
39
40 namespace simgrid {
41 namespace mc {
42
43 xbt_dynar_t LivenessChecker::acceptance_pairs;
44 std::list<Pair*> LivenessChecker::liveness_stack;
45
46 VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, simgrid::mc::State* graph_state)
47 {
48   simgrid::mc::Process* process = &(mc_model_checker->process());
49
50   this->graph_state = graph_state;
51   if(this->graph_state->system_state == nullptr)
52     this->graph_state->system_state = simgrid::mc::take_snapshot(pair_num);
53   this->heap_bytes_used = mmalloc_get_bytes_used_remote(
54     process->get_heap()->heaplimit,
55     process->get_malloc_info());
56
57   this->nb_processes =
58     mc_model_checker->process().simix_processes().size();
59
60   this->automaton_state = automaton_state;
61   this->num = pair_num;
62   this->other_num = -1;
63   this->acceptance_removed = 0;
64   this->visited_removed = 0;
65   this->acceptance_pair = 0;
66   this->atomic_propositions = simgrid::xbt::unique_ptr<s_xbt_dynar_t>(
67     xbt_dynar_new(sizeof(int), nullptr));
68
69   unsigned int cursor = 0;
70   int value;
71   xbt_dynar_foreach(atomic_propositions, cursor, value)
72       xbt_dynar_push_as(this->atomic_propositions.get(), int, value);
73 }
74
75 static int is_exploration_stack_pair(simgrid::mc::VisitedPair* pair)
76 {
77   for (auto i = LivenessChecker::liveness_stack.rbegin(); i != LivenessChecker::liveness_stack.rend(); ++i) {
78     if ((*i)->num == pair->num) {
79       (*i)->visited_pair_removed = 1;
80       return true;
81     }
82   }
83   return false;
84 }
85
86 VisitedPair::~VisitedPair()
87 {
88   if( !is_exploration_stack_pair(this))
89     MC_state_delete(this->graph_state, 1);
90 }
91
92 static int MC_automaton_evaluate_label(xbt_automaton_exp_label_t l,
93                                        xbt_dynar_t atomic_propositions_values)
94 {
95
96   switch (l->type) {
97   case 0:{
98       int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values);
99       int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values);
100       return (left_res || right_res);
101     }
102   case 1:{
103       int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values);
104       int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values);
105       return (left_res && right_res);
106     }
107   case 2:{
108       int res = MC_automaton_evaluate_label(l->u.exp_not, atomic_propositions_values);
109       return (!res);
110     }
111   case 3:{
112       unsigned int cursor = 0;
113       xbt_automaton_propositional_symbol_t p = nullptr;
114       xbt_dynar_foreach(simgrid::mc::property_automaton->propositional_symbols, cursor, p) {
115         if (std::strcmp(xbt_automaton_propositional_symbol_get_name(p), l->u.predicat) == 0)
116           return (int) xbt_dynar_get_as(atomic_propositions_values, cursor, int);
117       }
118       return -1;
119     }
120   case 4:
121     return 2;
122   default:
123     return -1;
124   }
125 }
126
127 static xbt_dynar_t visited_pairs;
128
129 Pair::Pair() : num(++mc_stats->expanded_pairs),
130   visited_pair_removed(_sg_mc_visited > 0 ? 0 : 1)
131 {}
132
133 Pair::~Pair() {
134   if (this->visited_pair_removed)
135     MC_state_delete(this->graph_state, 1);
136 }
137
138 simgrid::xbt::unique_ptr<s_xbt_dynar_t> LivenessChecker::getPropositionValues()
139 {
140   unsigned int cursor = 0;
141   xbt_automaton_propositional_symbol_t ps = nullptr;
142   simgrid::xbt::unique_ptr<s_xbt_dynar_t> values = simgrid::xbt::unique_ptr<s_xbt_dynar_t>(xbt_dynar_new(sizeof(int), nullptr));
143   xbt_dynar_foreach(simgrid::mc::property_automaton->propositional_symbols, cursor, ps) {
144     int res = xbt_automaton_propositional_symbol_evaluate(ps);
145     xbt_dynar_push_as(values.get(), int, res);
146   }
147   return values;
148 }
149
150 int LivenessChecker::compare(simgrid::mc::VisitedPair* state1, simgrid::mc::VisitedPair* state2)
151 {
152   simgrid::mc::Snapshot* s1 = state1->graph_state->system_state.get();
153   simgrid::mc::Snapshot* s2 = state2->graph_state->system_state.get();
154   int num1 = state1->num;
155   int num2 = state2->num;
156   return simgrid::mc::snapshot_compare(num1, s1, num2, s2);
157 }
158
159 simgrid::mc::VisitedPair* LivenessChecker::insertAcceptancePair(simgrid::mc::Pair* pair)
160 {
161   auto acceptance_pairs = simgrid::xbt::range<simgrid::mc::VisitedPair*>(LivenessChecker::acceptance_pairs);
162   auto new_pair =
163     std::unique_ptr<simgrid::mc::VisitedPair>(new VisitedPair(
164       pair->num, pair->automaton_state, pair->atomic_propositions.get(),
165       pair->graph_state));
166   new_pair->acceptance_pair = 1;
167
168   auto res = std::equal_range(acceptance_pairs.begin(), acceptance_pairs.end(),
169     new_pair, simgrid::mc::DerefAndCompareByNbProcessesAndUsedHeap());
170
171   if (pair->search_cycle == 1)
172     for (auto i = res.first; i != res.second; ++i) {
173       simgrid::mc::VisitedPair* pair_test = *i;
174       if (xbt_automaton_state_compare(pair_test->automaton_state, new_pair->automaton_state) == 0) {
175         if (xbt_automaton_propositional_symbols_compare_value(
176             pair_test->atomic_propositions.get(),
177             new_pair->atomic_propositions.get()) == 0) {
178           if (this->compare(pair_test, new_pair.get()) == 0) {
179             XBT_INFO("Pair %d already reached (equal to pair %d) !", new_pair->num, pair_test->num);
180             liveness_stack.pop_back();
181             if (dot_output != nullptr)
182               fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, pair_test->num, initial_global_state->prev_req);
183             return nullptr;
184           }
185         }
186       }
187     }
188
189   auto new_raw_pair = new_pair.release();
190   xbt_dynar_insert_at(
191     LivenessChecker::acceptance_pairs, res.first - acceptance_pairs.begin(), &new_raw_pair);
192   return new_raw_pair;
193 }
194
195 void LivenessChecker::removeAcceptancePair(int pair_num)
196 {
197   unsigned int cursor = 0;
198   simgrid::mc::VisitedPair* pair_test = nullptr;
199   int pair_found = 0;
200
201   xbt_dynar_foreach(acceptance_pairs, cursor, pair_test)
202     if (pair_test->num == pair_num) {
203        pair_found = 1;
204       break;
205     }
206
207   if(pair_found == 1) {
208     xbt_dynar_remove_at(acceptance_pairs, cursor, &pair_test);
209
210     pair_test->acceptance_removed = 1;
211
212     if (_sg_mc_visited == 0 || pair_test->visited_removed == 1) 
213       delete pair_test;
214
215   }
216 }
217
218 void LivenessChecker::prepare(void)
219 {
220   simgrid::mc::Pair* initial_pair = nullptr;
221   mc_model_checker->wait_for_requests();
222   acceptance_pairs = xbt_dynar_new(sizeof(simgrid::mc::VisitedPair*), nullptr);
223   if(_sg_mc_visited > 0)
224     simgrid::mc::visited_pairs = xbt_dynar_new(sizeof(simgrid::mc::VisitedPair*), nullptr);
225
226   initial_global_state->snapshot = simgrid::mc::take_snapshot(0);
227   initial_global_state->prev_pair = 0;
228
229   unsigned int cursor = 0;
230   xbt_automaton_state_t automaton_state;
231
232   xbt_dynar_foreach(simgrid::mc::property_automaton->states, cursor, automaton_state) {
233     if (automaton_state->type == -1) {  /* Initial automaton state */
234
235       initial_pair = new Pair();
236       initial_pair->automaton_state = automaton_state;
237       initial_pair->graph_state = MC_state_new();
238       initial_pair->atomic_propositions = this->getPropositionValues();
239       initial_pair->depth = 1;
240
241       /* Get enabled processes and insert them in the interleave set of the graph_state */
242       for (auto& p : mc_model_checker->process().simix_processes())
243         if (simgrid::mc::process_is_enabled(&p.copy))
244           MC_state_interleave_process(initial_pair->graph_state, &p.copy);
245
246       initial_pair->requests = MC_state_interleave_size(initial_pair->graph_state);
247       initial_pair->search_cycle = 0;
248
249       liveness_stack.push_back(initial_pair);
250     }
251   }
252 }
253
254
255 void LivenessChecker::replay()
256 {
257   simgrid::mc::State* state = nullptr;
258   smx_simcall_t req = nullptr, saved_req = NULL;
259   int value, depth = 1;
260   char *req_str;
261
262   XBT_DEBUG("**** Begin Replay ****");
263
264   /* Intermediate backtracking */
265   if(_sg_mc_checkpoint > 0) {
266     simgrid::mc::Pair* pair = liveness_stack.back();
267     if(pair->graph_state->system_state){
268       simgrid::mc::restore_snapshot(pair->graph_state->system_state);
269       return;
270     }
271   }
272
273   /* Restore the initial state */
274   simgrid::mc::restore_snapshot(initial_global_state->snapshot);
275
276   /* Traverse the stack from the initial state and re-execute the transitions */
277   for (simgrid::mc::Pair* pair : liveness_stack) {
278     if (pair == liveness_stack.back())
279       break;
280
281       state = (simgrid::mc::State*) pair->graph_state;
282
283       if (pair->exploration_started) {
284
285         saved_req = MC_state_get_executed_request(state, &value);
286
287         if (saved_req != nullptr) {
288           /* because we got a copy of the executed request, we have to fetch the
289              real one, pointed by the request field of the issuer process */
290           const smx_process_t issuer = MC_smx_simcall_get_issuer(saved_req);
291           req = &issuer->simcall;
292
293           /* Debug information */
294           if (XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)) {
295             req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix);
296             XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth, req_str, state);
297             xbt_free(req_str);
298           }
299
300         }
301
302         simgrid::mc::handle_simcall(req, value);
303         mc_model_checker->wait_for_requests();
304       }
305
306       /* Update statistics */
307       mc_stats->visited_pairs++;
308       mc_stats->executed_transitions++;
309
310       depth++;
311
312   }
313
314   XBT_DEBUG("**** End Replay ****");
315 }
316
317 /**
318  * \brief Checks whether a given pair has already been visited by the algorithm.
319  */
320 int LivenessChecker::insertVisitedPair(simgrid::mc::VisitedPair* visited_pair, simgrid::mc::Pair* pair)
321 {
322   if (_sg_mc_visited == 0)
323     return -1;
324
325   simgrid::mc::VisitedPair* new_visited_pair = nullptr;
326   if (visited_pair == nullptr)
327     new_visited_pair = new simgrid::mc::VisitedPair(
328       pair->num, pair->automaton_state, pair->atomic_propositions.get(),
329       pair->graph_state);
330   else
331     new_visited_pair = visited_pair;
332
333   auto visited_pairs = simgrid::xbt::range<simgrid::mc::VisitedPair*>(simgrid::mc::visited_pairs);
334
335   auto range = std::equal_range(visited_pairs.begin(), visited_pairs.end(),
336     new_visited_pair, simgrid::mc::DerefAndCompareByNbProcessesAndUsedHeap());
337
338   for (auto i = range.first; i != range.second; ++i) {
339     simgrid::mc::VisitedPair* pair_test = *i;
340     std::size_t cursor = i - visited_pairs.begin();
341     if (xbt_automaton_state_compare(pair_test->automaton_state, new_visited_pair->automaton_state) == 0) {
342       if (xbt_automaton_propositional_symbols_compare_value(
343           pair_test->atomic_propositions.get(),
344           new_visited_pair->atomic_propositions.get()) == 0) {
345         if (this->compare(pair_test, new_visited_pair) == 0) {
346           if (pair_test->other_num == -1)
347             new_visited_pair->other_num = pair_test->num;
348           else
349             new_visited_pair->other_num = pair_test->other_num;
350           if (dot_output == nullptr)
351             XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", new_visited_pair->num, pair_test->num);
352           else
353             XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", new_visited_pair->num, pair_test->num, new_visited_pair->other_num);
354           xbt_dynar_remove_at(simgrid::mc::visited_pairs, cursor, &pair_test);
355           xbt_dynar_insert_at(simgrid::mc::visited_pairs, cursor, &new_visited_pair);
356           pair_test->visited_removed = 1;
357           if (!pair_test->acceptance_pair
358               || pair_test->acceptance_removed == 1)
359             delete pair_test;
360           return new_visited_pair->other_num;
361         }
362       }
363     }
364   }
365
366   xbt_dynar_insert_at(simgrid::mc::visited_pairs, range.first - visited_pairs.begin(), &new_visited_pair);
367
368   if ((ssize_t) visited_pairs.size() > _sg_mc_visited) {
369     int min2 = mc_stats->expanded_pairs;
370     unsigned int index2 = 0;
371     for (std::size_t i = 0; i != (std::size_t) visited_pairs.size(); ++i) {
372       simgrid::mc::VisitedPair* pair_test = visited_pairs[i];
373       if (pair_test->num < min2) {
374         index2 = i;
375         min2 = pair_test->num;
376       }
377     }
378     simgrid::mc::VisitedPair* pair_test = nullptr;
379     xbt_dynar_remove_at(simgrid::mc::visited_pairs, index2, &pair_test);
380     pair_test->visited_removed = 1;
381     if (!pair_test->acceptance_pair || pair_test->acceptance_removed)
382       delete pair_test;
383   }
384
385   return -1;
386 }
387
388 LivenessChecker::LivenessChecker(Session& session) : Checker(session)
389 {
390 }
391
392 LivenessChecker::~LivenessChecker()
393 {
394 }
395
396 RecordTrace LivenessChecker::getRecordTrace() // override
397 {
398   RecordTrace res;
399   for (simgrid::mc::Pair* pair : liveness_stack) {
400     int value;
401     smx_simcall_t req = MC_state_get_executed_request(pair->graph_state, &value);
402     if (req && req->call != SIMCALL_NONE) {
403       smx_process_t issuer = MC_smx_simcall_get_issuer(req);
404       const int pid = issuer->pid;
405
406       // Serialization the (pid, value) pair:
407       res.push_back(RecordTraceElement(pid, value));
408     }
409   }
410   return res;
411 }
412
413 void LivenessChecker::showAcceptanceCycle(std::size_t depth)
414 {
415   XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
416   XBT_INFO("|             ACCEPTANCE CYCLE            |");
417   XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
418   XBT_INFO("Counter-example that violates formula :");
419   simgrid::mc::dumpRecordPath();
420   for (auto& s : this->getTextualTrace())
421     XBT_INFO("%s", s.c_str());
422   MC_print_statistics(mc_stats);
423   XBT_INFO("Counter-example depth : %zd", depth);
424 }
425
426 std::vector<std::string> LivenessChecker::getTextualTrace() // override
427 {
428   std::vector<std::string> trace;
429   for (simgrid::mc::Pair* pair : liveness_stack) {
430     int value;
431     smx_simcall_t req = MC_state_get_executed_request(pair->graph_state, &value);
432     if (req && req->call != SIMCALL_NONE) {
433       char* req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::executed);
434       trace.push_back(std::string(req_str));
435       xbt_free(req_str);
436     }
437   }
438   return trace;
439 }
440
441 int LivenessChecker::main(void)
442 {
443   simgrid::mc::Pair* current_pair = nullptr;
444   int value, res, visited_num = -1;
445   smx_simcall_t req = nullptr;
446   xbt_automaton_transition_t transition_succ = nullptr;
447   int cursor = 0;
448   simgrid::mc::Pair* next_pair = nullptr;
449   simgrid::xbt::unique_ptr<s_xbt_dynar_t> prop_values;
450   simgrid::mc::VisitedPair* reached_pair = nullptr;
451
452   while (!liveness_stack.empty()){
453
454     /* Get current pair */
455     current_pair = liveness_stack.back();
456
457     /* Update current state in buchi automaton */
458     simgrid::mc::property_automaton->current_state = current_pair->automaton_state;
459
460     XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d, interleave size = %d, pair_num = %d, requests = %d)",
461        current_pair->depth, current_pair->search_cycle,
462        MC_state_interleave_size(current_pair->graph_state), current_pair->num,
463        current_pair->requests);
464
465     if (current_pair->requests > 0) {
466
467       if (current_pair->automaton_state->type == 1 && current_pair->exploration_started == 0) {
468         /* If new acceptance pair, return new pair */
469         if ((reached_pair = this->insertAcceptancePair(current_pair)) == nullptr) {
470           this->showAcceptanceCycle(current_pair->depth);
471           return SIMGRID_MC_EXIT_LIVENESS;
472         }
473       }
474
475       /* Pair already visited ? stop the exploration on the current path */
476       if ((current_pair->exploration_started == 0)
477         && (visited_num = this->insertVisitedPair(
478           reached_pair, current_pair)) != -1) {
479
480         if (dot_output != nullptr){
481           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, visited_num, initial_global_state->prev_req);
482           fflush(dot_output);
483         }
484
485         XBT_DEBUG("Pair already visited (equal to pair %d), exploration on the current path stopped.", visited_num);
486         current_pair->requests = 0;
487         goto backtracking;
488
489       }else{
490
491         req = MC_state_get_request(current_pair->graph_state, &value);
492
493          if (dot_output != nullptr) {
494            if (initial_global_state->prev_pair != 0 && initial_global_state->prev_pair != current_pair->num) {
495              fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, current_pair->num, initial_global_state->prev_req);
496              xbt_free(initial_global_state->prev_req);
497            }
498            initial_global_state->prev_pair = current_pair->num;
499            initial_global_state->prev_req = simgrid::mc::request_get_dot_output(req, value);
500            if (current_pair->search_cycle)
501              fprintf(dot_output, "%d [shape=doublecircle];\n", current_pair->num);
502            fflush(dot_output);
503          }
504
505          char* req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix);
506          XBT_DEBUG("Execute: %s", req_str);
507          xbt_free(req_str);
508
509          /* Set request as executed */
510          MC_state_set_executed_request(current_pair->graph_state, req, value);
511
512          /* Update mc_stats */
513          mc_stats->executed_transitions++;
514          if(current_pair->exploration_started == 0)
515            mc_stats->visited_pairs++;
516
517          /* Answer the request */
518          simgrid::mc::handle_simcall(req, value);
519
520          /* Wait for requests (schedules processes) */
521          mc_model_checker->wait_for_requests();
522
523          current_pair->requests--;
524          current_pair->exploration_started = 1;
525
526          /* Get values of atomic propositions (variables used in the property formula) */
527          prop_values = this->getPropositionValues();
528
529          /* Evaluate enabled/true transitions in automaton according to atomic propositions values and create new pairs */
530          cursor = xbt_dynar_length(current_pair->automaton_state->out) - 1;
531          while (cursor >= 0) {
532            transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(current_pair->automaton_state->out, cursor, xbt_automaton_transition_t);
533            res = MC_automaton_evaluate_label(transition_succ->label, prop_values.get());
534            if (res == 1 || res == 2) { /* 1 = True transition (always enabled), 2 = enabled transition according to atomic prop values */
535               next_pair = new Pair();
536               next_pair->graph_state = MC_state_new();
537               next_pair->automaton_state = transition_succ->dst;
538               next_pair->atomic_propositions = this->getPropositionValues();
539               next_pair->depth = current_pair->depth + 1;
540               /* Get enabled processes and insert them in the interleave set of the next graph_state */
541               for (auto& p : mc_model_checker->process().simix_processes())
542                 if (simgrid::mc::process_is_enabled(&p.copy))
543                   MC_state_interleave_process(next_pair->graph_state, &p.copy);
544
545               next_pair->requests = MC_state_interleave_size(next_pair->graph_state);
546
547               /* FIXME : get search_cycle value for each acceptant state */
548               if (next_pair->automaton_state->type == 1 || current_pair->search_cycle)
549                 next_pair->search_cycle = 1;
550
551               /* Add new pair to the exploration stack */
552               liveness_stack.push_back(next_pair);
553
554            }
555            cursor--;
556          }
557
558       } /* End of visited_pair test */
559
560     } else {
561
562     backtracking:
563       if(visited_num == -1)
564         XBT_DEBUG("No more request to execute. Looking for backtracking point.");
565
566       prop_values.reset();
567
568       /* Traverse the stack backwards until a pair with a non empty interleave
569          set is found, deleting all the pairs that have it empty in the way. */
570       while (!liveness_stack.empty()) {
571         current_pair = liveness_stack.back();
572         liveness_stack.pop_back();
573         if (current_pair->requests > 0) {
574           /* We found a backtracking point */
575           XBT_DEBUG("Backtracking to depth %d", current_pair->depth);
576           liveness_stack.push_back(current_pair);
577           this->replay();
578           XBT_DEBUG("Backtracking done");
579           break;
580         }else{
581           /* Delete pair */
582           XBT_DEBUG("Delete pair %d at depth %d", current_pair->num, current_pair->depth);
583           if (current_pair->automaton_state->type == 1)
584             this->removeAcceptancePair(current_pair->num);
585           delete current_pair;
586         }
587       }
588
589     } /* End of if (current_pair->requests > 0) else ... */
590
591   }
592
593   XBT_INFO("No property violation found.");
594   MC_print_statistics(mc_stats);
595   return SIMGRID_MC_EXIT_SUCCESS;
596 }
597
598 int LivenessChecker::run()
599 {
600   XBT_INFO("Check the liveness property %s", _sg_mc_property_file);
601   MC_automaton_load(_sg_mc_property_file);
602   mc_model_checker->wait_for_requests();
603
604   XBT_DEBUG("Starting the liveness algorithm");
605   _sg_mc_liveness = 1;
606
607   /* Create exploration stack */
608   liveness_stack.clear();
609
610   /* Create the initial state */
611   simgrid::mc::initial_global_state = std::unique_ptr<s_mc_global_t>(new s_mc_global_t());
612
613   this->prepare();
614   int res = this->main();
615   simgrid::mc::initial_global_state = nullptr;
616   return res;
617 }
618
619 }
620 }