Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 6 Apr 2016 12:40:13 +0000 (14:40 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 6 Apr 2016 12:40:13 +0000 (14:40 +0200)
24 files changed:
src/mc/Client.cpp
src/mc/CommunicationDeterminismChecker.cpp
src/mc/LivenessChecker.hpp
src/mc/SafetyChecker.cpp
src/mc/VisitedState.cpp
src/mc/malloc.hpp
src/mc/mc_client_api.cpp
src/mc/mc_comm_pattern.cpp
src/mc/mc_comm_pattern.h
src/mc/mc_compare.cpp
src/mc/mc_diff.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_global.cpp
src/mc/mc_private.h
src/mc/mc_record.cpp
src/mc/mc_record.h
src/mc/mc_replay.h
src/mc/mc_request.cpp
src/mc/mc_safety.h
src/mc/mc_smx.cpp
src/mc/mc_snapshot.h
src/mc/mc_state.cpp
src/mc/mc_state.h
tools/jenkins/build.sh

index fbbbe92..9fc8688 100644 (file)
@@ -14,6 +14,7 @@
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
 #include <xbt/mmalloc.h>
+#include <xbt/swag.h>
 
 #include "src/internal_config.h"
 
@@ -67,7 +68,7 @@ Client* Client::initialize()
   client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
 
   // Wait for the model-checker:
-  if (ptrace(PTRACE_TRACEME, 0, nullptr, NULL) == -1 || raise(SIGSTOP) != 0)
+  if (ptrace(PTRACE_TRACEME, 0, nullptr, nullptr) == -1 || raise(SIGSTOP) != 0)
     xbt_die("Could not wait for the model-checker");
 
   client_->handleMessages();
index da1b86e..f983945 100644 (file)
@@ -35,7 +35,7 @@ xbt_dynar_t incomplete_communications_pattern;
 
 /********** Static functions ***********/
 
-static e_mc_comm_pattern_difference_t compare_comm_pattern(mc_comm_pattern_t comm1, mc_comm_pattern_t comm2) {
+static e_mc_comm_pattern_difference_t compare_comm_pattern(simgrid::mc::PatternCommunication* comm1, simgrid::mc::PatternCommunication* comm2) {
   if(comm1->type != comm2->type)
     return TYPE_DIFF;
   if (comm1->rdv != comm2->rdv)
@@ -53,7 +53,7 @@ static e_mc_comm_pattern_difference_t compare_comm_pattern(mc_comm_pattern_t com
   return NONE_DIFF;
 }
 
-static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int process, mc_comm_pattern_t comm, unsigned int cursor) {
+static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int process, simgrid::mc::PatternCommunication* comm, unsigned int cursor) {
   char *type, *res;
 
   if(comm->type == SIMIX_COMM_SEND)
@@ -91,7 +91,7 @@ static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int p
   return res;
 }
 
-static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t comm_addr)
+static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern, smx_synchro_t comm_addr)
 {
   s_smx_synchro_t comm;
   mc_model_checker->process().read(&comm, remote(comm_addr));
@@ -113,16 +113,14 @@ static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t co
   }
 }
 
