Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rework state's implementation to better support waitany and testany type of transitions
[simgrid.git] / src / mc / private.h
index 06af6e7..a1720fd 100644 (file)
@@ -14,7 +14,6 @@
 #include "mc/mc.h"
 #include "mc/datatypes.h"
 #include "xbt/fifo.h"
-#include "xbt/setset.h"
 #include "xbt/config.h"
 #include "xbt/function_types.h"
 #include "xbt/mmalloc.h"
@@ -42,12 +41,13 @@ void MC_free_snapshot(mc_snapshot_t);
 /* Bound of the MC depth-first search algorithm */
 #define MAX_DEPTH 1000
 
-void MC_show_stack(xbt_fifo_t stack);
-void MC_dump_stack(xbt_fifo_t stack);
+int MC_deadlock_check(void);
 void MC_replay(xbt_fifo_t stack);
 void MC_wait_for_requests(void);
 void MC_get_enabled_processes();
 void MC_show_deadlock(smx_req_t req);
+void MC_show_stack(xbt_fifo_t stack);
+void MC_dump_stack(xbt_fifo_t stack);
 
 /********************************* Requests ***********************************/
 int MC_request_depend(smx_req_t req1, smx_req_t req2);
@@ -59,20 +59,40 @@ void MC_dpor(void);
 void MC_dpor_exit(void);
 
 /******************************** States **************************************/
+/* Possible exploration status of a process in a state */
+typedef enum {
+  MC_NOT_INTERLEAVE = 0,    /* Do not interleave (do not execute) */
+  MC_INTERLEAVE,            /* Interleave the process (one or more request) */
+  MC_DONE                   /* Already interleaved */
+} e_mc_process_state_t;
+
+/* On every state, each process has an entry of the following type */
+typedef struct mc_procstate{
+  e_mc_process_state_t state;       /* Exploration control information */
+  unsigned int num_to_interleave;   /* Number of request to interleave */
+  /* If a process has a request with multiple possible responses like a */
+  /* "WaitAny", then the following vector with the indexes to interleave */
+  /* is additionally used. */
+  unsigned int *requests_indexes;   /* Indexes of the requests to interleave */
+} s_mc_procstate_t, *mc_procstate_t;
+
+/* An exploration state is composed of: */
 typedef struct mc_state {
-  xbt_setset_set_t interleave;  /* processes to interleave by the mc */
-  xbt_setset_set_t done;        /* already executed processes */
-  s_smx_req_t executed;
+  unsigned long max_pid;            /* Maximum pid at state's creation time */
+  mc_procstate_t proc_status;       /* State's exploration status by process */
+  s_smx_req_t executed;             /* The executed request of the state */
 } s_mc_state_t, *mc_state_t;
 
 extern xbt_fifo_t mc_stack;
-extern xbt_setset_t mc_setset;
 
 mc_state_t MC_state_new(void);
 void MC_state_delete(mc_state_t state);
+void MC_state_add_to_interleave(mc_state_t state, smx_process_t process);
+unsigned int MC_state_interleave_size(mc_state_t state);
+int MC_state_process_is_done(mc_state_t state, smx_process_t process);
 void MC_state_set_executed_request(mc_state_t state, smx_req_t req);
 smx_req_t MC_state_get_executed_request(mc_state_t state);
-smx_req_t MC_state_get_request(mc_state_t state);
+smx_req_t MC_state_get_request(mc_state_t state, char *value);
 
 /****************************** Statistics ************************************/
 typedef struct mc_stats {