Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc/compare: factorize code.
[simgrid.git] / src / mc / compare.cpp
index ab43da1..b913fae 100644 (file)
@@ -41,15 +41,6 @@ public:
 typedef std::array<HeapLocation, 2> HeapLocationPair;
 typedef std::set<HeapLocationPair> HeapLocationPairs;
 
-struct ProcessComparisonState;
-struct StateComparator;
-
-static inline
-HeapLocationPair makeHeapLocationPair(int block1, int fragment1, int block2, int fragment2)
-{
-  return HeapLocationPair{{HeapLocation(block1, fragment1), HeapLocation(block2, fragment2)}};
-}
-
 class HeapArea : public HeapLocation {
 public:
   bool valid_ = false;
@@ -72,9 +63,6 @@ public:
   void initHeapInformation(xbt_mheap_t heap, std::vector<simgrid::mc::IgnoredHeapRegion>* i);
 };
 
-static bool heap_area_differ(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1,
-                             Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level);
-
 class StateComparator {
 public:
   s_xbt_mheap_t std_heap_copy;
@@ -94,38 +82,22 @@ public:
     std::vector<simgrid::mc::IgnoredHeapRegion>* i1,
     std::vector<simgrid::mc::IgnoredHeapRegion>* i2);
 
-  HeapArea& equals_to1_(std::size_t i, std::size_t j)
+  template <int rank> HeapArea& equals_to_(std::size_t i, std::size_t j)
   {
-    return processStates[0].equals_to[ MAX_FRAGMENT_PER_BLOCK * i + j];
+    return processStates[rank - 1].equals_to[MAX_FRAGMENT_PER_BLOCK * i + j];
   }
-  HeapArea& equals_to2_(std::size_t i, std::size_t j)
+  template <int rank> Type*& types_(std::size_t i, std::size_t j)
   {
-    return processStates[1].equals_to[ MAX_FRAGMENT_PER_BLOCK * i + j];
-  }
-  Type*& types1_(std::size_t i, std::size_t j)
-  {
-    return processStates[0].types[ MAX_FRAGMENT_PER_BLOCK * i + j];
-  }
-  Type*& types2_(std::size_t i, std::size_t j)
-  {
-    return processStates[1].types[ MAX_FRAGMENT_PER_BLOCK * i + j];
+    return processStates[rank - 1].types[MAX_FRAGMENT_PER_BLOCK * i + j];
   }
 
-  HeapArea const& equals_to1_(std::size_t i, std::size_t j) const
-  {
-    return processStates[0].equals_to[ MAX_FRAGMENT_PER_BLOCK * i + j];
-  }
-  HeapArea const& equals_to2_(std::size_t i, std::size_t j) const
-  {
-    return processStates[1].equals_to[ MAX_FRAGMENT_PER_BLOCK * i + j];
-  }
-  Type* const& types1_(std::size_t i, std::size_t j) const
+  template <int rank> HeapArea const& equals_to_(std::size_t i, std::size_t j) const
   {
-    return processStates[0].types[ MAX_FRAGMENT_PER_BLOCK * i + j];
+    return processStates[rank - 1].equals_to[MAX_FRAGMENT_PER_BLOCK * i + j];
   }
-  Type* const& types2_(std::size_t i, std::size_t j) const
+  template <int rank> Type* const& types_(std::size_t i, std::size_t j) const
   {
-    return processStates[1].types[ MAX_FRAGMENT_PER_BLOCK * i + j];
+    return processStates[rank - 1].types[MAX_FRAGMENT_PER_BLOCK * i + j];
   }
 
   /** Check whether two blocks are known to be matching
@@ -136,7 +108,7 @@ public:
    */
   bool blocksEqual(int b1, int b2) const
   {
-    return this->equals_to1_(b1, 0).block_ == b2 && this->equals_to2_(b2, 0).block_ == b1;
+    return this->equals_to_<1>(b1, 0).block_ == b2 && this->equals_to_<2>(b2, 0).block_ == b1;
   }
 
   /** Check whether two fragments are known to be matching
@@ -149,8 +121,8 @@ public:
    */
   int fragmentsEqual(int b1, int f1, int b2, int f2) const
   {
-    return this->equals_to1_(b1, f1).block_ == b2 && this->equals_to1_(b1, f1).fragment_ == f2 &&
-           this->equals_to2_(b2, f2).block_ == b1 && this->equals_to2_(b2, f2).fragment_ == f1;
+    return this->equals_to_<1>(b1, f1).block_ == b2 && this->equals_to_<1>(b1, f1).fragment_ == f2 &&
+           this->equals_to_<2>(b2, f2).block_ == b1 && this->equals_to_<2>(b2, f2).fragment_ == f1;
   }
 
   void match_equals(HeapLocationPairs* list);