-static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int backtracking) {
+static void deterministic_comm_pattern(int process, simgrid::mc::PatternCommunication* comm, int backtracking) {
 
-  mc_list_comm_pattern_t list =
-    xbt_dynar_get_as(initial_communications_pattern, process, mc_list_comm_pattern_t);
+  simgrid::mc::PatternCommunicationList* list =
+    xbt_dynar_get_as(initial_communications_pattern, process, simgrid::mc::PatternCommunicationList*);
 
   if(!backtracking){
-    mc_comm_pattern_t initial_comm =
-      xbt_dynar_get_as(list->list, list->index_comm, mc_comm_pattern_t);
     e_mc_comm_pattern_difference_t diff =
-      compare_comm_pattern(initial_comm, comm);
+      compare_comm_pattern(list->list[list->index_comm].get(), comm);
 
     if (diff != NONE_DIFF) {
       if (comm->type == SIMIX_COMM_SEND){
@@ -162,9 +160,6 @@ static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int
       }
     }
   }
-
-  MC_comm_pattern_free(comm);
-
 }
 
 /********** Non Static functions ***********/
@@ -172,12 +167,14 @@ static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int
 void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking)
 {
   const smx_process_t issuer = MC_smx_simcall_get_issuer(request);
-  mc_list_comm_pattern_t initial_pattern = xbt_dynar_get_as(
-    initial_communications_pattern, issuer->pid, mc_list_comm_pattern_t);
+  simgrid::mc::PatternCommunicationList* initial_pattern = xbt_dynar_get_as(
+    initial_communications_pattern, issuer->pid, simgrid::mc::PatternCommunicationList*);
   xbt_dynar_t incomplete_pattern = xbt_dynar_get_as(
     incomplete_communications_pattern, issuer->pid, xbt_dynar_t);
 
-  mc_comm_pattern_t pattern = new s_mc_comm_pattern_t();
+  std::unique_ptr<simgrid::mc::PatternCommunication> pattern =
+    std::unique_ptr<simgrid::mc::PatternCommunication>(
+      new simgrid::mc::PatternCommunication());
   pattern->index =
     initial_pattern->index_comm + xbt_dynar_length(incomplete_pattern);
 
@@ -209,16 +206,15 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
     if(mpi_request.detached){
       if (!simgrid::mc::initial_global_state->initial_communications_pattern_done) {
         /* Store comm pattern */
-        xbt_dynar_push(
-          xbt_dynar_get_as(
-            initial_communications_pattern, pattern->src_proc, mc_list_comm_pattern_t
-          )->list,
-          &pattern);
+        simgrid::mc::PatternCommunicationList* list = xbt_dynar_get_as(
+          initial_communications_pattern, pattern->src_proc,
+          simgrid::mc::PatternCommunicationList*);
+        list->list.push_back(std::move(pattern));
       } else {
         /* Evaluate comm determinism */
-        deterministic_comm_pattern(pattern->src_proc, pattern, backtracking);
+        deterministic_comm_pattern(pattern->src_proc, pattern.get(), backtracking);
         xbt_dynar_get_as(
-          initial_communications_pattern, pattern->src_proc, mc_list_comm_pattern_t
+          initial_communications_pattern, pattern->src_proc, simgrid::mc::PatternCommunicationList*
         )->index_comm++;
       }
       return;
@@ -244,17 +240,18 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
   } else
     xbt_die("Unexpected call_type %i", (int) call_type);
 
-  xbt_dynar_push(
-    xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t),
-    &pattern);
-
-  XBT_DEBUG("Insert incomplete comm pattern %p for process %lu", pattern, issuer->pid);
+  XBT_DEBUG("Insert incomplete comm pattern %p for process %lu",
+    pattern.get(), issuer->pid);
+  xbt_dynar_t dynar =
+    xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t);
+  simgrid::mc::PatternCommunication* pattern2 = pattern.release();
+  xbt_dynar_push(dynar, &pattern2);
 }
 
 void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigned int issuer, int backtracking) {
-  mc_comm_pattern_t current_comm_pattern;
+  simgrid::mc::PatternCommunication* current_comm_pattern;
   unsigned int cursor = 0;
-  mc_comm_pattern_t comm_pattern;
+  std::unique_ptr<simgrid::mc::PatternCommunication> comm_pattern;
   int completed = 0;
 
   /* Complete comm pattern */
@@ -262,9 +259,11 @@ void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigne
     if (current_comm_pattern->comm_addr == comm_addr) {
       update_comm_pattern(current_comm_pattern, comm_addr);
       completed = 1;
+      simgrid::mc::PatternCommunication* temp;
       xbt_dynar_remove_at(
         xbt_dynar_get_as(incomplete_communications_pattern, issuer, xbt_dynar_t),
-        cursor, &comm_pattern);
+        cursor, &temp);
+      comm_pattern = std::unique_ptr<simgrid::mc::PatternCommunication>(temp);
       XBT_DEBUG("Remove incomplete comm pattern for process %u at cursor %u", issuer, cursor);
       break;
     }
@@ -272,15 +271,15 @@ void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigne
   if(!completed)
     xbt_die("Corresponding communication not found!");
 
