Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move comm determinism code in mc_comm_determinism.c
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 9 Apr 2015 11:50:46 +0000 (13:50 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 9 Apr 2015 11:50:46 +0000 (13:50 +0200)
src/mc/mc_comm_determinism.c
src/mc/mc_comm_pattern.h
src/mc/mc_global.c

index 1941949..7854cae 100644 (file)
@@ -11,6 +11,7 @@
 #include "mc_private.h"
 #include "mc_record.h"
 #include "mc_smx.h"
+#include "mc_client.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc,
                                 "Logging specific to MC communication determinism detection");
@@ -272,7 +273,9 @@ void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int
 
 /************************ Main algorithm ************************/
 
-void MC_pre_modelcheck_comm_determinism(void)
+static void MC_modelcheck_comm_determinism_main(void);
+
+static void MC_pre_modelcheck_comm_determinism(void)
 {
   MC_SET_MC_HEAP;
 
@@ -319,7 +322,7 @@ void MC_pre_modelcheck_comm_determinism(void)
 
 }
 
-void MC_modelcheck_comm_determinism(void)
+static void MC_modelcheck_comm_determinism_main(void)
 {
 
   char *req_str = NULL;
@@ -468,3 +471,36 @@ void MC_modelcheck_comm_determinism(void)
 
   return;
 }
+
+void MC_modelcheck_comm_determinism(void)
+{
+  MC_init();
+  if (mc_mode == MC_MODE_CLIENT) {
+    // This will move somehwere else:
+    MC_client_handle_messages();
+  }
+
+  xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
+
+  /* Create exploration stack */
+  mc_stack = xbt_fifo_new();
+
+  MC_SET_STD_HEAP;
+
+  MC_pre_modelcheck_comm_determinism();
+
+  MC_SET_MC_HEAP;
+  initial_global_state = xbt_new0(s_mc_global_t, 1);
+  initial_global_state->snapshot = MC_take_snapshot(0);
+  initial_global_state->initial_communications_pattern_done = 0;
+  initial_global_state->recv_deterministic = 1;
+  initial_global_state->send_deterministic = 1;
+  initial_global_state->recv_diff = NULL;
+  initial_global_state->send_diff = NULL;
+
+  MC_SET_STD_HEAP;
+
+  MC_modelcheck_comm_determinism_main();
+
+  mmalloc_set_current_heap(heap);
+}
index a27ab20..9c73038 100644 (file)
@@ -83,7 +83,6 @@ void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, i
 void MC_comm_pattern_free_voidp(void *p);
 void MC_list_comm_pattern_free_voidp(void *p);
 void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int issuer, int backtracking);
-void MC_pre_modelcheck_comm_determinism(void);
 void MC_modelcheck_comm_determinism(void);
 
 void MC_restore_communications_pattern(mc_state_t state);
index 690ca5a..0901dae 100644 (file)
@@ -211,39 +211,6 @@ void MC_init_pid(pid_t pid, int socket)
 /*******************************  Core of MC *******************************/
 /**************************************************************************/
 
-static void MC_modelcheck_comm_determinism_init(void)
-{
-  MC_init();
-  if (mc_mode == MC_MODE_CLIENT) {
-    // This will move somehwere else:
-    MC_client_handle_messages();
-  }
-
-  xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
-
-  /* Create exploration stack */
-  mc_stack = xbt_fifo_new();
-
-  MC_SET_STD_HEAP;
-
-  MC_pre_modelcheck_comm_determinism();
-
-  MC_SET_MC_HEAP;
-  initial_global_state = xbt_new0(s_mc_global_t, 1);
-  initial_global_state->snapshot = MC_take_snapshot(0);
-  initial_global_state->initial_communications_pattern_done = 0;
-  initial_global_state->recv_deterministic = 1;
-  initial_global_state->send_deterministic = 1;
-  initial_global_state->recv_diff = NULL;
-  initial_global_state->send_diff = NULL;
-
-  MC_SET_STD_HEAP;
-
-  MC_modelcheck_comm_determinism();
-
-  mmalloc_set_current_heap(heap);
-}
-
 void MC_do_the_modelcheck_for_real()
 {
   MC_init_mode();
@@ -255,7 +222,7 @@ void MC_do_the_modelcheck_for_real()
     else {
       XBT_INFO("Check communication determinism");
       mc_reduce_kind = e_mc_reduce_none;
-      MC_modelcheck_comm_determinism_init();
+      MC_modelcheck_comm_determinism();
     }
   }