@@ -212,11 +184,11 @@ void StateComparator::match_equals(HeapLocationPairs* list)
 {
   for (auto const& pair : *list) {
     if (pair[0].fragment_ != -1) {
-      this->equals_to1_(pair[0].block_, pair[0].fragment_) = simgrid::mc::HeapArea(pair[1].block_, pair[1].fragment_);
-      this->equals_to2_(pair[1].block_, pair[1].fragment_) = simgrid::mc::HeapArea(pair[0].block_, pair[0].fragment_);
+      this->equals_to_<1>(pair[0].block_, pair[0].fragment_) = simgrid::mc::HeapArea(pair[1].block_, pair[1].fragment_);
+      this->equals_to_<2>(pair[1].block_, pair[1].fragment_) = simgrid::mc::HeapArea(pair[0].block_, pair[0].fragment_);
     } else {
-      this->equals_to1_(pair[0].block_, 0) = simgrid::mc::HeapArea(pair[1].block_, pair[1].fragment_);
-      this->equals_to2_(pair[1].block_, 0) = simgrid::mc::HeapArea(pair[0].block_, pair[0].fragment_);
+      this->equals_to_<1>(pair[0].block_, 0) = simgrid::mc::HeapArea(pair[1].block_, pair[1].fragment_);
+      this->equals_to_<2>(pair[1].block_, 0) = simgrid::mc::HeapArea(pair[0].block_, pair[0].fragment_);
     }
   }
 }
@@ -253,10 +225,13 @@ static inline Region* MC_get_heap_region(Snapshot* snapshot)
   xbt_die("No heap region");
 }
 