-  mc_list_comm_pattern_t pattern = xbt_dynar_get_as(
-    initial_communications_pattern, issuer, mc_list_comm_pattern_t);
+  simgrid::mc::PatternCommunicationList* pattern = xbt_dynar_get_as(
+    initial_communications_pattern, issuer, simgrid::mc::PatternCommunicationList*);
 
   if (!simgrid::mc::initial_global_state->initial_communications_pattern_done)
     /* Store comm pattern */
-    xbt_dynar_push(pattern->list, &comm_pattern);
+    pattern->list.push_back(std::move(comm_pattern));
   else {
     /* Evaluate comm determinism */
-    deterministic_comm_pattern(issuer, comm_pattern, backtracking);
+    deterministic_comm_pattern(issuer, comm_pattern.get(), backtracking);
     pattern->index_comm++;
   }
 }
@@ -337,18 +336,16 @@ void CommunicationDeterminismChecker::prepare()
   const int maxpid = MC_smx_get_maxpid();
 
   // Create initial_communications_pattern elements:
-  initial_communications_pattern = xbt_dynar_new(sizeof(mc_list_comm_pattern_t), MC_list_comm_pattern_free_voidp);
+  initial_communications_pattern = simgrid::xbt::newDeleteDynar<simgrid::mc::PatternCommunicationList*>();
   for (i=0; i < maxpid; i++){
-    mc_list_comm_pattern_t process_list_pattern = xbt_new0(s_mc_list_comm_pattern_t, 1);
-    process_list_pattern->list = xbt_dynar_new(sizeof(mc_comm_pattern_t), MC_comm_pattern_free_voidp);
-    process_list_pattern->index_comm = 0;
+    simgrid::mc::PatternCommunicationList* process_list_pattern = new simgrid::mc::PatternCommunicationList();
     xbt_dynar_insert_at(initial_communications_pattern, i, &process_list_pattern);
   }
 
   // Create incomplete_communications_pattern elements:
   incomplete_communications_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
   for (i=0; i < maxpid; i++){
-    xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), nullptr);
+    xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(simgrid::mc::PatternCommunication*), nullptr);
     xbt_dynar_insert_at(incomplete_communications_pattern, i, &process_pattern);
   }
 
@@ -520,10 +517,6 @@ int CommunicationDeterminismChecker::run()
   XBT_INFO("Check communication determinism");
   mc_model_checker->wait_for_requests();
 
-  if (mc_mode == MC_MODE_CLIENT)
-    // This will move somehwere else:
-    simgrid::mc::Client::get()->handleMessages();
-
   this->prepare();
 
   initial_global_state = std::unique_ptr<s_mc_global_t>(new s_mc_global_t());
index 18c32a0..7ce79ce 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <simgrid_config.h>
 #include <xbt/base.h>
-#include <xbt/dynar.h>
 #include <xbt/automaton.h>
 #include <xbt/memory.hpp>
 #include "src/mc/mc_state.h"
index bcb9065..f79c6b9 100644 (file)
@@ -7,7 +7,9 @@
 #include <cassert>
 #include <cstdio>
 
-#include <list>
+#include <memory>
+#include <string>
+#include <vector>
 
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
index 4399f82..88c9175 100644 (file)
@@ -12,9 +12,6 @@
 
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
-#include <xbt/dynar.h>
-#include <xbt/dynar.hpp>
-#include <xbt/fifo.h>
 
 #include "src/mc/mc_comm_pattern.h"
 #include "src/mc/mc_safety.h"
index 0447cc4..b07d3ed 100644 (file)
@@ -13,6 +13,7 @@
 #include <vector>
 
 #include <xbt/mmalloc.h>
+#include <xbt/dynar.h>
 
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/Process.hpp"
index d3fdc26..8a0418f 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
+#include <xbt/automaton.h>
 #include <simgrid/modelchecker.h>
 
 #include "src/mc/mc_record.h"
index 515a380..8d064c9 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <xbt/sysdep.h>
 #include <xbt/dynar.h>
+#include <xbt/dynar.hpp>
 
 #include "src/mc/mc_comm_pattern.h"
 #include "src/mc/mc_smx.h"
