Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Add more smx_process_t MCer/MCed translations
[simgrid.git] / src / mc / mc_comm_determinism.c
index d892dde..4043b1f 100644 (file)
@@ -10,6 +10,7 @@
 #include "mc_safety.h"
 #include "mc_private.h"
 #include "mc_record.h"
+#include "mc_smx.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc,
                                 "Logging specific to MC communication determinism detection");
@@ -170,11 +171,13 @@ static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t co
 {
   mc_process_t process = &mc_model_checker->process;
   void *addr_pointed;
-  comm_pattern->src_proc = comm->comm.src_proc->pid;
-  comm_pattern->dst_proc = comm->comm.dst_proc->pid;
-  // FIXME, get remote host name
-  comm_pattern->src_host = simcall_host_get_name(comm->comm.src_proc->smx_host);
-  comm_pattern->dst_host = simcall_host_get_name(comm->comm.dst_proc->smx_host);
+  smx_process_t src_proc = MC_smx_resolve_process(comm->comm.src_proc);
+  smx_process_t dst_proc = MC_smx_resolve_process(comm->comm.dst_proc);
+  comm_pattern->src_proc = src_proc->pid;
+  comm_pattern->dst_proc = dst_proc->pid;
+  // TODO, resolve host name
+  comm_pattern->src_host = MC_smx_process_get_host_name(src_proc);
+  comm_pattern->dst_host = MC_smx_process_get_host_name(dst_proc);
   if (comm_pattern->data_size == -1 && comm->comm.src_buff != NULL) {
     comm_pattern->data_size = *(comm->comm.dst_buff_size);
     comm_pattern->data = xbt_malloc0(comm_pattern->data_size);
@@ -226,7 +229,7 @@ void get_comm_pattern(const xbt_dynar_t list, const smx_simcall_t request, const
   pattern->data_size = -1;
   pattern->data = NULL;
 
-  const smx_process_t issuer = MC_process_get_issuer(&mc_model_checker->process, request);
+  const smx_process_t issuer = MC_smx_simcall_get_issuer(request);
   mc_list_comm_pattern_t initial_pattern =
     (mc_list_comm_pattern_t) xbt_dynar_get_as(initial_communications_pattern, issuer->pid, mc_list_comm_pattern_t);
   xbt_dynar_t incomplete_pattern =
@@ -240,10 +243,10 @@ void get_comm_pattern(const xbt_dynar_t list, const smx_simcall_t request, const
     /* Create comm pattern */
     pattern->type = SIMIX_COMM_SEND;
     pattern->comm = simcall_comm_isend__get__result(request);
+    // FIXME, remote access to rdv->name
     pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name);
-    pattern->src_proc = pattern->comm->comm.src_proc->pid;
-    // FIXME, get remote host name
-    pattern->src_host = simcall_host_get_name(issuer->smx_host);
+    pattern->src_proc = MC_smx_resolve_process(pattern->comm->comm.src_proc)->pid;
+    pattern->src_host = MC_smx_process_get_host_name(issuer);
     if(pattern->comm->comm.src_buff != NULL){
       pattern->data_size = pattern->comm->comm.src_buff_size;
       pattern->data = xbt_malloc0(pattern->data_size);
@@ -257,10 +260,11 @@ void get_comm_pattern(const xbt_dynar_t list, const smx_simcall_t request, const
   } else if (call_type == MC_CALL_TYPE_RECV) {                      
     pattern->type = SIMIX_COMM_RECEIVE;
     pattern->comm = simcall_comm_irecv__get__result(request);
+    // TODO, remote access
     pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name);
-    pattern->dst_proc = pattern->comm->comm.dst_proc->pid;
+    pattern->dst_proc = MC_smx_resolve_process(pattern->comm->comm.dst_proc)->pid;
     // FIXME, remote process access
-    pattern->dst_host = simcall_host_get_name(issuer->smx_host);
+    pattern->dst_host = MC_smx_process_get_host_name(issuer);
   } else {
     xbt_die("Unexpected call_type %i", (int) call_type);
   }
@@ -271,11 +275,14 @@ void get_comm_pattern(const xbt_dynar_t list, const smx_simcall_t request, const
 }
 
 void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, int backtracking) {
-
   mc_comm_pattern_t current_comm_pattern;
   unsigned int cursor = 0;
-  unsigned int src = comm->comm.src_proc->pid;
-  unsigned int dst = comm->comm.dst_proc->pid;
+
+  smx_process_t src_proc = MC_smx_resolve_process(comm->comm.src_proc);
+  smx_process_t dst_proc = MC_smx_resolve_process(comm->comm.dst_proc);
+  unsigned int src = src_proc->pid;
+  unsigned int dst = dst_proc->pid;
+
   mc_comm_pattern_t src_comm_pattern;
   mc_comm_pattern_t dst_comm_pattern;
   int src_completed = 0, dst_completed = 0;