+static bool heap_area_differ(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1,
+                             Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level);
+
 static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc::Snapshot* snapshot1,
                                 simgrid::mc::Snapshot* snapshot2)
 {
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClient& process = mc_model_checker->process();
 
   /* Check busy blocks */
   size_t i1 = 1;
@@ -269,7 +244,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
   simgrid::mc::Region* heap_region2 = MC_get_heap_region(snapshot2);
 
   // This is the address of std_heap->heapinfo in the application process:
-  void* heapinfo_address = &((xbt_mheap_t) process->heap_address)->heapinfo;
+  void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
 
   // This is in snapshot do not use them directly:
   const malloc_info* heapinfos1 =
@@ -300,14 +275,14 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
 
       if (is_stack(addr_block1)) {
         for (size_t k = 0; k < heapinfo1->busy_block.size; k++)
-          state.equals_to1_(i1 + k, 0) = HeapArea(i1, -1);
+          state.equals_to_<1>(i1 + k, 0) = HeapArea(i1, -1);
         for (size_t k = 0; k < heapinfo2->busy_block.size; k++)
-          state.equals_to2_(i1 + k, 0) = HeapArea(i1, -1);
+          state.equals_to_<2>(i1 + k, 0) = HeapArea(i1, -1);
         i1 += heapinfo1->busy_block.size;
         continue;
       }
 
-      if (state.equals_to1_(i1, 0).valid_) {
+      if (state.equals_to_<1>(i1, 0).valid_) {
         i1++;
         continue;
       }
@@ -316,13 +291,13 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
       bool equal = false;
 
       /* Try first to associate to same block in the other heap */
-      if (heapinfo2->type == heapinfo1->type && state.equals_to2_(i1, 0).valid_ == 0) {
+      if (heapinfo2->type == heapinfo1->type && state.equals_to_<2>(i1, 0).valid_ == 0) {
         void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
         if (not heap_area_differ(state, addr_block1, addr_block2, snapshot1, snapshot2, nullptr, nullptr, 0)) {
           for (size_t k = 1; k < heapinfo2->busy_block.size; k++)
-            state.equals_to2_(i1 + k, 0) = HeapArea(i1, -1);
+            state.equals_to_<2>(i1 + k, 0) = HeapArea(i1, -1);
           for (size_t k = 1; k < heapinfo1->busy_block.size; k++)
-            state.equals_to1_(i1 + k, 0) = HeapArea(i1, -1);
+            state.equals_to_<1>(i1 + k, 0) = HeapArea(i1, -1);
           equal = true;
           i1 += heapinfo1->busy_block.size;
         }
@@ -345,16 +320,16 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
           continue;
         }
 
-        if (state.equals_to2_(i2, 0).valid_) {
+        if (state.equals_to_<2>(i2, 0).valid_) {
           i2++;
           continue;
         }
 
         if (not heap_area_differ(state, addr_block1, addr_block2, snapshot1, snapshot2, nullptr, nullptr, 0)) {
           for (size_t k = 1; k < heapinfo2b->busy_block.size; k++)
-            state.equals_to2_(i2 + k, 0) = HeapArea(i1, -1);
+            state.equals_to_<2>(i2 + k, 0) = HeapArea(i1, -1);
           for (size_t k = 1; k < heapinfo1->busy_block.size; k++)
-            state.equals_to1_(i1 + k, 0) = HeapArea(i2, -1);
+            state.equals_to_<1>(i1 + k, 0) = HeapArea(i2, -1);
           equal = true;
           i1 += heapinfo1->busy_block.size;
         }
@@ -374,7 +349,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
         if (heapinfo1->busy_frag.frag_size[j1] == -1) /* Free fragment_ */
           continue;
 
-        if (state.equals_to1_(i1, j1).valid_)
+        if (state.equals_to_<1>(i1, j1).valid_)
           continue;
 
         void* addr_frag1 = (void*)((char*)addr_block1 + (j1 << heapinfo1->type));
@@ -383,7 +358,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
         bool equal = false;
 
         /* Try first to associate to same fragment_ in the other heap */
-        if (heapinfo2->type == heapinfo1->type && not state.equals_to2_(i1, j1).valid_) {
+        if (heapinfo2->type == heapinfo1->type && not state.equals_to_<2>(i1, j1).valid_) {
           void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
           void* addr_frag2  = (void*)((char*)addr_block2 + (j1 << heapinfo2->type));
           if (not heap_area_differ(state, addr_frag1, addr_frag2, snapshot1, snapshot2, nullptr, nullptr, 0))
@@ -416,7 +391,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
             if (i2 == i1 && j2 == j1)
               continue;
 
-            if (state.equals_to2_(i2, j2).valid_)
+            if (state.equals_to_<2>(i2, j2).valid_)
               continue;
 
             void* addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
@@ -448,7 +423,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
         (const malloc_info*)heap_region1->read(&heapinfo_temp1, &heapinfos1[i], sizeof(malloc_info));
 
     if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo1->busy_block.busy_size > 0 &&
-        not state.equals_to1_(i, 0).valid_) {
+        not state.equals_to_<1>(i, 0).valid_) {
       XBT_DEBUG("Block %zu not found (size used = %zu)", i, heapinfo1->busy_block.busy_size);
       return true;
     }
@@ -456,7 +431,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
     if (heapinfo1->type <= 0)
       continue;
     for (size_t j = 0; j < (size_t)(BLOCKSIZE >> heapinfo1->type); j++)
-      if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && not state.equals_to1_(i, j).valid_) {
+      if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && not state.equals_to_<1>(i, j).valid_) {
         XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)", i, j, heapinfo1->busy_frag.frag_size[j]);
         return true;
       }
@@ -466,7 +441,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
     const malloc_info* heapinfo2 =
         (const malloc_info*)heap_region2->read(&heapinfo_temp2, &heapinfos2[i], sizeof(malloc_info));
     if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo2->busy_block.busy_size > 0 &&
-        not state.equals_to2_(i, 0).valid_) {
+        not state.equals_to_<2>(i, 0).valid_) {
       XBT_DEBUG("Block %zu not found (size used = %zu)", i,
                 heapinfo2->busy_block.busy_size);
       return true;
@@ -476,7 +451,7 @@ static bool mmalloc_heap_differ(simgrid::mc::StateComparator& state, simgrid::mc
       continue;
 
     for (size_t j = 0; j < (size_t)(BLOCKSIZE >> heapinfo2->type); j++)
-      if (i1 == state.heaplimit && heapinfo2->busy_frag.frag_size[j] > 0 && not state.equals_to2_(i, j).valid_) {
+      if (i1 == state.heaplimit && heapinfo2->busy_frag.frag_size[j] > 0 && not state.equals_to_<2>(i, j).valid_) {
         XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)",
           i, j, heapinfo2->busy_frag.frag_size[j]);
         return true;
@@ -503,7 +478,7 @@ static bool heap_area_differ_without_type(simgrid::mc::StateComparator& state, c
                                           simgrid::mc::Snapshot* snapshot2, HeapLocationPairs* previous, int size,
                                           int check_ignore)
 {
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClient& process = mc_model_checker->process();
   simgrid::mc::Region* heap_region1  = MC_get_heap_region(snapshot1);
   simgrid::mc::Region* heap_region2  = MC_get_heap_region(snapshot2);
 
@@ -533,8 +508,7 @@ static bool heap_area_differ_without_type(simgrid::mc::StateComparator& state, c
       const void* addr_pointed1 = snapshot1->read(remote((void**)((const char*)real_area1 + pointer_align)));
       const void* addr_pointed2 = snapshot2->read(remote((void**)((const char*)real_area2 + pointer_align)));
 
-      if (process->in_maestro_stack(remote(addr_pointed1))
-        && process->in_maestro_stack(remote(addr_pointed2))) {
+      if (process.in_maestro_stack(remote(addr_pointed1)) && process.in_maestro_stack(remote(addr_pointed2))) {
         i = pointer_align + sizeof(void *);
         continue;
       }
@@ -803,7 +777,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
                              simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot* snapshot2,
                              HeapLocationPairs* previous, simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClient& process = mc_model_checker->process();
 
   ssize_t block1;
   ssize_t block2;
@@ -822,7 +796,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
   bool match_pairs = false;
 
   // This is the address of std_heap->heapinfo in the application process:
-  void* heapinfo_address = &((xbt_mheap_t) process->heap_address)->heapinfo;
+  void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
 
   const malloc_info* heapinfos1 = snapshot1->read(remote((const malloc_info**)heapinfo_address));
   const malloc_info* heapinfos2 = snapshot2->read(remote((const malloc_info**)heapinfo_address));
@@ -842,7 +816,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
 
   // If either block is a stack block:
   if (is_block_stack((int) block1) && is_block_stack((int) block2)) {
-    previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1));
+    previous->insert(HeapLocationPair{{HeapLocation(block1, -1), HeapLocation(block2, -1)}});
     if (match_pairs)
       state.match_equals(previous);
     return false;
@@ -897,7 +871,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
 
     // TODO, lookup variable type from block type as done for fragmented blocks
 
-    if (state.equals_to1_(block1, 0).valid_ && state.equals_to2_(block2, 0).valid_ &&
+    if (state.equals_to_<1>(block1, 0).valid_ && state.equals_to_<2>(block2, 0).valid_ &&
         state.blocksEqual(block1, block2)) {
       if (match_pairs)
         state.match_equals(previous);
@@ -916,7 +890,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
         heapinfo1->busy_block.busy_size != heapinfo2->busy_block.busy_size)
       return true;
 
-    if (not previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1)).second) {
+    if (not previous->insert(HeapLocationPair{{HeapLocation(block1, -1), HeapLocation(block2, -1)}}).second) {
       if (match_pairs)
         state.match_equals(previous);
       return false;
@@ -927,9 +901,9 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
     // Remember (basic) type inference.
     // The current data structure only allows us to do this for the whole block.
     if (type != nullptr && area1 == real_addr_block1)
-      state.types1_(block1, 0) = type;
+      state.types_<1>(block1, 0) = type;
     if (type != nullptr && area2 == real_addr_block2)
-      state.types2_(block2, 0) = type;
+      state.types_<2>(block2, 0) = type;
 
     if (size <= 0) {
       if (match_pairs)
@@ -968,7 +942,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
     }
 
     // Check if the blocks are already matched together:
-    if (state.equals_to1_(block1, frag1).valid_ && state.equals_to2_(block2, frag2).valid_ && offset1 == offset2 &&
+    if (state.equals_to_<1>(block1, frag1).valid_ && state.equals_to_<2>(block2, frag2).valid_ && offset1 == offset2 &&
         state.fragmentsEqual(block1, frag1, block2, frag2)) {
       if (match_pairs)
         state.match_equals(previous);
@@ -990,29 +964,29 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
     // Remember (basic) type inference.
     // The current data structure only allows us to do this for the whole fragment_.
     if (type != nullptr && area1 == real_addr_frag1)
-      state.types1_(block1, frag1) = type;
+      state.types_<1>(block1, frag1) = type;
     if (type != nullptr && area2 == real_addr_frag2)
-      state.types2_(block2, frag2) = type;
+      state.types_<2>(block2, frag2) = type;
 
     // The type of the variable is already known:
     if (type) {
       new_type1 = new_type2 = type;
     }
     // Type inference from the block type.
-    else if (state.types1_(block1, frag1) != nullptr || state.types2_(block2, frag2) != nullptr) {
+    else if (state.types_<1>(block1, frag1) != nullptr || state.types_<2>(block2, frag2) != nullptr) {
 
       offset1 = (char*)area1 - (char*)real_addr_frag1;
       offset2 = (char*)area2 - (char*)real_addr_frag2;
 
-      if (state.types1_(block1, frag1) != nullptr && state.types2_(block2, frag2) != nullptr) {
-        new_type1 = get_offset_type(real_addr_frag1, state.types1_(block1, frag1), offset1, size, snapshot1);
-        new_type2 = get_offset_type(real_addr_frag2, state.types2_(block2, frag2), offset1, size, snapshot2);
-      } else if (state.types1_(block1, frag1) != nullptr) {
-        new_type1 = get_offset_type(real_addr_frag1, state.types1_(block1, frag1), offset1, size, snapshot1);
-        new_type2 = get_offset_type(real_addr_frag2, state.types1_(block1, frag1), offset2, size, snapshot2);
-      } else if (state.types2_(block2, frag2) != nullptr) {
-        new_type1 = get_offset_type(real_addr_frag1, state.types2_(block2, frag2), offset1, size, snapshot1);
-        new_type2 = get_offset_type(real_addr_frag2, state.types2_(block2, frag2), offset2, size, snapshot2);
+      if (state.types_<1>(block1, frag1) != nullptr && state.types_<2>(block2, frag2) != nullptr) {
+        new_type1 = get_offset_type(real_addr_frag1, state.types_<1>(block1, frag1), offset1, size, snapshot1);
+        new_type2 = get_offset_type(real_addr_frag2, state.types_<2>(block2, frag2), offset1, size, snapshot2);
+      } else if (state.types_<1>(block1, frag1) != nullptr) {
+        new_type1 = get_offset_type(real_addr_frag1, state.types_<1>(block1, frag1), offset1, size, snapshot1);
+        new_type2 = get_offset_type(real_addr_frag2, state.types_<1>(block1, frag1), offset2, size, snapshot2);
+      } else if (state.types_<2>(block2, frag2) != nullptr) {
+        new_type1 = get_offset_type(real_addr_frag1, state.types_<2>(block2, frag2), offset1, size, snapshot1);
+        new_type2 = get_offset_type(real_addr_frag2, state.types_<2>(block2, frag2), offset2, size, snapshot2);
       } else {
         if (match_pairs)
           state.match_equals(previous);
@@ -1044,7 +1018,7 @@ static bool heap_area_differ(simgrid::mc::StateComparator& state, const void* ar
     }
 
     if (offset1 == 0 && offset2 == 0 &&
-        not previous->insert(simgrid::mc::makeHeapLocationPair(block1, frag1, block2, frag2)).second) {
+        not previous->insert(HeapLocationPair{{HeapLocation(block1, frag1), HeapLocation(block2, frag2)}}).second) {
       if (match_pairs)
         state.match_equals(previous);
       return false;
@@ -1278,17 +1252,12 @@ static bool local_variables_differ(simgrid::mc::StateComparator& state, simgrid:
 namespace simgrid {
 namespace mc {
 
-static std::unique_ptr<simgrid::mc::StateComparator> state_comparator;
-
 bool snapshot_equal(Snapshot* s1, Snapshot* s2)
 {
   // TODO, make this a field of ModelChecker or something similar
-  if (state_comparator == nullptr)
-    state_comparator.reset(new StateComparator());
-  else
-    state_comparator->clear();
+  static StateComparator state_comparator;
 
-  RemoteClient* process = &mc_model_checker->process();
+  const RemoteClient& process = mc_model_checker->process();
 
   if (s1->hash_ != s2->hash_) {
     XBT_VERB("(%d - %d) Different hash: 0x%" PRIx64 "--0x%" PRIx64, s1->num_state_, s2->num_state_, s1->hash_,
@@ -1316,10 +1285,10 @@ bool snapshot_equal(Snapshot* s1, Snapshot* s2)
 
   /* Init heap information used in heap comparison algorithm */
   xbt_mheap_t heap1 = (xbt_mheap_t)s1->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
-                                                  remote(process->heap_address), simgrid::mc::ReadOptions::lazy());
+                                                  remote(process.heap_address), simgrid::mc::ReadOptions::lazy());
   xbt_mheap_t heap2 = (xbt_mheap_t)s2->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
-                                                  remote(process->heap_address), simgrid::mc::ReadOptions::lazy());
-  if (state_comparator->initHeapInformation(heap1, heap2, &s1->to_ignore_, &s2->to_ignore_) == -1) {
+                                                  remote(process.heap_address), simgrid::mc::ReadOptions::lazy());
+  if (state_comparator.initHeapInformation(heap1, heap2, &s1->to_ignore_, &s2->to_ignore_) == -1) {
     XBT_VERB("(%d - %d) Different heap information", s1->num_state_, s2->num_state_);
     return false;
   }
@@ -1329,7 +1298,7 @@ bool snapshot_equal(Snapshot* s1, Snapshot* s2)
     mc_snapshot_stack_t stack1 = &s1->stacks_[cursor];
     mc_snapshot_stack_t stack2 = &s2->stacks_[cursor];
 
-    if (local_variables_differ(*state_comparator, s1, s2, stack1, stack2)) {
+    if (local_variables_differ(state_comparator, s1, s2, stack1, stack2)) {
       XBT_VERB("(%d - %d) Different local variables between stacks %u", s1->num_state_, s2->num_state_, cursor + 1);
       return false;
     }
@@ -1352,7 +1321,7 @@ bool snapshot_equal(Snapshot* s1, Snapshot* s2)
     xbt_assert(region1->object_info());
 
     /* Compare global variables */
-    if (global_variables_differ(*state_comparator, region1->object_info(), region1, region2, s1, s2)) {
+    if (global_variables_differ(state_comparator, region1->object_info(), region1, region2, s1, s2)) {
       std::string const& name = region1->object_info()->file_name;
       XBT_VERB("(%d - %d) Different global variables in %s", s1->num_state_, s2->num_state_, name.c_str());
       return false;
@@ -1360,7 +1329,7 @@ bool snapshot_equal(Snapshot* s1, Snapshot* s2)
   }
 
   /* Compare heap */
-  if (mmalloc_heap_differ(*state_comparator, s1, s2)) {
+  if (mmalloc_heap_differ(state_comparator, s1, s2)) {
     XBT_VERB("(%d - %d) Different heap (mmalloc_compare)", s1->num_state_, s2->num_state_);
     return false;
   }