@@ -18,50 +19,19 @@ using simgrid::mc::remote;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_pattern, mc,
                                 "Logging specific to MC communication patterns");
 
-extern "C" {
-
-mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm)
-{
-  mc_comm_pattern_t res = new s_mc_comm_pattern_t();
-  res->index = comm->index;
-  res->type = comm->type;
-  res->comm_addr = comm->comm_addr;
-  res->rdv = comm->rdv;
-  res->data = comm->data;
-  res->dst_proc = comm->dst_proc;
-  res->dst_host = comm->dst_host;
-  return res;
-}
-
-xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t patterns)
-{
-  xbt_dynar_t res = xbt_dynar_new(sizeof(mc_comm_pattern_t), MC_comm_pattern_free_voidp);
-
-  mc_comm_pattern_t comm;
-  unsigned int cursor;
-  xbt_dynar_foreach(patterns, cursor, comm) {
-    mc_comm_pattern_t copy_comm = MC_comm_pattern_dup(comm);
-    xbt_dynar_push(res, &copy_comm);
-  }
-
-  return res;
-}
-
-static void MC_patterns_copy(xbt_dynar_t dest, xbt_dynar_t source)
+static void MC_patterns_copy(xbt_dynar_t dest,
+  std::vector<simgrid::mc::PatternCommunication> const& source)
 {
   xbt_dynar_reset(dest);
-
-  unsigned int cursor;
-  mc_comm_pattern_t comm;
-  xbt_dynar_foreach(source, cursor, comm) {
-    mc_comm_pattern_t copy_comm = MC_comm_pattern_dup(comm);
+  for (simgrid::mc::PatternCommunication const& comm : source) {
+    simgrid::mc::PatternCommunication* copy_comm = new simgrid::mc::PatternCommunication(comm.dup());
     xbt_dynar_push(dest, &copy_comm);
   }
 }
 
 void MC_restore_communications_pattern(simgrid::mc::State* state)
 {
-  mc_list_comm_pattern_t list_process_comm;
+  simgrid::mc::PatternCommunicationList* list_process_comm;
   unsigned int cursor;
 
   xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm)
@@ -70,25 +40,28 @@ void MC_restore_communications_pattern(simgrid::mc::State* state)
   for (unsigned i = 0; i < MC_smx_get_maxpid(); i++)
     MC_patterns_copy(
       xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t),
-      xbt_dynar_get_as(state->incomplete_comm_pattern, i, xbt_dynar_t)
+      state->incomplete_comm_pattern[i]
     );
 }
 
 void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state)
 {
-  state->incomplete_comm_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
-
+  state->incomplete_comm_pattern.clear();
   for (unsigned i=0; i < MC_smx_get_maxpid(); i++) {
-    xbt_dynar_t comms = xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t);
-    xbt_dynar_t copy = MC_comm_patterns_dup(comms);
-    xbt_dynar_insert_at(state->incomplete_comm_pattern, i, &copy);
+    xbt_dynar_t patterns = xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t);
+    std::vector<simgrid::mc::PatternCommunication> res;
+    simgrid::mc::PatternCommunication* comm;
+    unsigned int cursor;
+    xbt_dynar_foreach(patterns, cursor, comm)
+      res.push_back(comm->dup());
+    state->incomplete_comm_pattern.push_back(std::move(res));
   }
 }
 
 void MC_state_copy_index_communications_pattern(simgrid::mc::State* state)
 {
   state->communicationIndices.clear();
-  mc_list_comm_pattern_t list_process_comm;
+  simgrid::mc::PatternCommunicationList* list_process_comm;
   unsigned int cursor;
   xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm)
     state->communicationIndices.push_back(list_process_comm->index_comm);
@@ -125,28 +98,3 @@ void MC_handle_comm_pattern(
   }
 
 }
-
-void MC_comm_pattern_free(mc_comm_pattern_t p)
-{  
-  delete p;
-  p = nullptr;
-}
-
-static void MC_list_comm_pattern_free(mc_list_comm_pattern_t l)
-{
-  xbt_dynar_free(&(l->list));
-  xbt_free(l);
-  l = nullptr;
-}
-
-void MC_comm_pattern_free_voidp(void *p)
-{
-  MC_comm_pattern_free((mc_comm_pattern_t) * (void **) p);
-}
-
-void MC_list_comm_pattern_free_voidp(void *p)
-{
-  MC_list_comm_pattern_free((mc_list_comm_pattern_t) * (void **) p);
-}
-
-}
index fb3de15..c84643c 100644 (file)
 
 #include "src/mc/mc_state.h"
 
-SG_BEGIN_DECL()
-
-typedef struct s_mc_comm_pattern{
-  int num = 0;
-  smx_synchro_t comm_addr;
-  e_smx_comm_type_t type = SIMIX_COMM_SEND;
-  unsigned long src_proc = 0;
-  unsigned long dst_proc = 0;
-  const char *src_host = nullptr;
-  const char *dst_host = nullptr;
-  std::string rdv;
-  std::vector<char> data;
-  int tag = 0;
-  int index = 0;
-
-  s_mc_comm_pattern()
-  {
-    std::memset(&comm_addr, 0, sizeof(comm_addr));
-  }
+namespace simgrid {
+namespace mc {
 
-  // No copy:
-  s_mc_comm_pattern(s_mc_comm_pattern const&) = delete;
-  s_mc_comm_pattern& operator=(s_mc_comm_pattern const&) = delete;
+struct PatternCommunicationList {
+  unsigned int index_comm = 0;
+  std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
+};
 
-} s_mc_comm_pattern_t, *mc_comm_pattern_t;
+}
+}
 
-typedef struct s_mc_list_comm_pattern{
-  unsigned int index_comm;
-  xbt_dynar_t list;
-}s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t;
+SG_BEGIN_DECL()
 
 /**
  *  Type: `xbt_dynar_t<mc_list_comm_pattenr_t>`
@@ -59,7 +41,7 @@ typedef struct s_mc_list_comm_pattern{
 extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern;
 
 /**
- *  Type: `xbt_dynar_t<xbt_dynar_t<mc_comm_pattern_t>>`
+ *  Type: `xbt_dynar_t<xbt_dynar_t<simgrid::mc::PatternCommunication*>>`
  */
 extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern;
 
@@ -100,20 +82,13 @@ static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
 
 XBT_PRIVATE void MC_get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
 XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
-XBT_PRIVATE void MC_comm_pattern_free_voidp(void *p);
-XBT_PRIVATE void MC_list_comm_pattern_free_voidp(void *p);
 XBT_PRIVATE void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigned int issuer, int backtracking);
 
 XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
 
-XBT_PRIVATE mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm);
-XBT_PRIVATE xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t state);
-
 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
 XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
 
-XBT_PRIVATE void MC_comm_pattern_free(mc_comm_pattern_t p);
-
 SG_END_DECL()
 
 #endif
index 06192f2..a5bf48a 100644 (file)
@@ -146,9 +146,9 @@ static int compare_areas_with_type(ComparisonState& state,
 
     if (type->subtype && type->subtype->type == DW_TAG_subroutine_type)
       return (addr_pointed1 != addr_pointed2);
-    if (addr_pointed1 == nullptr && addr_pointed2 == NULL)
+    if (addr_pointed1 == nullptr && addr_pointed2 == nullptr)
       return 0;
-    if (addr_pointed1 == nullptr || addr_pointed2 == NULL)
+    if (addr_pointed1 == nullptr || addr_pointed2 == nullptr)
       return 1;
     if (!state.compared_pointers.insert(
         std::make_pair(addr_pointed1, addr_pointed2)).second)
index fb5c0d3..d0974ea 100644 (file)
@@ -16,6 +16,8 @@
 #include "src/mc/mc_dwarf.hpp"
 #include "src/mc/Type.hpp"
 
+#include <xbt/dynar.h>
+
 using simgrid::mc::remote;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_diff, xbt,
@@ -378,7 +380,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
           res_compare =
               compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                                nullptr, NULL, 0);
+                                nullptr, nullptr, 0);
 
           if (res_compare != 1) {
             for (k = 1; k < heapinfo2->busy_block.size; k++)
@@ -417,7 +419,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
         res_compare =
             compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                              nullptr, NULL, 0);
+                              nullptr, nullptr, 0);
 
         if (res_compare != 1) {
           for (k = 1; k < heapinfo2b->busy_block.size; k++)
@@ -469,7 +471,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot1, snapshot2,
-                                  nullptr, NULL, 0);
+                                  nullptr, nullptr, 0);
 
             if (res_compare != 1)
               equal = 1;
@@ -517,7 +519,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot2, snapshot2,
-                                  nullptr, NULL, 0);
+                                  nullptr, nullptr, 0);
 
             if (res_compare != 1) {
               equal = 1;
@@ -1021,7 +1023,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, s
   int type_size = -1;
   int offset1 = 0, offset2 = 0;
   int new_size1 = -1, new_size2 = -1;
-  simgrid::mc::Type *new_type1 = nullptr, *new_type2 = NULL;
+  simgrid::mc::Type *new_type1 = nullptr, *new_type2 = nullptr;
 
   int match_pairs = 0;
 
@@ -1305,7 +1307,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, s
         return -1;
       }
 
-      if (new_type1 != nullptr && new_type2 != NULL && new_type1 != new_type2) {
+      if (new_type1 != nullptr && new_type2 != nullptr && new_type1 != new_type2) {
 
         type = new_type1;
         while (type->byte_size == 0 && type->subtype != nullptr)
index 41161a4..af30422 100644 (file)
@@ -998,11 +998,11 @@ void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf)
   Dwarf_Off next_offset = 0;
   size_t length;
 
-  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, NULL, NULL) ==
+  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, nullptr, nullptr) ==
          0) {
     Dwarf_Die unit_die;
     if (dwarf_offdie(dwarf, offset + length, &unit_die) != nullptr)
-      MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, NULL);
+      MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, nullptr);
     offset = next_offset;
   }
 }
index 079c2aa..38609f9 100644 (file)
 
 #include <vector>
 
+#include <xbt/dynar.h>
+#include <xbt/automaton.h>
+#include <xbt/swag.h>
+
 #include "mc_base.h"
 
 #include "mc/mc.h"
@@ -145,7 +149,7 @@ void replay(std::list<std::unique_ptr<simgrid::mc::State>> const& stack)
     assert(n == xbt_dynar_length(initial_communications_pattern));
     for (unsigned j=0; j < n ; j++) {
       xbt_dynar_reset((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, j, xbt_dynar_t));
-      xbt_dynar_get_as(initial_communications_pattern, j, mc_list_comm_pattern_t)->index_comm = 0;
+      xbt_dynar_get_as(initial_communications_pattern, j, simgrid::mc::PatternCommunicationList*)->index_comm = 0;
     }
   }
 
index 99da4d5..ceaf9c1 100644 (file)
@@ -19,7 +19,6 @@
 #include <elfutils/libdw.h>
 
 #include <simgrid/msg.h>
-#include <xbt/fifo.h>
 #include <xbt/config.h>
 #include <xbt/base.h>
 #include <xbt/automaton.h>
index a2f6ce4..a504372 100644 (file)
@@ -12,7 +12,6 @@
 #include <sstream>
 #include <string>
 
-#include <xbt/fifo.h>
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
 
index 2c55598..db7636f 100644 (file)
@@ -21,8 +21,6 @@
 #include <vector>
 
 #include <xbt/base.h>
-#include <xbt/dynar.h>
-#include <xbt/fifo.h>
 
 namespace simgrid {
 namespace mc {
@@ -67,14 +65,6 @@ SG_BEGIN_DECL()
 
 // **** Data conversion
 
-/** Generate a string representation
-*
-* The current format is a ";"-delimited list of pairs:
-* "pid0,value0;pid2,value2;pid3,value3". The value can be
-* omitted is it is null.
-*/
-XBT_PRIVATE char* MC_record_stack_to_string(xbt_fifo_t stack);
-
 SG_END_DECL()
 
 #endif
index cfd41a6..d92703c 100644 (file)
@@ -15,7 +15,7 @@ SG_BEGIN_DECL()
 
 /** Replay path (if any) in string representation
  *
- *  This is a path as generated by `MC_record_stack_to_string()`.
+ *  This is using the format generated by traceToString().
  */
 XBT_PUBLIC_DATA(char*) MC_record_path;
 
index 121ce91..f7ac9b2 100644 (file)
@@ -10,6 +10,7 @@
 #include <xbt/str.h>
 #include <xbt/sysdep.h>
 #include <xbt/dynar.h>
+#include <xbt/swag.h>
 
 #include "src/mc/mc_request.h"
 #include "src/mc/mc_safety.h"
@@ -106,7 +107,7 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
 
   if (r1->call == SIMCALL_COMM_WAIT
       && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
-      && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == NULL))
+      && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == nullptr))
     return false;
 
   if (r1->call == SIMCALL_COMM_TEST &&
@@ -313,7 +314,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
         act = remote_act;
 
     char* p;
-    if (act->comm.src_proc == nullptr || act->comm.dst_proc == NULL) {
+    if (act->comm.src_proc == nullptr || act->comm.dst_proc == nullptr) {
       type = "Test FALSE";
       p = pointer_to_string(remote_act);
       args = bprintf("comm=%s", p);
@@ -539,7 +540,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     s_smx_synchro_t synchro;
     mc_model_checker->process().read_bytes(&synchro,
       sizeof(synchro), remote(remote_act));
-    if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == NULL) {
+    if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == nullptr) {
       if (issuer->host)
         label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE",
                     issuer->pid,
index b1cd987..23fbe10 100644 (file)
@@ -15,7 +15,6 @@
 #include <simgrid_config.h>
 
 #include <xbt/base.h>
-#include <xbt/dynar.h>
 
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_state.h"
index 6913890..b904885 100644 (file)
@@ -40,10 +40,10 @@ simgrid::mc::SimixProcessInformation* MC_smx_process_get_info(smx_process_t p)
   return process_info;
 }
 
-/** Load the remote swag of processes into a dynar
+/** Load the remote swag of processes into a vector
  *
  *  @param process     MCed process
- *  @param target      Local dynar (to be filled with copies of `s_smx_process_t`)
+ *  @param target      Local vector (to be filled with copies of `s_smx_process_t`)
  *  @param remote_swag Address of the process SWAG in the remote list
  */
 static void MC_process_refresh_simix_process_list(
@@ -56,7 +56,7 @@ static void MC_process_refresh_simix_process_list(
   s_xbt_swag_t swag;
   process->read_bytes(&swag, sizeof(swag), remote(remote_swag));
 
-  // Load each element of the dynar from the MCed process:
+  // Load each element of the vector from the MCed process:
   int i = 0;
   for (smx_process_t p = (smx_process_t) swag.head; p; ++i) {
 
index 81dc444..3817326 100644 (file)
@@ -213,8 +213,8 @@ XBT_PRIVATE int MC_snapshot_memcmp(
 static inline __attribute__ ((always_inline))
 const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot)
 {
-  if(snapshot==NULL)
-      xbt_die("snapshot is NULL");
+  if(snapshot==nullptr)
+      xbt_die("snapshot is nullptr");
   return mc_model_checker->process().get_heap()->breakval;
 }
 
index 2012bcd..5967f1a 100644 (file)
@@ -30,9 +30,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc,
 simgrid::mc::State* MC_state_new()
 {
   simgrid::mc::State* state = new simgrid::mc::State();
-  std::memset(&state->internal_comm, 0, sizeof(state->internal_comm));
-  std::memset(&state->internal_req, 0, sizeof(state->internal_req));
-  std::memset(&state->executed_req, 0, sizeof(state->executed_req));
   state->processStates.resize(MC_smx_get_maxpid());
   state->num = ++mc_stats->expanded_states;
   /* Stateful model checking */
@@ -56,11 +53,6 @@ State::State()
   std::memset(&this->executed_req, 0, sizeof(this->executed_req));
 }
 
-State::~State()
-{
-  xbt_free(this->incomplete_comm_pattern);
-}
-
 std::size_t State::interleaveSize() const
 {
   return std::count_if(this->processStates.begin(), this->processStates.end(),
@@ -77,12 +69,6 @@ void MC_state_interleave_process(simgrid::mc::State* state, smx_process_t proces
   state->processStates[process->pid].interleave_count = 0;
 }
 
-void MC_state_remove_interleave_process(simgrid::mc::State* state, smx_process_t process)
-{
-  if (state->processStates[process->pid].state == simgrid::mc::ProcessInterleaveState::interleave)
-    state->processStates[process->pid].state = simgrid::mc::ProcessInterleaveState::done;
-}
-
 void MC_state_set_executed_request(simgrid::mc::State* state, smx_simcall_t req,
                                    int value)
 {
index a744151..3fb62da 100644 (file)
@@ -22,6 +22,43 @@ namespace mc {
 
 extern XBT_PRIVATE std::unique_ptr<s_mc_global_t> initial_global_state;
 
+struct PatternCommunication {
+  int num = 0;
+  smx_synchro_t comm_addr;
+  e_smx_comm_type_t type = SIMIX_COMM_SEND;
+  unsigned long src_proc = 0;
+  unsigned long dst_proc = 0;
+  const char *src_host = nullptr;
+  const char *dst_host = nullptr;
+  std::string rdv;
+  std::vector<char> data;
+  int tag = 0;
+  int index = 0;
+
+  PatternCommunication()
+  {
+    std::memset(&comm_addr, 0, sizeof(comm_addr));
+  }
+
+  PatternCommunication dup() const
+  {
+    simgrid::mc::PatternCommunication res;
+    // num?
+    res.comm_addr = this->comm_addr;
+    res.type = this->type;
+    // src_proc?
+    // dst_proc?
+    res.dst_proc = this->dst_proc;
+    res.dst_host = this->dst_host;
+    res.rdv = this->rdv;
+    res.data = this->data;
+    // tag?
+    res.index = this->index;
+    return res;
+  }
+
+};
+
 /* Possible exploration status of a process in a state */
 enum class ProcessInterleaveState {
   no_interleave=0, /* Do not interleave (do not execute) */
@@ -65,19 +102,13 @@ struct XBT_PRIVATE State {
   int num = 0;
   int in_visited_states = 0;
 
-  // comm determinism verification (xbt_dynar_t<xbt_dynar_t<mc_comm_pattern_t>):
-  xbt_dynar_t incomplete_comm_pattern = nullptr;
+  // comm determinism verification (xbt_dynar_t<xbt_dynar_t<simgrid::mc::PatternCommunication*>):
+  std::vector<std::vector<simgrid::mc::PatternCommunication>> incomplete_comm_pattern;
 
   // For communication determinism verification:
   std::vector<unsigned> communicationIndices;
 
   State();
-  ~State();
-
-  State(State const&) = delete;
-  State operator=(State const&) = delete;
-  State(State const&&) = delete;
-  State operator=(State const&&) = delete;
 
   std::size_t interleaveSize() const;
 };
@@ -93,6 +124,5 @@ XBT_PRIVATE void MC_state_set_executed_request(simgrid::mc::State* state, smx_si
 XBT_PRIVATE smx_simcall_t MC_state_get_executed_request(simgrid::mc::State* state, int *value);
 XBT_PRIVATE smx_simcall_t MC_state_get_internal_request(simgrid::mc::State* state);
 XBT_PRIVATE smx_simcall_t MC_state_get_request(simgrid::mc::State* state, int *value);
-XBT_PRIVATE void MC_state_remove_interleave_process(simgrid::mc::State* state, smx_process_t process);
 
 #endif
index aa72529..81ffb59 100755 (executable)
@@ -102,7 +102,9 @@ if test "$(uname -o)" != "Msys"; then
   echo "XX"
   tar xzf `cat VERSION`.tar.gz
   cd `cat VERSION`
-  SRCFOLDER="."
+  mkdir build
+  cd build
+  SRCFOLDER=".."
 else
 #for windows we don't make dist, but we still want to build out of source
   SRCFOLDER=$WORKSPACE
@@ -128,7 +130,7 @@ make -j$NUMBER_OF_PROCESSORS VERBOSE=1
 
 if test "$(uname -o)" != "Msys"; then
   cd $WORKSPACE/build
-  cd `cat VERSION`
+  cd `cat VERSION`/build
 fi
 
 TRES=0